Page 1 of 1
Multi Worlds
Posted: Wed Nov 30, 2011 8:33 pm
by PKDemon
how would you be able to put like multi worlds into your game so like you can put a limit on like how many people can be on one world and be able to select another one to play on
Re: Multi Worlds
Posted: Wed Nov 30, 2011 9:19 pm
by Jackolantern
You would just need to have one set of game scripts, but make 2 separate databases. Maybe something like "gamename1" and "gamename2". When someone signs up, do a count query to see how many people are on each "server" to see which one you want to put them in. Since the "world" of the game is determined by the database and the data it pulls out of it, it will be like they are on isolated servers.
If you really wanted to get fancy, you could enhance the registration script to allow players to choose their "server" and even expand the number of servers as needed for population growth. After getting the counts of how many players are in each database, if each of them are nearly full and you want to make a new server, you could run SQL statements from within PHP to create an entire new iteration of the database and make it available. You would just have to keep a separate database to keep track of how many databases you have created, so you can either choose where to put a player or give them the chance to choose. You can also use this database to keep track of how many players have registered on each server and how active they are to help keep up with when to create new servers. In the realm of traditional online games, this would be part of your authentication server.
Re: Multi Worlds
Posted: Thu Dec 01, 2011 8:57 pm
by hallsofvallhalla
yep you could have the account DB a separate DB from the worlds so when they log in they choose the player which then sets the DB variables for what server to use.
Re: Multi Worlds
Posted: Thu Dec 01, 2011 10:45 pm
by Jackolantern
hallsofvallhalla wrote:yep you could have the account DB a separate DB from the worlds so when they log in they choose the player which then sets the DB variables for what server to use.
Ahh, yes, that would have to be part of it, too, so you save a way for your scripts to know who is in what database.
Re: Multi Worlds
Posted: Fri Dec 02, 2011 12:43 am
by PKDemon
that sounds a little hard for someone that is new haha
Re: Multi Worlds
Posted: Fri Dec 02, 2011 12:53 am
by Jackolantern
Yes, this is not super-simple. It isn't extremely hard, either, though. You could try to work on it, and we can help if you get into any problems. Otherwise, just work on writing some more scripts and you will understand pretty quickly how to do it.
One thing to keep in mind with this plan, though, is that unless your game design revolves around having very small amounts of people clustered on isolated game "servers" (for example, you only want 12 people per server), I wouldn't worry about this. Many indie games start out very small, with only a handful of people for quite a while. If you are wanting to do this just to give it more of a commercial MMORPG feel, I would skip it for now and for the foreseeable future. It may be months after your game goes live before the system would even spawn a second server. Plus, since many players only log in once, you would have to be careful not to spawn too many servers too soon, or you would basically be jailing the few players who stick around to their own single-player servers.