State Machine in Online Multiplayer (Mirror)

Hi folks,

Just looking for some general advice. I reached the end of the Unity Multiplayer course and the basic game loop all done and dusted and working via Steam.

I now want to take this and flesh out my RTS idea. I’m thinking of using State Machine for unit conditions/orders etc. That bit I am okay with but I’m wondering how best to implement it with Mirror. Would I do all of the handling of states on the server side of client side, for example?

Any help or opinions gratefully received!

TIA

Hi there,

My instinct is that you would want the state machine handled by the Server. In the course, the client sends any requests about movement or combat to the Server using a Command. Then the server implements the movement, or firing etc. Since it is all being verified server side, you would want the state machine server side as well.

1 Like

That sounds about right to me too.

I’m currently thinking that the client calls the state change on the state machine on the server as a command, verifying authority in the process and then handing down the actions of that particular state to the clients in turn.

I’ve split a branch off my repo to have a play with this. I will update if I manage to do it (or not!).

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms