Archived

This topic is now archived and is closed to further replies.

ed091maf

Storing level data

Recommended Posts

well this is quite simple,
make three base classes TUnit TTile and TBullet, now derive all Units from TUnit etc...
if you use a linked list for the units, you save them like this

TUnitfleet::save(char*filename)
{
ofstream data(filename,ios::binary)
TUnit *P=items
TUnit hulp;
while (P!=NULL)
{
hulp.X=P->X;
hulp.Y=P->Y;
//etc.


data.write((char*) &hulp,sizeof(hulp));
P=P->NEXT;
}
}

load is vice verca !
you do the same for tiles and bullets

if you don't succeed, Email me. I'll sent you the code of my save/load routine

happy coding

Aries...

------------------
Programming is an art

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

Check out Wotsit's file format site:

http://www.wotsit.org/

Look under the game format section, and get the files listed
under C&C and warcraft, if you into those kind of games. They
contain very detailed listings describing how they save their
map data and level data.

Some interesting stuff.

Cronus

Share this post


Link to post
Share on other sites
I am developing RTS tilebased game. Now i'd like to ask some people that have already done such kind of games, what is one of the most efficient ways of storing data of your level? Are there any references in the internet?


Share this post


Link to post
Share on other sites