Ex52 - The Gothon web game

Hi,

This is to share my solution for ex52. I have made a couple things to solve what has been asked, advised, prescribed by Zed. Not all of them though.
I think my ‘xml’ description file is in the center piece of my solution.
This is a multi-game solution. You can define as many games as you like by adding its story to the xml as a new game. You have the follow the same pattern I used for the Gothon game. There are a few constrains like this should be similar to Zed’s original game with rooms and paths between them. There are hints, the games are saved, users could login and out, continue their original games etc.
I have added an admin who can recreate the initial data, check users or have a sneak peak of randomly generated values for laser weapon armory or escape pod.
Heroku gave me some grief. Cookies don’t work as I expected. It runs perfectly locally but when running on heroku it looks as cookie info is just not always going through. If I keep pressing ‘Refresh’ it eventually kicks in. No idea why. I would love to hear your opinion or feedback on my code.

Please find the code here:

Where is the game hosted? URL?

https://the-gothon-game.herokuapp.com

Nice! Getting into XML I see. That’s pretty advanced for the book. I’m not exactly sure what’s wrong with your sessions, but look at the docs:

https://flask.palletsprojects.com/en/1.1.x/api/#session-interface

And you see the option for pickle_based? You might need to configure your session to use that option, as I think the default is just to store it in memory. What that does is when heroku restarts your app or you redeploy or just randomly you might lose all of the sessions, but storing it to disk would fix that.

You might also be able to remove your own pickle code if that worked, since then you could store everything in the sessions.

Basically I think you’ve got some missing session configuration that tells Flask to store it to the disk.