Using a Behavior Tree Multiplayer

eltimo

New member
Hello,
I am new to multiplayer programming and have a question about using behavior trees. I've read a forum post, that said you should run the behavior tree on the server and only update the position/animations etc. to the clients. This makes sense to me, but I can't imagine yet, how this should be done. What would the client version of the npc look like/what components does it have? My original approach would have been to have the same behavior tree running on each client and then, when e.g. the health of it changes, I send an rpc to all clients to change the variable of the local behavior tree. I don't really understand, how I can have a copy of the npc, for each client, without running the actual behavior tree. I hope this explains the problem.
Thanks!
 
On the client you should leave the behavior tree disabled and only send the results of the action that the behavior tree took. For example, in your example, if the health should decrease because of the behavior tree then you would only send the health damage amount to the client. This way everything stays in sync and you only have one tree running.
 
On the client you should leave the behavior tree disabled and only send the results of the action that the behavior tree took. For example, in your example, if the health should decrease because of the behavior tree then you would only send the health damage amount to the client. This way everything stays in sync and you only have one tree running.
Thanks for the quick response
 
Back
Top