Currently the LUA script engine has two ways to save variables. Internal LUA variables and quest variables. LUA variables are very fast but unfortunately not persistent. This means that they are lost when the server is restarted. Quest variables, on the other hand, are saved in the database, but they have several issues:
My proposal is to create four different kinds of persistent variables:
| Type | Scope | Gameserver caching | Synchronisation | synchronous access |
|---|---|---|---|---|
| char | character | partial | immediately | no |
| acc | account | partial | immediately | no |
| map | current map | completely | occasionally | yes |
| global | whole game world | completely | immediately | yes |
I propose to rename quest variables to character variables because this name is more intuitive. The old script bindings should stay as an alias for backward compatibility.
The behavior stays the same:
Script bindings:
Account-bound variables have proven to be very useful in eAthena for various purposes. So I would suggest that we implement this feature too. Their API from the scripting engines view should be identical to the one for char variables. This means that they are get and set through the character handle, but the gameserver and accountserver handle them by the account ID of the character internally.
The behavior stays the same:
Script bindings:
The advantage of map-bound variables is that there is no need to propagate them between gameservers. This allows for a much more performant implementation. The advantage over character variables is that they can be stored and queried with synchronous calls (enabling to use them from synchronous script functions). The advantage over global variables are that the number of variables which need to be stored by each gameserver is reduced and that every map uses its own namespace. I believe that map-bound variables are sufficient for most purposes where it is necessary to share persistent data between characters.
Script bindings:
Map variables will cover a lot of cases where persistance of LUA values is needed. But for communication between different maps a global variable type is needed. I would also suggest to cache them completely by each gameserver.
Script bindings:
I read the RFC and I almost completely agree with it. "The old script bindings should stay as an alias for backward compatibility." --> Manaserv has never reached a stable state. It's nonsense to speak about backward compatibility as the new implementation is at 80% incompatible with the former one. Then, no alias to keep for me. Apart from that, the whole proposal sounds great.