Join the forums now, and start posting to receive access to our Scripts Vault!
I want to allow multiple logins on my game, but I want it to be built into the game. That is, it shouldn't involve the user making separate browser sessions on their own. Players will have a main login which will bring them to a character select screen (think WoW character select). From there, you can load up multiple characters each into their own browser windows. What would be the easiest way to implement this? You can't get by using just sessions now because you need to be able to distinguish between characters. The only way I can think of is to keep the character info stored in the url and maintain it across pages. For example, selecting character "mychar4" would load mygame.net/play.php?char=mychar4 and all of the links on that page would include char=mychar4 in the url. This could of course be cleaned up using something like mod_rewrite into mygame.net/mychar4/play.php. Any better solutions?
Not that I am trying to change you from your idea, but what exactly would be the reason for allowing multiple char logged in at the same time from one account?
I only ask because that in itself would basically remove the need for multiplayer usage seeing a single user could basically run a "party" all by himsef.
Wouldn't it be better to have more of an "active character" mechanism instead of opening each in a new window by itself?<snip>It might be fun to test your theory out, but I have a very strong feeling that you're building in more complexity than is required and your UI is going to suffer because of it.
You can't protect users against being stupid. If someone gets confused that clicking on a different character selects that character and they will need to re-select their original character to perform an action with it...
You see, in application terms (because a game is an application and not a website)
In your above example, you could implement all of the links on the first page (character Alpha) to go to: {whatever URL}?char=AlphaWhen the user opened a new tab when clicking on character Beta (in a new window / tab) then you've set that character as being active for that view. So, any actions (URLS) in that window would look like: {whatever URL}?char=Beta
However, I was wrong about the bandwidth consumption now that I actually saw a usage scenario. I had thought it more of a Neverwinter Nights style game where all the characters remain in, basically, the same game region and, therefore, there would be no need to re-render the region multiple times. The characters would always need fresh views so that consideration is unimportant.
I would suggest that you dismiss the use of clean urls for this unless you start getting a ton of user requests for this feature. Clean URLs are, mainly for SEO or (in smaller part) for ease of memory on the part of users (say, if they want to issue a specific command via direct entry rather than clicking a link). However, users who are going to prefer to direct-enter the URL probably possess enough intellect to determine how to do so from the current structure. And in the case of games, you really only want search robots to go to specific portions of your site (documentation, home page, etc.) and not really to allow them to try and "play" the game. You probably want to provide them with access to (and come up with a pretty URL scheme) for character or player profiles if you have them, but that would be about as far as a robot would need to go.