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

Talk about making games.

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

Postby yttermayn » Mon Apr 05, 2010 1:47 pm

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?
yttermayn
 
Posts: 48
Joined: Sun Nov 25, 2007 4:10 pm
Score: 2 Give a positive score

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

Postby Hblade » Mon Apr 05, 2010 2:24 pm

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.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron