Persistence

From ALiVE Wiki
Jump to: navigation, search
Icon sys data.png ALiVE Data

How It Works

ALIVE Persistence stores mission and player data either locally or in the cloud, allowing players to retain the state of the mission across multiple sessions. This works both for players disconnecting and rejoining in progress as well as between server restarts.


Usage: Place the ALiVE Data module and set the Database Source to Cloud or Local as required. For cloud persistence, you must register a free account on the War Room. Local persistence does not require a War Room account. You can register an account to view Mission Stats whilst using Local persistence if you prefer.


Configuring Module Persistence

Persistence is configurable on different modules, allowing mission makers and server admins to choose the level of mission data to be stored and recalled. To turn on persistence, choose the option in the relevant module. Persistence is OFF by default.

Profiles Virtual AI System persistence stores the state of all virtual AI profiles including current location and combat effectiveness.

OPCOM Military AI Commander persistence stores the current orders relating to each Objective. If AI Commander persistence is off when a server starts, the AI Comd will review the current state of assigned objectives based on the location of available units and issue fresh orders as normal.

CQB With Military CQB Persistence on, ambient CQB sectors are stored to DB (not individual CQB units). Players should take care clear a sector fully before a server restart. If not, the sector may still be considered occupied and fresh CQB units will spawn in that sector.

Player Player Persistence comes with the ALiVE Player module and stores a large amount of player data to the database, including location, medical state and equipment. The module has a option to turn Database saving OFF. In this case Player data will be saved for the current mission only - once the game is restarted, the player states will be reset. This is useful for people who want player persistence for JIP or disconnected players but not between missions.

Logistics Player Logistics persistence is enabled by default and will store the location and contents of vehicles, objects and players. Vehicles and objects are saved when they are moved or accessed by a player using ALiVE Logistics Support.


Exiting and Shutting Down

When players leave the mission they should use the ALiVE specific Player Save & Exit button. Quitting the mission normally (with the BIS exit or Abort buttons) may cause persistent data to fail. Similarly, when closing the mission down be sure to use the Server Save & Exit button.


Resetting Stats and Persistence

  • War Room uses onLoadName (set in description.ext or mission options in the Eden editor) as a unique id for recording stats.
  • Persistence uses the mission.pbo filename as a unique id for saving persistent states.

For example:

  1. To keep the same Stats and Mission Persistence, keep both onLoadName and Filename the same.
  2. To reset Persistence but keep Stats (for example, to retain stats across a campaign of several ops), change the Filename only.
  3. To reset Stats but keep Mission Persistence (for example, to record separate stats for each session), change the onLoadName only.
  4. To reset both Stats and Persistence, change onLoadName AND Filename.

None of these effect the mission name that shows in the game browser (which is set in mission.sqm) so you can call it whatever you want.


Persistence Confidence Check

Follow the Server Setup instructions in the War Room, ensuring your servers public IP is registered.

  1. In server.cfg include persistent=1;
  2. Start your dedicated server with the following mod params -mod=@CBA_A3;@aliveserver;@ALiVE;
  3. Start your Arma 3 client with the following mod params -mod=@CBA_A3;@ALiVE;
  4. Main Menu > Multiplayer > select your dedicated server > JOIN
  5. / #login yourpassword
  6. Maps > Stratis
  7. Missions > ALIVE | Quick Start (COOP 9)
  8. CONTINUE
  9. Select a slot (Squad Leader)
  10. OK
  11. When the map loads, if you have successfully saved a mission before with SPOTREPS, PATROLREPS, SITREPS or markers, they should be displayed on the map. The map diary should also include entries relating to the reports.
  12. CONTINUE
  13. A hint to the right hand side should appear stating your web profile has been loaded, if not persistence has failed.
  14. If you have saved a previous mission, then you should be restored to your last location with your last loadout.

To see an example of a mission that is successfully loaded and saved see here


Persistence Script Commands

You can save and retrieve custom value using the following funcs. These functions need to be run SERVER side and @AliveServer needs to be installed and running.

["MyCustomVariable", _value] call ALiVE_fnc_setData  //will save to the Cloud on next Server Save & Exit
_value = ["MyCustomVariable"] call ALiVE_fnc_getData  //will load on next mission start or when command is executed


For local persistence, you can use the following

["MyCustomVariable",_value] call ALiVE_fnc_ProfileNameSpaceSave; //will save to local ProfileNameSpace on next mission save
_value = "MyCustomVariable" call ALiVE_fnc_ProfileNameSpaceLoad;  //will load on next mission start or when command is executed


We recommend that you save no more than 10KB worth of data in TOTAL for custom variables.


Manually clear data from the ProfileNameSpace when running Local persistence using the following commands.

call ALiVE_fnc_ProfileNameSpaceClear  //removes current mission data only
call ALiVE_fnc_ProfileNameSpaceWipe  //removes all mission data completely


Autosave can be scripted in using Local persistence only (not available with Cloud). The server may lag/desync for a few seconds while saving takes place:

900 call ALiVE_fnc_AutoSave_PNS //where 900 is the save interval in seconds
-1 call ALiVE_fnc_AutoSave_PNS //run at any time will disable autosave



Example snippet - Grabbing a variable, checking if it was saved, if not -- use a default value, otherwise react accordingly

["ScriptStarted", _started] call ALiVE_fnc_ProfileNameSpaceSave;

in your init.sqf or similar:

_scriptStarted = "ScriptStarted" call ALiVE_fnc_ProfileNameSpaceLoad;
 
if (isnil "_scriptStarted" || {!_scriptStarted}) then {
    // start script
    ["ScriptStarted", true] call ALiVE_fnc_ProfileNameSpaceSave;
};

Editor Notes

Note that when editing missions that are persistent, units placed on the map in the editor may be moved to their stored location when the server restarts.

Persistence is predicated on the mission.pbo name. You can can change the displayed mission name in mission.sqm no problems, but the pbo must remain the same. To reset the Persistence state of a mission (start a fresh one) simply rename the pbo file. See ALiVE Data for more info.