Behavior Tree and Multiplayer

#1
Hi, I'm using behavior designer for my networked enemies, however the behavior tree will only see the client who is hosting the game and not the connecting client? is there anything specific i should be doing to get it to work?

thanks

edit: using Unity networking

Daniel
 

Justin

Administrator
Staff member
#2
This is a pretty large topic but from a design standpoint with unet, you'll want your AI to run on an authoritative server. This will mean that the server is making all of the decisions and sending the client the result. For example, if the Seek task is currently running you'll only want to send the client the current position (or velocity). From this standpoint the behavior trees aren't even aware of the network. Behavior Designer is integrated with uNet so you can send SharedVariable values across the network, but I don't think you'll need to use this for an authoritative server.
 
#3
Hey and thanks for the reply. so i am currently setup for the server to be authoritative. The server handles the spawning of the enemies on the server.
So once the players get spawn,theoretically i believe from my understanding the enemies should have visibility of all players. However for some reason it will only locate the player hosting as the server. So from what i understand Behavior trees should work out of the box for uNet?

Many thanks

Daniel
 

Justin

Administrator
Staff member
#4
Hey and thanks for the reply. so i am currently setup for the server to be authoritative. The server handles the spawning of the enemies on the server.
So once the players get spawn,theoretically i believe from my understanding the enemies should have visibility of all players. However for some reason it will only locate the player hosting as the server. So from what i understand Behavior trees should work out of the box for uNet?

Many thanks

Daniel
This is really tough to answer without really digging into it but from a conceptual standard if your behavior tree is on the server it doesn't care which object is owned by a client or not. You will need to structure your game so the tree only executes on the server.
 
Top