[Tutor] Saving Progress

Dave Angel davea at davea.name
Thu Jul 4 09:25:44 CEST 2013


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.


-- 
DaveA



More information about the Tutor mailing list