DUWS-R-Team / DUWS-R

ArmA 3 Dynamic Universal War System - Rebirth
42 stars 18 forks source link

Saving in Multiplayer? #184

Open Alias-Me opened 5 years ago

Alias-Me commented 5 years ago

So after playing DUWS in SP a long time I got some friends on board to play Multiplayer. But after loading the scenario on a server I realized I couldnt save, the ESC Menu option obviously didnt work, but the SITREP or REST save options in-game also weren`t available.

I don`t think the scenario is supposed to be played in one sitting, is it? Seems a little much, so am I missing something? Or am I wrong?

CaiusAjiz commented 3 years ago

Came across this one tonight too, I've given the code a cursory glance and here's what i'm seeing:

When it's a server I can see where it's adding the action to save (example is fn_HQaddactions.sqf ) if (isServer) then { _hq addaction ["<t color='#00b7ff'>Rest (wait/save)</t>", duws_fnc_savegame, "", 0, true, true, "", "_this == player"]; };

but on searching, I can't see duws_fnc_savegame anywhere beyond it being added as an action or in CfgFunctions.hpp where class savegame references it . I'll have a proper dive in soon and see if I'm losing my mind or it's really not there.

CaiusAjiz commented 3 years ago

Ok so I've been looking at this. Turns out I was misunderstanding how CfgFunctions.cpp works. What's happening currently is when you Rest with either "Rest (Wait/Save)" on SP or MP, "Rest" on a dedi or by getting a SITREP, it runs duws_fnc_savegame (which is just functions/generic/fn_savegame.sqf).

In here is just a saveGame; which i think is an SP only thing.

So to fix this (As DUWS-R doesn't rely on mods) I think it's going to be a case of taking all of the necessary gamestate floating about in the various variables, and saving them into a profileNamespace on the dedi itself , which persists on to disk and then at mission load, check for a gamestate in these variables, and load those instead of starting a new mission each time it starts.

I'm working on a PR. Might take some time for me to unpick and put back together what's going on so the mission can load properly.