🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Storing level data

Started by
2 comments, last by ed091maf 24 years, 8 months ago
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

Programming is an art
Advertisement
ill take a look at that code if you could email it to me...im currently working on loading, saving routines.....thanx in advance
---===xxxx===---
----THE END----
---===xxxx===---
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?


Ernis

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

This topic is closed to new replies.

Advertisement