I am helping my friend start up a server company and he had asked me if it was possible to do something like on gameservers.com where on the bottem right hand side you see the network graph and it shows how many people are playing on there servers. Is it possible with php? If so is there such a tutorial on it?
Network Tracker
Started by Davis, Jul 05 2008 07:58 AM
1 reply to this topic
#1
Posted 05 July 2008 - 07:58 AM
#2
Posted 13 July 2008 - 10:26 PM
It can be done with php, it is pretty hard though. It can all be done with cronjobs and sockets. (In other words you need linux, windows could work too but it may take longer to load as it will update every time the page is loaded instead of once every couple of minutes.) Anyways, I'm not going into the code to use but instead I'll tell you how it should be done. First, you open the connection, then you write the server query code to the open socket, then you parse the packets the server responds with, then you close the socket. This needs to be done with every gameserver on the network, then you add up all of the active players values, that will give you how many active players there are. Now, you need to set up a cronjob for that script to run every hour or so and voila you have how many active players there are on your network as of 1, 2, 3, 4, etc. hours ago. Now the reason I didn't get into the query codes for the servers is because every server type is different. For instance, if you wanted the query code for most steam powered games, the code you would need to write to the server would be:
And what each server responds with is different, so you need to parse the code differently for each server. Different game engines need different query codes as well. There used to be a great site with tutorials for gameserver programming called kquery.com, but they shut down their services. Anways, good luck to ya.
*EDIT*
When I get home from work tomorrow I have a counter-strike query and rcon command code that I made a while back when I was running gameservers. If you want I can put that up in the tutorial section and explain everything.
˙˙˙˙TSource Engine Query or FF FF FF FF 54 53 6F 75 72 63 65 20 45 6E 67 69 6E 65 20 51 75 65 72 79 00
And what each server responds with is different, so you need to parse the code differently for each server. Different game engines need different query codes as well. There used to be a great site with tutorials for gameserver programming called kquery.com, but they shut down their services. Anways, good luck to ya.
*EDIT*
When I get home from work tomorrow I have a counter-strike query and rcon command code that I made a while back when I was running gameservers. If you want I can put that up in the tutorial section and explain everything.
Edited by JoeyMagz, 13 July 2008 - 10:31 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
