[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] ideas for saving points in games



On 9/25/07, Ethan Glasser-Camp <glasse@xxxxxxxxxx> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> kschnee@xxxxxxxxxx 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 much
> prefer YAML. It's clear, it's human-readable, it's recursive and so
> very powerful, and the code to parse it is there already. The only
> annoying part is that tuples get stored in a funky way, with strings
> like "!!python/tuple". Converting to lists works but is kind of
> annoying. Of course, it's just a cosmetic feature, so whatever.

Thanks for mentioning this! It is PERFECT for my OHRRPGCE
binary<->textual data convertor! Until now I'd been struggling to make
a suitably simple and intuitive language to represent the data in
textual form.

> the general case. I've been a little leery of implementing save states
> in my game for just this reason, but it's probably doable with enough
> work.

mmgr.. shouldn't this be straightforward at the point when you can
save? Presumably none of the level code is running at that point, so
if you save all globals from the level 'module' that are not
functions.. (you need to avoid using closures, too -- IMO that's
fairly easy. In this situation global variables are actually a win. At
the risk of storing too much information, you can probably get access
to variables local to closures too, if preferred.)