New ACS features for 1.3 - Databases and Accounts
Posted: Sat Dec 06, 2014 2:45 am
So...yeah, Zandronum 1.3 has been out for a while, and one of the lesser-known features that came with it is the new ACS functions that deal with databases and accounts.
What do the database functions allow you to do? It allows you to save data that you can retrieve at a later date, even after having restarted the server. So you could...say...keep a high score list for a game mode. Or maybe keep track of a player's inventory after they've disconnected. Or maybe keep track of experience points. Or do some other sort of long-term stat tracking, like number of frags per weapon. Lots of possibilities. You can even share data between multiple servers if you want (and if you're careful).
Of course, if you want to tie anything to a particular player, not only does it help if you can save data between servers and across server restarts, but it helps to be able to tell who a player is. This problem is solved by the new account system, and this account system has ACS hooks that allows you to tell what account a player is using - if they're even using an account at all.
In order to use this new functionality, you need a new version of the zdefs.acs and zspecials.acs files for acc. You can grab them below:
I wrote a wiki article that has a short overview of the database functions here:
Wiki Article: Database
...however, it's only a summary and has considerable room for improvement. However, you don't need to memorize all those functions at once - you can simply start with the functions labeled Data retrieval and saving and go from there.
The accounts API doesn't even need its own article, as there are only two functions and their use is simple:
Feel free to ask any questions about either new feature in this thread. As for why I'm posting this - I figured the new features could use some much needed exposure.
What do the database functions allow you to do? It allows you to save data that you can retrieve at a later date, even after having restarted the server. So you could...say...keep a high score list for a game mode. Or maybe keep track of a player's inventory after they've disconnected. Or maybe keep track of experience points. Or do some other sort of long-term stat tracking, like number of frags per weapon. Lots of possibilities. You can even share data between multiple servers if you want (and if you're careful).
Of course, if you want to tie anything to a particular player, not only does it help if you can save data between servers and across server restarts, but it helps to be able to tell who a player is. This problem is solved by the new account system, and this account system has ACS hooks that allows you to tell what account a player is using - if they're even using an account at all.
In order to use this new functionality, you need a new version of the zdefs.acs and zspecials.acs files for acc. You can grab them below:
I wrote a wiki article that has a short overview of the database functions here:
Wiki Article: Database
...however, it's only a summary and has considerable room for improvement. However, you don't need to memorize all those functions at once - you can simply start with the functions labeled Data retrieval and saving and go from there.
The accounts API doesn't even need its own article, as there are only two functions and their use is simple:
- PlayerIsLoggedIn(int pid) -> bool loggedin?
- GetPlayerAccountName(int pid) -> string name
Feel free to ask any questions about either new feature in this thread. As for why I'm posting this - I figured the new features could use some much needed exposure.