Coder Social home page Coder Social logo

hololb / mind Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 45.78 MB

GUI-based adventure game in Flask and Jinja with auto-save

Home Page: https://mind.lucasbubner.repl.co

Python 14.71% JavaScript 1.63% CSS 1.81% Jinja 81.85%
python adventure autosave flask game gui text-game

mind's Introduction

MIND OF CEO, LUCAS BUBNER 2022

Mind is no longer being hosted due to Replit hosting changes.

DESCRIPTION

'Mind of CEO' is a Flask application which is a text-based adventure game. This game is based on player input with selection boxes which will influence the next event that is displayed. There are over 65 endings to the game, with all different and unique narrations and events caused by reaching these endings. The purpose of this project is to provide entertainment as a game. Players can choose between a variety of options given a cirumstance, which will affect what options they are able to make in the future (for example, if a player had consumed an item, the option to consume it later doesn't show as an option). The story is based on a CEO, and is from a perspective of a name that the player enters at the beginning. This perspective is also the username and personal experience systems implemented in this project. After users return and provide a successful login, they are able to see an endings page where they can view the endings they've unlocked, while also being able to have more administrative action over their accounts such as delete, and seeing their savefile information. There are no reset/change password options, as this would need another verification method such as email in order to be effective. For the scope of this project, a change password option may cause security issues to some, and as such may be an ineffective idea.

DESIGN CHOICES

In this project, I have decided to use an auto-save system with utilisation of the Python libraries Flask and Pickle. Savedata will automatically be saved to a file on a server filesystem, which will hold data for a certain player. This allows for people to come back at another time and attempt to reach more endings. Originally, this system was not password protected, but I realise this is not a great choice as people with conflicting names will have duplicate savefiles and can end up overriding each others saves. To combat this, all users have an Argon2 hashed password stored in an SQL database attached to their username, which is not for security of savefiles but for claiming a username. A design problem that I recently encountered with this project is that user data would only load onto the one thread, and therefore this meant that if one person logged out, all users would log out. This would prove security and usability issues, and I have used a Flask session in order to combat this. This solution proves effective for this project, and has also utilised the pickle 'loads' and 'dumps' methods to serialise and deserialse the User save class.

OPTIMISATIONS

With such a big project, certain optimisations are required in order to keep the code as little repetitive as possible. I have used the Jinja rendering and templating system to combat this, where I have used a grand template followed by the custom additions in each HTML page. Using Flask routes, these were able to be easily programmed in, and able to follow logic through the User class system. I have also tried to introduce security and information safety in this project, by checking each request for a valid savefile and username. If either of these do not exist, then they will be redirected to the login screen. In addition, there are a few safety features in place for usernames, ones that involve not being able to manipulate file structures and also one to check if their username is within the 16 character limit I've imposed.

FILES

app.py: Grand file which controls all the program operations, including app functions, app routes, and interfacing with the auth.db database
templates/: Contains all the Flask templates and HTML files for rendering
static/: Contains all assets including CSS files, JavaScript scripts to help the front-end work, and all images
savefiles/: Filesystem storage for all savefiles that are created and used during the game
auth.db: An SQL database that holds all the data for usernames and passwords, which is seperated from the savefiles. Passwords are hashed with argon2 and username salting.

mind's People

Contributors

bubner avatar lachlanpaul avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.