I am currently aiming to make a multiplayer PVE game with boss style enemies, with an emphasis on melee combat and a parry mechanic, among other things. I’ve been doing research into client-side NPCs, and I would like to have most of the NPC behavior handled client side to improve on server performance and to ensure that combat is highly responsive, since the player would handle hitboxes. That being said, I don’t want the client to handle all of the logic, otherwise it’s very likely that the NPC actions wouldn’t be synced across players.
My initial concept is to have the server store the information of the enemy, calculate pathfinding and send actions to the client, and have the client actually create, animate, move, and render the hitboxes of the enemy. But I’m not exactly sure how I can ensure that clients are seeing roughly the same thing. While the timing doesn’t have to be the same, I want to ensure that each player is seeing the same string of actions, and that the enemy is in roughly the same place doing roughly the same thing.
I am looking for any advice, guidance, or resources I’ve missed that will help me client-side the combat while ensuring reasonably accurate client to client synchronization.
Well, you should probably just calculate the decision logic on the server, then send all required parameters (mostly just attack name and target) to the clients to replicate the attacks.
What I’m not sure about is NPC movement, such as the NPC wandering or if an attack has a movement parameter. Do I handle movement on the client side or on the server side, and what would it look like if I client sided it? Would I calculate the npc position server side, then tween it across a calculated path, then give the clients the path to move the NPC on their client? Or would it just be better to have the NPC in server workspace and have the clients take control for the attacks? And if so, how do I seamlessly transfer control for attacks to the client, without it sending automatic updates?
I understand to calculate decision logic on the server, but movement confuses me as to where and how it should be handled to ensure decent parity.
I’m not going to rescind my question, but after thinking it over some more and doing further research, I think handling movement server side should hopefully be sufficient.
I think most variables would depend on the finer details of the game. Each client doing their own calculations for the boss’s position are preferable if the arenas are simple and featureless, but you’d probably get a lot of desyncs if there’s tons of pathfinding required.
Yeah, the latter is the case. It’s an open area with lots of winding hallways, so I’ll probably have to serverside it. Thanks for the advice.
Also, I was looking at some of your guides earlier. Thank you for the resources, you’ll never know how many people benefit from your work, but you can count me.
1 Like