Loading Multiplayer Save Games ...
Moderator: InsideQC Admins
4 posts
• Page 1 of 1
Loading Multiplayer Save Games ...
Now I swear that I've seen some people @ Func_Msgboard like Necros or aguirRe (in the past) talk about actually doing this ...
Yet searches in FitzQuake, Enhanced GLQuake and TyrQuake ... you know, teh mappers engines ... have yielded no such sign of such capability ...
Saving multiplayer save games appears to work fine. Loading them doesn't work ...
So ... naturally I checked DarkPlaces.
DarkPlaces can save and restore multiplayer save games.
To be continued ....
Yet searches in FitzQuake, Enhanced GLQuake and TyrQuake ... you know, teh mappers engines ... have yielded no such sign of such capability ...
Saving multiplayer save games appears to work fine. Loading them doesn't work ...
- Code: Select all
/*
===============
Host_Loadgame_f
===============
*/
void Host_Loadgame_f (void)
{
char name[MAX_OSPATH];
FILE *f;
char mapname[MAX_QPATH];
float time, tfloat;
char str[32768], *start;
int i, r;
edict_t *ent;
int entnum;
int version;
float spawn_parms[NUM_SPAWN_PARMS];
if (cmd_source != src_command)
return;
if (Cmd_Argc() != 2)
{
Con_Printf ("load <savename> : load a game\n");
return;
}
cls.demonum = -1; // stop demo loop in case this fails
snprintf (name, sizeof(name), "%s/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav");
// we can't call SCR_BeginLoadingPlaque, because too much stack space has
// been used. The menu calls it before stuffing loadgame command
// SCR_BeginLoadingPlaque ();
Con_Printf ("Loading game from %s...\n", name);
f = fopen (name, "r");
if (!f)
{
Con_Printf ("ERROR: couldn't open save file for reading.\n");
return;
}
fscanf (f, "%i\n", &version);
if (version != SAVEGAME_VERSION)
{
fclose (f);
Con_Printf ("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
return;
}
fscanf (f, "%s\n", str);
for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
fscanf (f, "%f\n", &spawn_parms[i]);
// this silliness is so we can load 1.06 save files, which have float skill values
fscanf (f, "%f\n", &tfloat);
current_skill = (int)(tfloat + 0.1);
Cvar_SetValue ("skill", (float)current_skill);
fscanf (f, "%s\n",mapname);
fscanf (f, "%f\n",&time);
CL_Disconnect_f ();
SV_SpawnServer (mapname);
if (!sv.active)
{
Con_Printf ("Couldn't load map\n");
return;
}
sv.paused = true; // pause until all clients connect
sv.loadgame = true;
// load the light styles
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
fscanf (f, "%s\n", str);
sv.lightstyles[i] = Hunk_Alloc (strlen(str)+1);
strcpy (sv.lightstyles[i], str);
}
// load the edicts out of the savegame file
entnum = -1; // -1 is the globals
while (!feof(f))
{
for (i=0 ; i<sizeof(str)-1 ; i++)
{
r = fgetc (f);
if (r == EOF || !r)
break;
str[i] = r;
if (r == '}')
{
i++;
break;
}
}
if (i == sizeof(str)-1)
Sys_Error ("Loadgame buffer overflow");
str[i] = 0;
start = str;
start = COM_Parse(str);
if (!com_token[0])
break; // end of file
if (strcmp(com_token,"{"))
Sys_Error ("First token isn't a brace");
if (entnum == -1)
{ // parse the global vars
ED_ParseGlobals (start);
}
else
{ // parse an edict
ent = EDICT_NUM(entnum);
memset (&ent->v, 0, progs->entityfields * 4);
ent->free = false;
ED_ParseEdict (start, ent);
// link it into the bsp tree
if (!ent->free)
SV_LinkEdict (ent, false);
}
entnum++;
}
sv.num_edicts = entnum;
sv.time = time;
fclose (f);
for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
svs.clients->spawn_parms[i] = spawn_parms[i];
if (cls.state != ca_dedicated)
{
CL_EstablishConnection ("local");
Host_Reconnect_f ();
}
}
So ... naturally I checked DarkPlaces.
DarkPlaces can save and restore multiplayer save games.
To be continued ....
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Hmm, i'm kinda at a loss. The multiplayer saved game would have to somehow store the progs.dat and possibly the current snapshot of the world/entity list etc. But beyond the realtime of the saved game data everything would just be idle and you would be running around a lifeless game right??
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Things potentially worth saving:
globals (note that this includes time)
ents+fields (duh)
lightstyles (switchable lightstyles, yay)
precache lists (at least if you can precache mid-level or you want to protect against mod versions)
per-player parms (multiplayer = multiple)
state of various cvars (coop+deathmatch+skill+maxplayers)
hub system (if you have one, which you don't)
the only logical difference between a single player and multiplayer save is the maxplayers value. if you save a multiplayer game, you can only load a single player however, thanks to the per-player parms. FTE does save all, so is meant to be able to properly save/restore coop games (player order doesn't matter, but your players need the same names on reload in order to match them to their slots, and they need to be on the server or to connect within a tiny timescale). However, I'm told FTE spawns you in solid stuff... so mneh.
globals (note that this includes time)
ents+fields (duh)
lightstyles (switchable lightstyles, yay)
precache lists (at least if you can precache mid-level or you want to protect against mod versions)
per-player parms (multiplayer = multiple)
state of various cvars (coop+deathmatch+skill+maxplayers)
hub system (if you have one, which you don't)
the only logical difference between a single player and multiplayer save is the maxplayers value. if you save a multiplayer game, you can only load a single player however, thanks to the per-player parms. FTE does save all, so is meant to be able to properly save/restore coop games (player order doesn't matter, but your players need the same names on reload in order to match them to their slots, and they need to be on the server or to connect within a tiny timescale). However, I'm told FTE spawns you in solid stuff... so mneh.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest