|
Re: Server search?
[Re: khanoftruth]
#113852
02/26/07 04:23
02/26/07 04:23
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
You don't actually "search" the internet for other players. When a user creates a session, you need to have that session store it's info in a database on YOUR own server. Then when a user searches for available sessions, they query the database for hosts (title of session + ping rate + etc). Then they select one, you get the info they need from it (IP address).
xXxGuitar511 - Programmer
|
|
|
Re: Server search?
[Re: khanoftruth]
#113854
02/26/07 14:28
02/26/07 14:28
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
You have to make it...
Check out the MySQL thread in the user contributions... This will allow you to read/write to your database.
xXxGuitar511 - Programmer
|
|
|
Re: Server search?
[Re: Excessus]
#113856
02/26/07 21:14
02/26/07 21:14
|
Joined: Jun 2005
Posts: 130
khanoftruth
OP
Member
|
OP
Member
Joined: Jun 2005
Posts: 130
|
|
|
|
Re: Server search?
[Re: Excessus]
#113857
02/28/07 20:03
02/28/07 20:03
|
Joined: Jun 2005
Posts: 4,875
broozar
Expert
|
Expert
Joined: Jun 2005
Posts: 4,875
|
Quote:
What I did was create a few php scripts that fetch the list of servers (with an optional selection, like only deathmatch games), add a server to the list, remove a server from the list (note that you will also have to put in a timeout for servers that 'forget' to remove themselves from the list.
that's exactly what i am programming atm, same approach (php/GS_HTTP). are you using a flatfile base or MySQL?
i decided for the flatfile system. i hang on 2 points, --->1) how do you create the timeout? i thought about a)just displaying the files whose age is under 2 hours (bad, the server could be on for less time) b)before exiting, sending a "delete entry"-command (bad, what if the game crashes?) --->2)making a file on the server is no problem. retrieving data from a whole buch of files is (disadvantage of flatfile system i guess). sometimes i do not get a response quick enough, and GS_HTTP is showing "".
|
|
|
Re: Server search?
[Re: broozar]
#113858
03/04/07 12:27
03/04/07 12:27
|
Joined: Jan 2004
Posts: 2,013 The Netherlands
Excessus
Expert
|
Expert
Joined: Jan 2004
Posts: 2,013
The Netherlands
|
I used MySQL. A flatfile system should work fine aswell (don't see any disadvantage unless the load becomes very high). I chose to go with MySQL because I knew SQL but not php at that time, so this seemed the easyest. I still think building SQL queries is easyer than "file fidling".
You should store the datetime in a column and remove those rows who where created more than x seconds/minutes ago, where x is either a static number or a setting that the client can be set within some range by the client. There are datetime compare functions in SQL databases, but for your flatfile system I would just use the system time and count seconds/minutes.
The problem is probably WHEN to do this removal. To always get an up to date list, you must remove all outdated rows before retrieval. In your case, you'll have to check all the rows and remove all outdated ones and then return the rest.
If you expect a very high load on this server, a more efficient but less accurate solution is to only remove rows once every x retrievals (use a counter). You can probably also remove outdated rows periodically, without client interaction but I don't know how.
To improve on this system, you could add a php file that removes a certain client at any given time and let the game server (not the central server) call this when it cancels the game. This does raise security concerns (anyone can use this php file, even from a browser, with any parameters) so you might want to add a random password that is decided by the game server when it joins.
You could also add a way to 'report' crashed/disconnected game servers. If you try to connect to a server from the list and it doesn't work, report that to the central server. The central server checks if it indeed can't connected and removes it if it really crashed/disconnected.
Good luck
|
|
|
Re: Server search?
[Re: fastlane69]
#113860
03/04/07 18:53
03/04/07 18:53
|
Joined: Jan 2004
Posts: 2,013 The Netherlands
Excessus
Expert
|
Expert
Joined: Jan 2004
Posts: 2,013
The Netherlands
|
Quote:
Not adding much to the discussion here except to say that if you can, take the time to play with MySql and use it instead of a flatfile system whenever you can... whatever time you spend learning it will pay off in droves in the future in terms of lowered development times and increased performance.
Yes I agree. Learning SQL will be beneficial, especialy if you expect your system to become more complex, or if it must be very fast under heavy load. Also, since MySQL (and I believe some other RDBMSs aswell) are seamlessly integrated with php, it will be a breeze if you know SQL. However, if you don't know SQL yet, you might want to go with flatfiles if you know it will not be under heavy load and you have to get it done quickly.
Quote:
MySql is free, and it's actually easy to setup and use!
While setting up MySQL is indeed extremely easy, optimizing the settings and your queries is quite challenging. If you don't do it right, flatfiles might give better performance (especially when the load isn't very high).
Quote:
The MySql plugin is great (has a small memory leak but nothing major)
Just FYI: The way the system I proposed works is that you retrieve a webpage from within 3DGS. This webpage is dynamically created by a php script that runs on the central server. The page is basically a reflection of the database contents. As you can see, you don't need the MySQL plugin here and using it for this purpose (bypassing the HTTP request and the php script; talking directly to the database) will bring you alot of security issues (this is very different from your project where only the server -hosted by you only- directly talks to the database (or atleast I hope so for you )).
|
|
|
|