State Machine Based Multiplayer Networking


Overview

In this update to Synthicate, I made several changes to the code architecture to move away from huge monolithic files. In the past, I based all of the logic in two main scripts: `GameManager.cs` and `GameManagerScriptableObject.cs`.  All of the state machine logic was also embedded in the `GameManager.cs`. This approach made it very difficult to iterate on Synthicate and add new features because I would have to hunt down every area that a state was checked and apply the new feature to that area. 

With my new approach, I've created a series of game manager states that inherit from a base abstract game manager state class. This new technique allows me to quickly add new game states and change the flow of logic between the game states. One challenge with this new approach, however, was synchronizing the state of the game manager between the clients and the servers. In this version, I've taken an approach where if one client needs to send information to other clients that are in a different state, that sending client must access the state component that the other clients' game managers at "in" and call the RPC there. This makes the code a little tricky when tracking the different states of all the different client. However, I plan to move on with other features as opposed to thinking of the best way to tackle this issue at the moment.

Future Updates

In future updates I plan to add the following features:

  • Giving players the ability to hack spaces if they hash a 7, or if they use a hacker event.
  • Giving players the ability to trade with one another, as well as the ability to trade with depots (similar to ports in Settlers of Catan).
  • Adding more sound effects.
  • Updating the visuals and menus to be more readable and aesthetically pleasing.

Files

synthicate.zip 38 MB
54 days ago

Get Synthicate

Leave a comment

Log in with itch.io to leave a comment.