To clarify things a bit: I want to create a kind of database for my game, that simply is a class that stores all game-state information like object positions, player scores, etc.
The main problem I am facing, that the whole game is to be scripted, to the level of the (lua)script controlling what members should the database have.
The reason for this is that I want to create a game that gives modders complete access to the game via lua scripting.(its one of the core features) For this to be viable I need to be able to add custom elements to the database.
I want to avoid using a 'real' database and roll my own solution.
For example I want to be able to do the following in the script file:
-- In function init...
Engine:AddStateEntry( "Score", TYPE_INT )
-- In function update...
Engine:SetStateEntry( "Score", 12 )
My engine would then synchronize data between players and render things accordingly.
How could I:
- Efficiently store arbitrary types of data?(including arrays)
- Set up custom interpolation functions
Efficiency and ease of use are my main priorities.(I dont care if the implementation is complex)
TL;DR: How to efficiently store arbitrary data that is defined by lua scripts and stored on the c++ side?