Game Development Community

Calling unpackUpdate on server

by Dan Keller · in Torque Game Engine · 04/25/2008 (7:08 pm) · 4 replies

I'm trying to figure out the easiest way to implement a save/load system for torque. I was thinking of using something like the demo recording system, where the info sent over the network is dumped to a file. The only difference is that it would run on the server. So is it a good idea to call unpackUpdate and such on the server?

#1
04/25/2008 (7:19 pm)
Why would you want to do that? You would save alot of useless state information that gets out of date as soon as the next tick happens. Just iterate trough the mission file and save out anything you need?

As for your question, the correct function would be packUpdate, not unpackUpdate. It *reads* updates, you need to write it somewhere. Call packUpdate with a BitStream that you save onto your disk. Why you would want to is beyond me, but hey :)
#2
04/26/2008 (11:33 am)
That state information is exactly what I'm trying to save, ie, all the information to reload the dynamic objects that aren't in the mission file.

And maybe I wasn't clear about my question, I would use unpackUpdate to load the game after saving it with packupdate.
#3
04/26/2008 (11:49 am)
Another option is to write your extra-mission objects (meaning objects outside the mission) into a separate mission-type file, and then load that in when you like.

eg,
make a SimGroup called dynamicObjectsGroup,
put all your dynamic objects into that,
then call dynamicObjectsGroup.save(%file),
and for loading, clear the group and then exec the file.
#4
04/26/2008 (11:50 am)
.. note i haven't actually tried that for what you have in mind, so i should maybe call it an "approach" rather than an "option". this is pretty much exactly the approach used when you cut-and-paste objects in the mission editor.