I'm sure this is the question you've all had in your collective minds upon reading the Trello card for the Casino.
Fear not! In this thread I shall explain this mysterious piece of tech that I've spent the last few months working on.
What does 'AGC' stand for and what is it?
'AGC' stands for Authoritative Game Coordinator.
It is a back-end system that runs game logic outside of Tower game servers.
Ok, but why is that important?
The Casino is a component of Tower that handles betting player currency.
Since game servers can be run by end users, they are subject to exploitation and are not to be trusted with player's items or currency.
To solve this, we run the Casino game logic on a remote system and send state updates to the game servers.
The AGC is therefore the only entity capable of taking and giving out Casino chips, which it can do in a secure way.
I'm a huge nerd, give me more details!
The AGC is essentially a networked Python interpreter.
It loads game scripts and allows for remote invocation of script functions from the gameserver API.
When the gameserver starts up, it will coordinate with the AGC to create a remote representation of each 'machine' in the casino (slots, poker, spin-to-win, etc.).
User interactions (i.e. pulling the lever on a slot machine) are networked to the AGC with the machine's unique instance ID as remote procedure calls.
The remote representations are updated by the AGC and networked to the gameserver.
The gameserver will then replicate those states to the clients.
How is work on the AGC progressing?
Just today we got all remote calls working, functions can be invoked on the AGC, and the AGC can invoke functions on the gameserver API.
I created a simple high-low guessing game on the AGC, and a console application that uses the gameserver API to interact with it.
As a stress test, we're firing up a bunch of instances of the gameserver test application to see how much load the AGC can take. It's just the high-low game, but the client just spams guesses that are too low.
A video showing this:
What's left to do?
Curently there isn't any concept of "playing a machine" on the AGC, it just creates machine instances which can be invoked. The next step here is to add functionality to add and remove players from machines (poker definitely needs this).
Also, state needs to be implemented so that the gameserver can keep track of the state of any given machine (i.e. slot machine jackpot values).
Lastly, the game clients need to be able to tell the AGC when they want to play a game, bet, spin, etc. The gameserver can't do this as it would allow for rouge gameservers to act upon player's behalf without them knowing.
So, is it almost done?
The AGC is nearly complete, when we roll out the Casino, we'll be doing an initial phase where we run the Casino on our servers only for a while, and then once everything is ready to go, we will incorporate it into all Tower Unite servers.