- Home /
How to Sync Non-Players Actions in Multiplayer Games
Hi All, Im new in Unity so i need some help ^_^.
Im creating a multiplayer Game for android everything is ok with my players sync (Animations , Positions ...) but for exemple if i instantiate a Non-Player Objects like a monsters or zombies ( with auto Command Scripts like Attacking Players ... ) how can i sync their actions with all the other players ??
at the begining i was thinking about making one of the players the host client and will execute the monsters scripts and update for the others, but let's say if i have 100 players and 10k zombies i think the android devices cant Manage all the monsters secripts at the same time no ?!
For Example, https://youtu.be/StJM39WBLFo?t=42s
Answer by Opeth001 · Dec 30, 2018 at 03:52 PM
hi guys ^__^ .
sorry for this late response, ill respond to my question in case someone is having the same question in mind.
so to have this kind of feature in your games there are 2 ways:
1) the cheapest way is to make a client between your players being the authoritative one and drive all NPCs ( Non-Players, bots ) but this way your game will be open to cheating and the authoritative client will be the server, that means he will be favored by the network latency ...
2) using a headless authoritative instance of your game as a serve and run it within your pc or vps this way is secured and all your players will have 0 authority, they will not be able to see other players Ip Addresses and you have 100% control over your game logic. ( for production releases you wil certainly need to rent a VPS or a dedicated machine ).
to handle 1000s of NPCs you will need to think in a specific logic which is not updating all the NPCs every Tick update, but each NPC have to be driven by a certain logic that is executed in server & client side like NavMesh in unity, and updating only the NPCs that changed their behaviour ( the focused player or destination ) .
Good luck Guys!
Your answer
Follow this Question
Related Questions
How to communicate from clients to server? 1 Answer
How do I create a multiplayer turnbased game server? 0 Answers
Can MLAPI connect to a standalone server written in another language (Go) 0 Answers
Syncing particles 1 Answer
What's the best method to implement multiplayer on a Billiard game ? 1 Answer