The Cluster Server is hosts the game and handles most of the networking functionality.
Accepting connections
Handling connections
Registering this cluster
Get other servers
Authentication
Extra commands
Social commands
Movement commands
Action commands
The Cluster Server is hosts the game and handles most of the networking functionality.
Accepting connections
Connection::Disconnectback to the client with aDisconnectReason::Full. Handle client connections in parallel with the master server connection #25Handling connections
Registering this cluster
ClusterSetup::Initto the Master Server with the length + version number as a string and the length + key name as a string as well. Register the cluster server with the master server #26ClusterSetup::AnswerSecretwhen receiving aClusterSetup::Initfrom the Master Server. It should send back the decrypted passphrase. No length is required because it should be a fixed length anyways (20 characters). IP, port, max connections, and length + name also required. Register the cluster server with the master server #26Get other servers
Connection::RequestClustersand thenConnection::RefreshClustersevery 3 seconds. Get a list of other servers for the cluster server #27Connection::RequestClustersagain if the version number sent for the list of clusters doesn't match. Meaning the list was updated recently. Get a list of other servers for the cluster server #27Authentication
This should only work on official servers. The user should encrypt their password with a pubkey from the pub key that comes with the game. It should encrypt a very small piece of data with their pub key version number. If it matches, the client encrypt their credentials and send it to the server. Then the server checks it. These credentials can be a username and password or an OpenID token. Handle authentication on the cluster server #28
TODO what to do afterwards? How to store the data, hash, refresh, what number to start ids at? 2FA when using username login? And more common sense changes. Handle authentication on the cluster server #28
Extra commands
Social commands
Low bandwidth users can opt to not receive any messages. This is done by indexing guild, local, direct, and party message IDs. Each of the message types will try to find it in their respective
HashMapfirst.Global messages should loop through all users on the server and send them a message then send that message to all other servers to relay it as well. This is only for admins. It's for system messages.
Guild messages should loop through all users on the server that are in a guild. Then it should send it to all servers and do the same. This means there has to be a struct that contains guilds. When the last guild member logs off, the guild should vanish. Any guild member that joins or leaves the server should be added or removed from this guild struct. And any message going through it should send to all of the IDs that match in the indexed guild HashMap.
Local messages should loop through all nearby players if they have it on. No need to track the players. The client should send the command with the message and then the server will find all of the nearby players on their message. So the only time to check would be when a message is sent.
Direct messages should send it directly to a user with an ID. But it will check if they've blocked, friends only, dnd, etc. Various statuses for the recipient before delivering the message. If there's anything blocking this, send the command back with a 0 for false. If there's nothing blocking it, send the command back with a 1 for success.
Party messages sends a message to all users in their party. A party is tracked with an index as well.
Movement commands
Action commands