I'm working on a rather simple 2D game, with a pretty small set of values that will need to be preserved for a user to pick up where they left off last time they played.
Rather than saving/loading the state of the game for users to leave/return, I'm considering something akin to what MegaMan did, where a user enters a "password" to resume from their previous state, like so:
How is something like this generally implemented? My two thoughts were
- Build list of all valid passwords and their corresponding states. Reject anything not on the list, and load the corresponding state when correct input is received.
- Represent the state as a binary string, and make that the password. If the user's input parses validly, assume it to be valid and set it to the state.
What are the concerns with each of these approaches, and is there another way to go about this that I've overlooked?
Note: If this question is tagged poorly, it's because this is my first question on gamedev.stackexchange, and I'm not yet familiar with the ta