Persistence

From ALiVE Wiki
Revision as of 03:51, 16 June 2017 by Friznit (Talk | contribs)

Jump to: navigation, search
Part of:
Icon sys data.png ALiVE Data
Requirements: Synced
Icon sys data.png ALiVE Database
Onebit no.png

How It Works

ALIVE Persistence stores mission and player data on the central ALiVE database, 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. 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.

Persistence requires an account on the ALiVEmod.com War Room.


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 do not have access to the War Room.

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.


Exiting and Shutting Down

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


Resetting Stats and Persistence

  • War Room uses onLoadName (in description.ext) 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 Script Commands

You can save and retrieve custom values to the ALiVE database 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

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.