Multi Worlds

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
PKDemon
Posts: 91
Joined: Tue Nov 15, 2011 5:51 pm

Multi Worlds

Post 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
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Multi Worlds

Post 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.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Multi Worlds

Post 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.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Multi Worlds

Post 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.
The indelible lord of tl;dr
PKDemon
Posts: 91
Joined: Tue Nov 15, 2011 5:51 pm

Re: Multi Worlds

Post by PKDemon »

that sounds a little hard for someone that is new haha
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Multi Worlds

Post 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.
The indelible lord of tl;dr
Post Reply

Return to “Beginner Help and Support”