Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Consistency Across Sessions
05-05-2013, 04:04 PM #1
- Join Date
- May 2013
- Thanked 0 Times in 0 Posts
Consistency Across Sessions
I am making a text based browser rpg and I've stumbled into a bit of a problem and am not sure how to proceed. How do you keep consistency across multiple instances of the game running at the same time?? For example....
Say a user is playing the game in one window. He/She is presented with the hyperlink "Open Blue Door" which will load a new screen of the game. Say the user opens that link in a new window. There will now be two instances of the game running, and it would be possible to play the game along one storyline in one window and play the game along another completely seperate storyline in the other window. In other words, there would be two instances of the game running at the same time and they would be inconsistent.
Or another example is if a user is in the middle of a game, opens a new window, goes to the website and hits play, it should go directly to where the user is in the other window and not start a new game.
I apologise if this is a noob question and thank you for your time in advance.
05-05-2013, 04:27 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,650 Times in 2,619 Posts
I would assume that this isn't multiple "instances" (since HTTP is stateless) so much as there's no mechanism in place to determine if a movement is valid and it uses an assumption that it was a valid movement.
You need to track where they are currently, and when an attempt to move into a new cell is performed, you need to verify that the attempt to change cell is valid from their current location. That way if they go back to a previous window, it will instead present them with an error.
Unless you've created session arrays with unique offsets within them, there isn't a synchronization issue between windows or tabs. The problem is the underlying code that doesn't stop the user from jumping over cells based on knowing how to change the coordinates.
Of course, even fixing up the session control issue won't fix the problem with multiple browsers. So ultimately you'll be controlling positioning from within a persisting storage instead.PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');