Game Development Community

Saving progress in games.

by John Bura · in Torque X 2D · 12/11/2010 (5:12 am) · 5 replies

So I have been prototyping a game with similar architecture to Limbo. I have a lot of functionality in there but there is one thing that I cannot seem to figure out and that is saving progress in a game.

Basically it isn't that hard. The way I plan to do it is have a bunch of bools for checkpoints and items collected.

bool Checkpoint1 = true;
bool Checkpoint2 = false;

bool Secret1 = false;

Now when the game would be loaded it would just simply put the player at the checkpoint
Player.Position = Checkpoint.Position
//Excuse the pseudo-code

This is all pretty easy, however, I have no idea how to store this on the Xbox. How can you

1. Create a new file(new game)
2. Call upon that data(continue game).

Has anybody tried something like this. Im sure its easier than it looks. Also if you guys know a better way of doing this I would love to hear it :).


#1
12/11/2010 (7:05 am)
John you would do this similar to the way you would save high scores, create some sort of data structure that has everything you need, like player level, position etc, and write this data out, again like saving high scores.

When you need to you can load the data and initialize all your stuff to the state saved in your structure.

I hope this helps.
#2
12/11/2010 (12:04 pm)
If you're auto saving at checkpoints you might also want to consider doing the save on a separate hardware thread so the player doesn't notice it too much.
#3
12/11/2010 (1:02 pm)
Duncan I have never even thought of auto saving. The way I plan to do it is simple: when the character enters a blank scene object I trigger on on Enter Event changing the checkpoint bool to true.

Last time I tried something like this I had something like 40 on enter delegates. Im not sure I can find another way to do it. How many is too many delegates?
#4
12/11/2010 (6:29 pm)
40 shouldn't be a problem, especially since they will be so far apart, the collision detection system will barely be looking at the ones which are further away.
#5
12/22/2010 (6:53 pm)
You could also simply create a component that extends T2dTriggerComponent and add an integer (or whatever) property to it. Then all you need is a single delegate that checks the component's property and then determines what to do.