Game Development Community

Saving Games

by Tom Perry · in Torque Game Engine · 06/12/2005 (7:11 am) · 6 replies

Is there a way to save games in torque already or does it have to be implemented. If it does how can you do that? Thanks to anyone that can help.

#1
06/12/2005 (7:37 am)
I would like to know that too ... and loading saved games as well :P thanks from me too!!!
#2
06/12/2005 (8:02 am)
Search the forums. It's been discussed many, many times, with many many solutions, from implementing a backend database to simply serializing specific game states.

Each object has the ability to write to a file, it's simply a matter of stringing together what data you want saved and restored, and doing it at the right points in the right ways.
#3
06/12/2005 (8:06 am)
Hmm I have also been wondering the same but havnt got around to asking yet. Ive heard that it is already capable in T2D and if you do a search they do have some threads that cover it but not in detail. What they say is that you have to save every property of the map, item, inventory, etc data that your game posses at that time. This could be difficult because some games change their surroundings quite often. What I was looking for was a save property that saved yout game after hitting a trigger. Maybe a savepoint, maybe at the end of the mission. Executing this at those points wouldnt be too hard, AKA in the function that covers endinding the mission or when you hit the save trigger it calls a save function/method. The thing that I want to know how and what do I save. It seems that you have to give it certain things to save and it cant really do this by looking at what you have and just automatically saving it. Same with loading as well. Finding out about this would be awesome.
#4
06/12/2005 (9:05 am)
Robert, it's very simple. Zepp gave a description and that's how it works.
If you don't know when to save, then you need to research it and look. It's up to your game and might be very specific.
#5
06/12/2005 (9:18 am)
The process is the nearly the same whether you have a save-point, end-of-mission-trigger, or player-implemented save. You take the data you need to save and you write it to a stream just like in any file i/o application. And not everything is necessary. Take, for example, a RPG like Dragon Warrior I. All of the NPC's are static, so saving their position isn't necessary. Saving game triggers (did you defeat dungeon X?) would be as the checks in their conversation--at least one or two of them--could change potentially based on the game triggers. Saving map position, and world position if you have chunked maps would be necessary if you allow the user to save their game (Ultima VII). If you use save-points (which I find horrible conventions in PC games, but that's a personal preference), all you have to do is save which save point they are utilizing rather than the map coordinates(SMT:Nocturne, for example). If you are doing the mission trigger, you only have to save the pointer to the next mission so you know what they've completed (Devil May Cry 3).

But the process is the same. You don't necessarily need to create a savestate of every object in the game--unless it's something like Civ or Warcraft where you need to track all unit states, etc. And even then, you can pick and choose what you need to save as static elements like trees, while they may have objects you can access and save, don't need to be included.

The how-and-what is something that is specific to your gametype. The problem with engines that implement a one-click solution is that they save a gamestate, which if you have a large number of objects, the save file can grow exponentially. While space isn't the issue, loading and unloading a huge chunk of data into memory can be.

If yo're making a rather static RPG, character stats and event triggers may be all that's necessary. If you have NPC's on timed paths, recording the time would be important for the engine to calculate where they are on the path or when the time is (day/night). If you have NPC's with a complex schedule that changes, saving the time-of-day, day of the week, and other relevant information would be necessary. You don't have to necessarily keep track of each NPC's position for every moment in the entire world (unless they all randomly wander around, in which case your players are going to hate tracking them down unless they are restrained to specific maps and towns...and even then... For action games, the amount of data is even less. Adventure games are as well (basically inventory and trigger lists). For strategy games, you'll probably have created such particular and precise data elements that you'll be able to figure out what's important and what's not.
#6
06/12/2005 (8:18 pm)
I gotcha...thanks alot i actually read the resources a while ago and wasnt sure of what I could do. Now I have reread them and they are alot clearer and pretty simplistic. As you said it all depends on what you think is important to save. For me its just going to be what mission you are on, ammo, weapons, and other misc stuff. Nothing too crazy. After I posted before I noticed that another post was created while I was typing out mine. Ive always had an idea, but now understand that it depends on your game. Thanks guys!