PDA

View Full Version : Urgent Design Problem



rajveersangha
05-11-2009, 10:15 AM
Okay here is a design issue I am stuck with:

I have written a Texas Holdem multiplayer server from scratch using Java NIO and JAXB. Its key features are:

1. Allows user to join and play simultaneously in multiple tables, although a limit of 5 tables has been set.
2. Various Login scenarios:
a. The user may have logged in at the main website (socket not established yet)
b. The user may choose to open the Game Lobby without logging in at the main website. In this case he is just given a guestId and not logged in.
c. The user may go ahead and open a Poker Table (still not logged in) and watch a game in progress.
d. If he wants to be a part of that table, he clicks a seat and a login pop-up appears. At the same time the seat is reserved for him so that nobody else can take it. If login is correct and buyIn is within limits, he is seated on that seat.

Now I want to port my application to ES and I am quite confused as to how to implement such a customised user login model on ES4.

I thought about logging in any user as a guest, then as he requests to sit in, I log him out first and then relogin as a registered user.
But this has potential problems:
1. His user variables might be lost.
2. Upon logout, the connection also resets as well (Is this a bug in ES????).

All in all, i am confused and not able to go ahead with ES. Anybody advice me on this. Do I have to change some of my app design?

MikeParks
05-13-2009, 03:13 AM
The way I could see it being done is creating a temporary "guest" account in your database server-side and assigning some sort of identifying mark to the client to be stored as a Flash variable or browser cookie. This ID would carry between the game client and the rest of the site. The account would also be set to expire after a period of time if the player is a guest account. If they so desire to register and become a member, this same account info would be updated to reflect this change and the expiration limit removed from the account.

You could use the same database through whatever server-side scripting you may use and ElectroServer to assure the data stays consistent. Any changes to the user's variables (members or guests) would be recorded so that they persist in the event a change is made to their account (eg. upgrade from guest to member). If the guest account expires, the data should be removed.

These are all just ideas off the top of my head so hopefully that gives you enough to continue on with. As for the connection resetting, I'll answer that in the other thread. However, the ideas I've provided you should at least be enough to work around this issue.