Jump to content

Please add a primitive/limited data persistence method


Recommended Posts

Posted

Currently, a mission cannot persist any data, meaning every mission launch is exactly as it was the very first time. I would very much like if there was a primitive, *sandboxed* version of data persistence that is supported by the mission's API - not necessarily supported by the mission editor itself. It must be secure so it can't be used for nefarious purposes, fast, and simple to use.

 

I propose a method

env.saveData(string data)

and its counterpart

env.loadData()

 

that would only be able to save a string (of any length); it would always save that string at the same location (perhaps inside the .miz itself) and it would only be able to load that one string. Nothing more. 

 

It's not much and very limited, but being able to save a single string would allow mission designers to save scores, mission stages, previous results, kills, etc across multiple mission launches. 

 

Posted (edited)

Thank you for pointing on this! I proposed same some time ago. As you said this simple concept will allow truly dynamically generated campaigns. Same system is used in Operation Flashpoint / Arma series, It saves persistence into mission name space.

 

You can do a lot with such small thing. Branching campaigns, keeps player score, dynamically change missions in campaign. Persist damage and so on.

 

I can't understand why they are reluctant to add this simple feature. Meanwhile we are forced to hack MissionScripting.lua and take out sanitization to be able to persist. It works but not ideal.

 

Also as addition to your global env storage I would implement mission relative calls as well that will store vars relative to each mission/campaign. But even your env. approach is big help - campaigns can reset "cookies" on first or last mission.

 

Also it should be implemented as key, value pair to ease acess per mission/campaign 

 

env.saveData(string key, string data)

env.loadData(string key)

 

I made similar persistence code to save stuff for my own dynamic campaign.

Edited by ataribaby
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...