"What the heck is an 'AGC', and what does it have to do with Casino?"


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.


Quick Status Update on Casino Update

@Zak it looks like you’re trying to hack into the matrix in that video


Someone’s gotta get Neo out of there.


Telephone’s weren’t programmed yet?


Telephones don’t ring themselves.




Wow, the casino is being worked on more than I thought. I can’t complain, though. If I won the jackpot in GmodTower that one time, I bet I can do it again (ok, maybe its not that easy, but you get the point.) I have high expectations for the new and improved casino. Good going guys.


I understood very little of what you said but at least it shows you guys put a lot of time and effort in all of this to make it as unexploitable as possible and I appreciate that. :smiley:


So, I shouldn’t expect a lot of “NYEHAEH! THERE’S THE HIGH ROLLER!”? Got it.


Seeing how many servers we will probably have, what is the hypothetical max number of machines that can be created by the AGC without it going haywire? What would happen if we were to reach or exceed that limit?


The system is scalable to meet demand.
We can adjust parameters to ensure smooth operation across many game instances.

If we hit theoretical limits (such as the max connections on a socket), we’ll probably host more AGC servers at that point.


Seeing how strict we want the AGC to handle player interaction to be, will they be allowed on unranked servers? Or will unranked servers have their own server-side version of a casino AGC?


Since unranked have their own inventories and currency, i’d guess they have their own casinos not connected to AGC. Just a guess though.



More stuff getting done woo!
I’m working on stuff for authenticating players (no impostor plz).


Pretty awesome that you get things done.
But have you ever thought about turning AGC into an open-source project? I’d be willing to help you (others probably as well) and as long as you don’t share any encryption keys the source code release won’t harm TU’s security in any way, right?


I am a strong proponent of open-source software and I’d like to think that we could contribute more to that space in the future.
Maybe someday we could make the AGC open source, but now is not a good time to do so.
The code is pretty secure but there’s always the possibility that we might have missed something, and it’s better that we find it first before some shmuck with nothing better to do than break people’s games gets his mitts on it.


I like that word.


##Status report: After roughly 3 months of work, the AGC is nearly complete.
To convey what that work looks like, I printed a hard-copy of the code:


That’s got to have cost a lot of ink.