Made reasonable progress getting web sockets from Unity running to a basic scalable environment in AWS. I’m running a basic NodeJS server that will soon run Express for web services over HTTP/HTTPS and SocketIO allowing direct socket connection to each instance over TCP 80 for real-time gameplay. At this point given the likelihood of low player volumes I will most likely build a singular global services layer with 2 instances out of a US region, then deploy a copy in AU and EU for gameplay servers only. Building this as a dual purpose codebase keeps deployment simple.
My current plan is to configure a web socket connection for each multiplayer game the player is running on their device. That way anyone can play against anyone else in the world.
To maintain this model I’ll build a game server list of instance endpoints that modified based on server availability / load / etc.
Time asynchronous multiplayer
I can also see a benefit in letting players against each other in the same game, however at different times. Essentially Player A will complete their game, let’s say it took 48 seconds, then Player B can play against the same shuffled Brick Block. If they complete their Brick Block in less time, they win. The server will stream Player A’s moves as if Player A were playing at the same time.
This could effectively in time create infinite multiplayer options for players .
I like to use AWS DynamoDB (NoSQL Object DataBase) due to its operational simplicity. One draw back is the lack of built in sort / count methods available in the API. This is needed for leaderboards and matchmaking. I’ve chosen Elo for ranking players and plan to keep running totals on 1, 10, 100 and 1000 increments from 0 to 2000. This should let me confidently modify counts with UpdateItem and gather position totals with BatchGetItem, as shown in examples above.
An example of a ranked match outcome should look something like this:
Player A (1700)
Player B (1300)
Here Player A stands to improve their rank by +17 whereas Player B stands to improve by +30 in the event of a win respectively.