Sign in to follow this  

Multiplayer game dilemma

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So we have multiplayer capabilities in our RPG, so far it has been restricted to LAN games, for no other reason than I haven't come up with a good method for clients to "find" servers that are running over the internet. The problem is that I am unable to establish an outside connection with any one of my 3 hosts I have webspace with. Pretty much no hosts it seems allow outside connections with their databases. This is understandable, however I'm unable to think of an alternative. The general idea is that whenever someone started a server the server would add itself to the mysql database on the "master server" which was nothing more than a central repository for collecting info about the currently running servers. When clients run the game they would query the master server for a list of running servers, and from there get the connection string from them to pass to the networking system to connect to the servers. Does anyone have any alternative ideas about how I can get a list of servers from some static central area to the clients? I could host a mysql database from my personal computer at home with outside connections enabled but I'd like to avoid this if possible, primarily because my computer isn't up all the time. Thanks, Jeremy

Share this post


Link to post
Share on other sites
Might work (?) : Post a perl or php front end to the database and query the script via a basic http request. I was planning to do that for my former project but i never got that far. If you do it like this, only the script has access to the database contents and you can put the script on any computer, including a hosted shared account.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What I did was uploaded a .txt file to my webspace, the .txt file held configuration info for the online game server (eg. server IP and port number, name of server, etc.), TEXT files can be downloaded using HTTP protocal over port 80 by your client program, and then renamed to .ini and read as INI files or u can create a custom configuration parser.

This will work best, as the webspace server will simply assume your client application is a web-browser asking for a text page.

Share this post


Link to post
Share on other sites
The problem with that is that there isn't just one server, there can potentially be any number of them. Think about a first person shooter game, where the client pulls a list of active servers from a master server, that's the type of thing I need to do. Servers should tell a master server about themselves, possibly updating their info at timed intervals, and the client should be able to retrieve that list from the master server and join any one of them.

Edit: anyone know of any functions capable of performing http requests that would be compatible with a php file on the server side that could be used to post or retrieve information from the database? Preferably something non-platform specific, however let me know of any that are as well please.

Share this post


Link to post
Share on other sites
You might want to send the data through the POST method and use PHP to access a mySQL database. The clients could connect to another PHP script that spits out the list of servers and relevant information.

-Sam

Share this post


Link to post
Share on other sites
I did what you are talking about using a couple of PHP pages. Hosts ping host.php every once in a while and clients check list_games.php to get a list of all the available servers. Of course it gets more complicated. I use PHP's sockets to connect to hosts when they ping to make sure they are not behind a firewall/router, etc.

Share this post


Link to post
Share on other sites

This topic is 4860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this