Integration into State Machines and New Input System

I Have taken part in several courses from the GameDev.tv org. I am really please with the education the team are able to put forward, I have learned a lot throughout the courses and now I finally begin the journey of mixing all the knowledge obtained into a Multiplayer RPG game with third person input and state machines. This seemed easier in my head, but now I have begun I’m struggling to see where it would be best to separate the functionality, also would making the state machine network behaviour essential help making the states network behaviour?
Any assistance would be appreciated, I think I need a mentor throughout this long process XD
Thank you GameDev.tv
From Jordan D

For a multiplayer game, you may want to have the state machine be run by the server and then have the specific behaviour synced to the client.
Generally you want to follow the pattern of:

  1. Client inputs controls
  2. Inputs are sent to the server
  3. Server decides on the response
  4. Server updates the game state
  5. Server syncs the state back to the clients.

Most of what should be happening on the client is UI and user inputs. You can do some behaviour on the client, but the server should be ultimately making those decisions and syncing it back to the clients.

1 Like

Thank you so much, I thought it might be along those lines just wasn’t sure how much i should limit the clients and what variables I might need to sync. I appreciate your help kind sir!
I am wondering if there is anyway I could add you to my repository to guide me through the first part of integration? I should be fine after understanding a little more on how to link the information I have learned through the courses?

I think it’s best for you to take a shot at it and ask me any questions here. You can also check out Mirror’s discord or the GameDev.tv discord where you can ask questions.

Hey so I understand this course covers Mirror component, I looked further into networking with Unity and found more tutorials by DapperDino, including Unity’s new Netcode package, I have found this is easier to use however I am struggling with integrating the statemachine’s logic over, if possible could i show what i have so far and get help despite being a different unity package from unity. I have got far with the help from GameDev.tv so I’m wondering if the assistance could be continued.

I’ve reached a roadblock with Unity’s netcode for game object… my issue is as follows.
I have created a State machine which inherits from Network Behaviour, and have a State which is abstract, with abstract methods. The Base State inherits from the abstract class and each state inherits the base class… this is where the issue comes in none of the states are network behaviour so I have no idea how I am going to implement ClientRPC or authority checks within each state… I’m officially stuck XD

Hi there,
If the states are abstract classes and do not inherit from the network behaviour but need access to the network behaviour then maybe they should inherit from the network behaviour?
Alternatively, they could access another network behaviour class to utilize these methods. Perhaps the the authority checks and RPC calls could be located in the state machine and not the states themselves.
I would think over the structure again, and see if your states are exactly what you want them to be. This is a broader object oriented programming question about the purpose of the state classes in your game.

Hello Sir Yitzchak.
First of all thank you for the response I love the interaction the GameDev team makes.
Yeah I am gonna have to change it about it seems I have been playing around with it all week and I feel I am trying to keep the logic the same as learned in the third person course, whereas I will need to change it about to work with networking and I didn’t want to do that but now I’m starting to see its inevitable. Im considering of turning the states into an enum which will become the network variable, then create a Dictionary of both state and state logic… and run the state logic through being in each state… therefore states will be sync and logic can remain the same… I see a similar kind of implication in the boss room example, for netcode.
Im sure you will hear from me again when i figure this doesnt work for me XD, wish me luck!

1 Like

Privacy & Terms