Ah, sure. The game is a text adventure that I wrote as a command-line python game (actually, originally it ran via a bot in irc), which is why I wanted to use a python web framework to design the web interface. The gamestate is a jsonpickle of the game engine object heirarchy, and the character is a dictionary (basically grabbed from and saved to the characters sqlite db). I have a separate page for character creation, so I store the character dict in session to transfer from the chargen page to the play page, and then (when the game is initialized/loaded), I also store the gamestate jsonpickle in session so that the game engine modules and command parser can access them.
At the moment, I clear the gamestate and character data session variables in the controllers of pages besides play(), because when I didn't (during my testing), if I created a character, started the game, and then created a new character, the new character acquired the old character's gamestate, which caused several errors. However, when I do that, if one of those other pages is opened in a new tab while the play page is still there, it clears the character data and gamestate, which causes the still-active game to crash. What I want is for the gamestate and character dict to be cleared when the page is closed/navigated away from... though I can still foresee an error if you try to play on two different pages at the same time in the same session. I'm not really sure how to fix this, honestly. On Tuesday, March 17, 2015 at 11:22:21 AM UTC-4, Leonel Câmara wrote: > > Well if the game is in javascript and running on people's browser they > could theoretically do all the cheats they want anyway. > > You could use window.onbeforeunload to delete the data when the user > leaves a page, but that wouldn't help if the user opens another page in a > new tab that deletes your session. > > I think you need to give us more information on what exactly is going on > and what you're trying to achieve. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

