Re: [pygame] ideas for saving points in games

2007-09-24 Thread David Gowers
On 9/25/07, Ethan Glasser-Camp <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > [EMAIL PROTECTED] wrote: > > If you want to store a dictionary, a quick way to do that is to use text, > > writing a key:value pair to each line and ignoring lines that start with > > "#"

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Ethan Glasser-Camp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [EMAIL PROTECTED] wrote: > If you want to store a dictionary, a quick way to do that is to use text, > writing a key:value pair to each line and ignoring lines that start with > "#". If we're just talking about our favorite serialization format, I muc

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Aaron Maupin
[EMAIL PROTECTED] wrote: I find that in at least some cases, pickling is hideously inefficient, taking on the order of 10 times as much space as a different format. In my case I knew the resulting file would be quite small (3K at the max), and even then I zipped it anyway. (Not for any reaso

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Dave LeCompte (really)
[EMAIL PROTECTED] wrote: > I find that in at least some cases, pickling is hideously inefficient, > taking on the order of 10 times as much space as a different format. On the flip side, I find it enormously efficient, taking 1/10 the time to implement as some other formats. So it's a question of

Re: [pygame] ideas for saving points in games

2007-09-24 Thread kschnee
On Tue, September 25, 2007 12:05 am, Aaron Maupin wrote: > I used a dictionary as a container for saved game values and pickled the > dictionary. Maybe not the best way but it worked like a charm. I find that in at least some cases, pickling is hideously inefficient, taking on the order of 10 tim

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Luke Paireepinart
Eric Hunter wrote: i found information on it but now I'm getting a TypeError Please include your errors with your code in the future. We can generally tell what's going wrong just from comparing the traceback with the code. That way, we don't have to copy-paste the code into an editor and run i

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Aaron Maupin
Greg Ewing wrote: Pickling can be very convenient, but it ties your file format very closely to internal details of your program. Restructuring your program in any way is likely to render your existing pickled files useless. I used a dictionary as a container for saved game values and pickled

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Greg Ewing
Ian Mallett wrote: On 9/23/07, Aaron Maupin <[EMAIL PROTECTED]> wrote: Eric Hunter wrote: You could just pickle the list. That's essentially what I used for pickle? I've always used .txt files. Pickling can be very convenient, but it ties your file format very closely to internal details o

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Eric Hunter
i found information on it but now I'm getting a TypeError if event.key == K_s: out_file = open('test.txt', 'w') objRect = rect() pickle.dump(objRect, out_file) On 9/24/07, David <[EMAIL PROTECTED]> wrote: > > > Pickle is one of Python's serializing

Re: [pygame] ideas for saving points in games

2007-09-24 Thread David
Pickle is one of Python's serializing modules. http://docs.python.org/lib/module-pickle.html It can save and restore data, code, classes, etc... David On 9/24/07, Eric Hunter <[EMAIL PROTECTED]> wrote: > > yeah. that's what I was thinking using a .txt file. what's pickle? > > On 9/24/07, Ian M

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Eric Hunter
yeah. that's what I was thinking using a .txt file. what's pickle? On 9/24/07, Ian Mallett <[EMAIL PROTECTED]> wrote: > > On 9/23/07, Aaron Maupin <[EMAIL PROTECTED]> wrote: > > Eric Hunter wrote: > > You could just pickle the list. That's essentially what I used for > pickle? > I've always used

Re: [pygame] ideas for saving points in games

2007-09-24 Thread Ian Mallett
On 9/23/07, Aaron Maupin <[EMAIL PROTECTED]> wrote: > Eric Hunter wrote: > You could just pickle the list. That's essentially what I used for pickle? I've always used .txt files.

Re: [pygame] ideas for saving points in games

2007-09-23 Thread Aaron Maupin
Eric Hunter wrote: say I have all the attributes for a character's progress I want to save in a list and thinking that just saving it to a .txt-type file in plain text then loading it up would sound the easiest. You could just pickle the list. That's essentially what I used for Natto-Cat.

[pygame] ideas for saving points in games

2007-09-23 Thread Eric Hunter
so a random question, what is the best way to go about making a save point of progress in a game? say I have all the attributes for a character's progress I want to save in a list and thinking that just saving it to a .txt-type file in plain text then loading it up would sound the easiest. What's