Probably Dance

I can program and like games

Month: June, 2011

Storing information in a .png

Spore did a neat thing where they stored the creature information in a .png file that was a picture taken of the creature. So to share the creature you had to share the image, which is pretty cool. And it turns out that it’s really easy to do. Well if you are already using libpng that is.

I implemented it for the game Leshy, but we only used the feature for the auto save functionality of the editor, because the game didn’t have loading and saving. (simply because it would have been too much effort to program a menu that allows you to load and save)

Autosave file for Leshy editor

Auto save file for the Leshy editor. This is the actual save file. I could load the level from this image.

Read the rest of this entry »

My “Way Too Generic Serializer”

I wrote a serializer for my engine that is extremely convenient and generic.

A piece of serialization code in the engine looks something like this:

class PlaceMode

    // ...

        if (version < 1) SERIALIZE_BASE(State);
        else             SERIALIZE_BASE(EditorState);

    std::vector<std::string> archetypeNames;
    Vector4 lastPosition;

Read the rest of this entry »