On Thu, Jul 4, 2013 at 12:25 AM, Dave Angel <da...@davea.name> wrote:
> On 06/27/2013 11:16 AM, Jack Little wrote: > >> Is there a way to save a players progress in a game using python without >> any modules >> >> Jack >> >> > If you organize the game in such a way that a relatively few variables > holds the state, then you can write those variables to a file, and when > restarting the program, load them from the file. > > Naturally you'd want to pick a file location that represents the player's > identity. User name is the obvious, but on many personal (game) computers, > people use one user for many people. In this case, you'd want some form of > login when the game starts each time. > > If the variables you need to save are all ints, floats, and strings, > writing the state-file is pretty easy. > > I'd just like to point out that if the file you write to is human-readable, then it's human-writable too; you probably don't want to have a line that says "NumberOfLivesRemaining=5" or similar. Make it at least a _little_ challenging to cheat. Security-through-obscurity never really works in the end; if your players want to cheat, they'll find a way. But don't make it TOO easy!
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor