Page 1 of 1

What's the best way to save in this circumstance?

PostPosted: Mon Apr 05, 2010 1:47 pm
by yttermayn
I've got a procedurally generated galaxy, where each star or object is an actor. There are 1000 stars/objects in the galaxy. As the player plays and makes changes to the stars and their planets, etc., what is a good way to save those changes in a savegame? Keep in mind that each star could have any number of objects in orbit, and each planet could have stuff on it that gets changed. Is there a way to have actors only save if certain values are changed? Or do I just have all planets and actors save their values every time?

Re: What's the best way to save in this circumstance?

PostPosted: Mon Apr 05, 2010 2:24 pm
by Hblade
My guess would be to make an array, then save it. Each number of the array is the cloneindex of the star / actor.

Image
Make 3 new avriables, each of them arrays. The 1000 is the number of stars you have in the game, You could make this 9999 if you want to.

The 3 variables should be named
    starx
    stary
    staranim
The staranim variable represents the animation of the actor. Using this, you could save the planets as well. Or if one star is bigger then the other you could use this method to reover it's lost animation.
Example:
Draw actor - Star / actor
Code: Select all
+-=-=-=-=-=-=-=When a load variable is set to 0-=-=-=-=-=-=+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==+

starx[cloneindex] = x;
stary[cloneindex] = y;
staranim[cloneindex] = animindex;

+-=-=-=-=-=-=-=When a load variable is set to 1-=-=-=-=-=-=+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==+

x = starx[cloneindex];
y = stary[cloneindex];
ChangeAnimation(staranim), etc...


That should work :D Unless each star / actor is a different actor all together, and not cloned actors.