simGroup, MissionGroup, MissionCleanup and .save - help!
by John Stamets · in Torque Game Engine · 12/31/2001 (8:27 pm) · 2 replies
I am attempting to save a game (single player) and Dark suggested saving the MissionCleanup simGroup instead of the MissionGroup. This seems to make sense, however I am still a neophyte at this, so I am still hitting walls with regularity. Hey at least I figured out animations without posting :\
What I know so far:
MissionGroup is derived from simGroup in the mission files (.mis). In the editor .gui script the mission is saved using a save method on the MissionGroup object(MissionGroup.save)
This seems fairly straightforward, however I was trying to figure out how/what the save method actually did and whether it was a part of simGroup- IOW, can MissionCleanup use it as well... Unfortunately, there seems to be no declaration for a save method in code, nor can I seem to locate an added save method in script (not that it isn't there- I just can't find it), so I can't really learn from the code. Any clues? There is a write method in the class, but seems to be a virtual function (it isn't the same anyway)...
The other question is where is MissionCleanup instantiated? I can only find references to this object already in use (no "new simGroup(MissionCleanup)").
The final question (really exposing my ignorance): Where can I find more info on how these objects are used? If I understand correctly, the MissionGroup contains all of the objects and data in the map as it starts (object location, etc), and the MissionCleanup contains the objects and data that have actually been instantiated that need to be released? Does it also contain their current data (locations, velocity, etc)? Not real clear on these objects or what they do...
The most challenging part of this is just figuring out what the "middle ground" is- what the objects in the scripts are that inherit from the classes and where the scripts pick up where the code leaves off... Heh, I guess getting animations and maps into the engine was the easy part...
I'll shut up now...
Thanks,
John
What I know so far:
MissionGroup is derived from simGroup in the mission files (.mis). In the editor .gui script the mission is saved using a save method on the MissionGroup object(MissionGroup.save)
This seems fairly straightforward, however I was trying to figure out how/what the save method actually did and whether it was a part of simGroup- IOW, can MissionCleanup use it as well... Unfortunately, there seems to be no declaration for a save method in code, nor can I seem to locate an added save method in script (not that it isn't there- I just can't find it), so I can't really learn from the code. Any clues? There is a write method in the class, but seems to be a virtual function (it isn't the same anyway)...
The other question is where is MissionCleanup instantiated? I can only find references to this object already in use (no "new simGroup(MissionCleanup)").
The final question (really exposing my ignorance): Where can I find more info on how these objects are used? If I understand correctly, the MissionGroup contains all of the objects and data in the map as it starts (object location, etc), and the MissionCleanup contains the objects and data that have actually been instantiated that need to be released? Does it also contain their current data (locations, velocity, etc)? Not real clear on these objects or what they do...
The most challenging part of this is just figuring out what the "middle ground" is- what the objects in the scripts are that inherit from the classes and where the scripts pick up where the code leaves off... Heh, I guess getting animations and maps into the engine was the easy part...
I'll shut up now...
Thanks,
John
#2
02/19/2004 (2:11 am)
Under normal circumstances the map when loaded will be loaded into the MISSIONGROUP and ALL objects that get added to the mission are added to the MISSIONCLEANUP group and are therefore deleted when the mission ends. If you have a specific need to carry over objects from one mission to the next, you'll have to make a new group to contain them and make sure they do not get added to the mission cleanup group. Even if defined globally as in $KeepPlayer = spawnPlayer("Me", spawnhere); it will still be deleted when the Cleanup group is deleted unless it is NOT added to the cleanup group. Any objectID that makes it into cleanup will be purged.
Torque Owner Lasse Wallentin
I know this is an old post but I find the questions very interesting and very unanswered :D
I am experiencing some troubles when reloading a mission because some objects are removed during cleanup. And I do not understand why. So I really need some information about the MissionCleanup handling.
The following is called from endMission (common/server/missionload.cs) is called
MissionGroup.delete();
MissionCleanup.delete();
$ServerGroup.delete();
But which objects end up in these groups?
Is it based on the time of creation, scope of creation or should the objects be added explicitly?
My problem is:
A trigger function (onEnterTrigger) results in an object being created and added to a global array.
When the mission ends the object is destroyed even though it is referenced globally!!!?
Can anyone please explain this to me?
/Lasse