Internet server discovery

Everything related to the code /
Tout ce qui touche au code
Post Reply
User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Internet server discovery

Post by zuzuf » Sun May 11, 2008 3:53 pm

I am writing the code to get a list of Internet servers.

Currently it's based on an HTTP request to a server. I've written 2 PHP scripts, one to get the server list and and one to advertise a server. Each a time one of these scripts is ran, it cleans its database, so we don't get outdated games in the list.

requirements:
a web server with PHP :)
=>;-D Penguin Powered

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Sun May 11, 2008 6:53 pm

Well, I suppose we can ask AF to set up one, once it is ready :)

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sun May 11, 2008 6:58 pm

I've already put the 2 scripts on ta3d.darkstars.co.uk, but currently it's for testing purposes only. I've sent a mail to AF to ask him if it can stay like this, just wait and see :wink:

So currently it works using default configuration (server load isn't high at all, it only updates the list every time a client refresh the list or a server updates its status, clients and servers refresh their list/status every 150 sec.)
=>;-D Penguin Powered

User avatar
AF
Administrateur - Site Admin
Posts: 139
Joined: Thu Dec 28, 2006 8:19 pm
Location: NW UK
Contact:

Post by AF » Sun May 11, 2008 7:57 pm

What you have at the moment uses mysql, and I would have thought it would be more logical to use a flat file based storage considering the cost of sql queries.

Also that way you could remove getserverlist.php completely. Also it would reduce the load on the server greatly, as you could return all the entries and do the filtering client side, which would be far more efficient than passing a part of the sql query to the server (and would be far safer than allowing malicious sql queries to be inserted)

Also wouldn't there be a need for unregister.php ? To help reduce the 'timeout' factor?

I'd like to see the load generated by these scripts numerically evaluated so I know exactly what sort of load they would generate when used normally.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sun May 11, 2008 8:10 pm

I used mysql queries only because it was easy and quick to write :wink: . I just wanted to have something to experiment on.

There is no need for a unregister.php file since register.php called with stupid parameters will remove the server from the list (currently TA3D sends a request telling there is 0 player slots available, which is enough to remove it from the list).

I'll rewrite those scripts and add some statistics code :)
=>;-D Penguin Powered

User avatar
AF
Administrateur - Site Admin
Posts: 139
Joined: Thu Dec 28, 2006 8:19 pm
Location: NW UK
Contact:

Post by AF » Sun May 11, 2008 8:12 pm

Its just if I close my server 10 seconds after registering itll still show up for 290 seconds afterwards during which players might try to join and fail.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sun May 11, 2008 8:14 pm

I reduced the timeout to 160 sec in the uploaded versions of the scripts. And TA3D tells the server it's not available any more when leave the battle room screen (works if you start the game or just exit), but of course it doesn't work if server crashes :(
=>;-D Penguin Powered

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sun May 11, 2008 11:01 pm

ok, I've rewritten the scripts to use 2 files instead of mysql. There is no locking mechanism so I don't know how it'll behave under heavy load (if it has to respond to 2 requests at the same time).
=>;-D Penguin Powered

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests