Game Development Community

Save System in TGB?

by Anthony Fazio · in Torque Game Builder · 04/24/2007 (1:30 am) · 3 replies

I did a search and couldn't find this question so I thought I'd ask. I was wondering, would it be possible to have a save system like Super Metroid or Castlevania SOTN with different save points throughout the level? I'm sure it's possible to implement it but how would one go about doing it? Thanks for whoever's help, I appreciate your more advanced knowledge of TGB.

#1
04/24/2007 (9:01 am)
Anthony ... depending on what you want to save ... you could just call the .save() method from any SimObject, which will write it out to disk as a TorqueScript file ...

For example:

new SimSet(PlayerInventory)
{
  LeftHand = "sword";
  Back = "axe";
  RightHand = "sheild";
};

new ScriptObject(PlayerData)
{
  lastSavePoint = 22;
  Score = 23232;
  Health = 67;
  Inventory = PlayerInventory;
  Name = "MoZ";
};

// save our players current status
PlayerData.save("savegame");

// load our players current status
exec("savegame");

You'd of course, have to have code that was able to understand your save points, etc ... but, for the most part, this would do the trick ... you could even use this to keep track of any State Machines you might have, by storing all the objects that use the state machine in a SimSet, then writing the simset out... so when you load the simset back from disk, your states are the way they were when you wrote them to disk ... allowing you to keep track of where your NPC's where and what they were 'thinking' at the time ...

#2
04/24/2007 (9:27 am)
You do in fact rock, thanks
#3
04/24/2007 (10:40 am)
Heh -- your welcome