Putting gamedir into save game files?

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Putting gamedir into save game files?

Post by Baker »

I want to put the gamedir into save game files *AND* have it degrade gracefully in non-supporting clients back to standard Quake.

Not stuff that breaks other engines, needs regular Quake just to ignore it.

Any thoughts on the least EVIL way to do this? I don't want it to print warnings to the console of non-supporting clients either.

[I don't like the idea of save games not knowing what they are. I can think of 2 ways to pull this off, but at the moment I'm not liking either of them (repeat fields multiple times with different information for the engine to scrub out is one --- a non-supporting engine would set the field multiple times, but last value would be the real on --- the other idea involves the save game comment. -- first one seems really hacky, second one is kind of "okayish" but want to collect thoughts and see if there is a "best way"]
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Putting gamedir into save game files?

Post by mankrip »

Any extra information in the savegames should be encoded as an entity comment in the world entity. Entity comments are ignored by the engine, but the engine can be programmed to use data from some of those comments.

That's how the serverflags fix was implemented in the latest versions of Makaqu.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Putting gamedir into save game files?

Post by Baker »

This is the worldspawn segment of the save game file, I'm not sure what you are suggesting?

But it sounds promising.

Code: Select all

{
"modelindex" "1.000000"
"movetype" "7.000000"
"solid" "4.000000"
"classname" "worldspawn"
"model" "maps/start.bsp"
"message" "Introduction"
"sounds" "4.000000"
"wad" "gfx/start.wad"
}
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Putting gamedir into save game files?

Post by Spike »

is it not safe to assume that the gamedir the saved game is stored in is the gamedir that should be used to reload the saved game? I'm not sure why you'd need to add anything at all.
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: Putting gamedir into save game files?

Post by leileilol »

if i did this in my uneccessarily anal way i'd just stick the progs.dat crc appended to the save file name and get the engine to load that automatically appended.


but if I do that, someone will bitch on the debian mailing list that it's not secure enough and should be a progs.dat sha-1 hash save file name
i should not be here
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Putting gamedir into save game files?

Post by Spike »

stick the entire progs.dat in there, that way it'll not bug out between versions.
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Putting gamedir into save game files?

Post by r00k »

could it not be simple enough to save games to the gamedir and then load saved games from the gamedir?
original saved files for quake in id1 mods have their saved games in their dirs?

i havent looked at the code i just assumed it wasnt hard coded for saved games to always be in id1

wait just reread the thread i think spike said the same thing i just did
since for example each player might have a different name for one mod as apposed to
another player. so saving a foldername in the saved file might later not work if they reinstalled the mod
and used a different foldername. but just tossing a saved game know to be from
intheshadows would work for 'its' if thats the -gamedir name to load from

blah typing on my phone hope this
makes sense
mankrip
Posts: 924
Joined: Fri Jul 04, 2008 3:02 am

Re: Putting gamedir into save game files?

Post by mankrip »

I do agree that it seems unnecessary, but Baker didn't exactly say what he wants to use this for. And anyway, it's something fun to code...
Baker wrote:This is the worldspawn segment of the save game file, I'm not sure what you are suggesting?
Search for "serverflags" in the Makaqu source code.
Ph'nglui mglw'nafh mankrip Hell's end wgah'nagl fhtagn.
==-=-=-=-=-=-=-=-=-=-==
Dev blog / Twitter / YouTube
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Putting gamedir into save game files?

Post by frag.machine »

Save a dummy entity in the end of the savegame (let's say, "classname" = "_progsinfo") containing all info you want to store, like the progs.dat CRC or the gamedir name.
Vanilla engines will just parse and spawn a harmless entity with virtually no consequences to gameplay, yours will use the mentioned fields and silently discard the entity.
If you're really paranoid about an inoffensive errant entity wandering in the engine guts, add a "nextthink"="SUB_Remove" so it is almost immediately reclaimed in vanilla engines.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Post Reply