Saving and loading

Published October 23, 2008
Advertisement
ILBM
A few weeks ago my brother told me of the image format IFF/ILBM. I knew about the file format since we both had been programming on Amiga in the past but it was a long time ago and I had totally forgot about how the file format worked. It is an 8 bit image format which is quite unique. Firstly you can save standard 2-4-8 bit images with color mask and color cycling. It can also save image animations and multi colored brushes. It is also possible to save things that are not directly connected to the image, like palette information, as IFF.

One file system
And this is where it becomes interesting for me. Up until now I have had two file types, one for the all the map data (objects, lights, actors, zones etc.) and another file for storing the resource palette. Why not just use one file system and pick out the stuff I want from the file, sort of like the IFF format. I had already done some of the work. When saving I just determine what types of data I which to save and when loading I do the same. In the header of the file I tell how many resources there are of each type, what the map contains... I always liked one file better than two. Map loading and saving will become a little bit more complicated but nothing that can't be sorted out.

Another reason I got into this is because I found out I was writing much duplicate code. A save function for the map file, another for the resource object file, another for the actors and yet another save file that contained the sound palette. What a waste of project space!

When I have completed this there might actually be an alpha demo to try out [smile]
Previous Entry Small game follow up
Next Entry Video :-)
0 likes 3 comments

Comments

elendhil
Hello! Your engine 3D isometric game with his editor are free ?

Would you distribute the sources of your software ?

October 27, 2008 01:25 PM
elendhil
Hello! Your engine 3D isometric game with his editor are free ?

Would you distribute the sources of your software ?

October 27, 2008 01:25 PM
evillive2
Have you considered using SQLite for saving/loading non image data?

It doesn't add any dll overhead (use the amalgamation) and is public domain so no licensing issues.

I have been doing this for a while and it really saves me a ton of hassle with reading/writing flat files. The main reason I like it is because as a database I can query it for things using standard SQL like how many maps do I have, what maps are in version x, change all instance names of nnn to uuu (saved my butt quite a few times).

Using it is quite easy although admittedly I was over complicating it a lot in the beginning because I didn't realize how much of my flat files were markers to help me parse them.

Alternately, you could also save your images/maps as BLOBs inside the database so everything is in one file but I have avoided this only because I chose a database to avoid proprietary binary map files etc.
December 19, 2008 04:15 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement