Accounts, persistent storage and EVENT scripts
Posted: Wed May 07, 2014 8:07 pm
For those of you who are not following the details on the tracker I'd like to give an update on the things we have been doing recently.
The account and persistent storage systems are pretty much ready for testing by now. The ACS interface to make use of the new features is as follows:
There are three new cvars
- databasefile controls where the database is saved (defaults to ":memory:", i.e. volatile in-memory database)
- authhostname is the masterhostname analog (port can be specified with ":port")
- sv_forcelogintojoin prevents unauthenticated player from joining the game (can still connect as spectators)
The console command login allows the client to authenticate with the auth server the server has selected with its authhostname setting.
Furthermore, I added the new experimental script type EVENT. By calling EVENT scripts the engine can notify a mod that a noteworthy event happened and also provide some information about it. This is meant to cover events that are difficult or even impossible to be detected reliably with ACS. A mod can declare an event script (needs new ACC, source here) as follows:
So far we have the following events (more details can be found in the tracker ticket)
'type' is the event type as integer, e.g. GAMEEVENT_PLAYERFRAGS=0. The activator, 'arg1' and 'arg2' encode additional information about the event. For instance, the activator of PLAYERFRAGS is the fragging player and arg1 is the number of the fragged player. For this event, arg2 is not needed and always zero. In the event script, the mod can react to the event in any way it sees fit. For instance, it can track stats with the new database interface.
At this point I'd be very happy about feedback from the community. While I'm pretty sure that the additions pave the way for new exciting mods, the interfaces are not fixed yet and can certainly benefit from your perspective. Also the list of events is still very short and has room for many more events.
The account and persistent storage systems are pretty much ready for testing by now. The ACS interface to make use of the new features is as follows:
Code: Select all
void SetDBEntryInt ( string Namespace, string EntryName, int EntryValue )
int GetDBEntryInt ( string Namespace, string EntryName ),
void SetDBEntryString ( string Namespace, string EntryName, string EntryValue )
string GetDBEntryString (string Namespace, string EntryName )
void IncrementDBEntryInt ( string Namespace, string EntryName, int Increment )
int PlayerIsLoggedIn( int Player )
string GetPlayerAccountName ( int Player )
- databasefile controls where the database is saved (defaults to ":memory:", i.e. volatile in-memory database)
- authhostname is the masterhostname analog (port can be specified with ":port")
- sv_forcelogintojoin prevents unauthenticated player from joining the game (can still connect as spectators)
The console command login allows the client to authenticate with the auth server the server has selected with its authhostname setting.
Furthermore, I added the new experimental script type EVENT. By calling EVENT scripts the engine can notify a mod that a noteworthy event happened and also provide some information about it. This is meant to cover events that are difficult or even impossible to be detected reliably with ACS. A mod can declare an event script (needs new ACC, source here) as follows:
Code: Select all
Script 11 (int type, int arg1, int arg2 ) EVENT
Code: Select all
GAMEEVENT_PLAYERFRAGS (player frags another player)
GAMEEVENT_CAPTURES (player captures the flag/skull)
GAMEEVENT_MEDALS (player receives a medal)
GAMEEVENT_TOUCHES (player touches the flag/skull)
GAMEEVENT_RETURNS (the flag/skull is returned)
GAMEEVENT_ROUND_ENDS (the current round ends and the win sequence starts, e.g. when the fraglimit is hit)
At this point I'd be very happy about feedback from the community. While I'm pretty sure that the additions pave the way for new exciting mods, the interfaces are not fixed yet and can certainly benefit from your perspective. Also the list of events is still very short and has room for many more events.