Improving savegames

Discuss programming topics for the various GPL'd game engine sources.
Knightmare
Posts: 63
Joined: Thu Feb 09, 2012 1:55 am

Re: Improving savegames

Post by Knightmare »

Quake2 handles things like the sky, statusbar, etc via configstrings. They're sent from server to client on connecting, and are saved for each level in a hub in a separate .sv2 file. Because fog could be different for each player based on location (trigger_fog in the Lazarus mod), and configstrings are global for all players, I just added a svc_fog servercommand. Fog values from trigger_fog and target_fog are re-sent when a savegame is loaded (as the game module is re-loaded, and the last fog state values are initialized).

This .sv2 file is usually mostly 0's, and became quite large due to KMQ2's extended limits (which meant more configstrings). So I changed the save code to zip it with the corresponding .sav file for each map, making them about 90-95% smaller. Hubs now save faster, because it's not copying a bunch of bloated .sav and .sv2 files from the working folder to the destination save folder.
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Improving savegames

Post by mankrip »

I've updated the first post with a tutorial on how to fix the serverflags issue.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Improving savegames

Post by mankrip »

Something ocurred to me: The savegames should include a list of model filenames in order of their corresponding modelindexes.

When loading entities from the save, the engine should get the filenames not from the list provided by the progs.dat, but from the list stored in the savegame. After the model is loaded, the engine should try to find a matching filename in the list provided by the progs.dat, and update the .modelindex field to match the model's index from the progs.dat. If the model's filename isn't found in the progs.dat, the .modelindex should be updated to a value higher than the last used value.

This solves the problem of wrong models being used when loading saves created with slightly different progs.dat files. And it also allows for all .modelindex fields to be updated for the current version of the progs.dat when re-saving the game, so saves created with this method will also work correctly with that progs.dat in any other engine.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: Improving savegames

Post by leileilol »

r.i.p. ammo box grunts
i should not be here
Post Reply