Behavior Tree and Multiplayer

djgriff

New member
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
 
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.
 
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
 
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.
 
Don't mean to revive an older topic, but I am having the same issues. I have 2-4 players all connected to a dedicated server. NPC's spawn and "search" for a random player. The problem is, they only find the first player that connects to the server. Anyone else able to help?


1160
 
There are a lot of factors going into it so it's tough to debug over forum, but you could place a breakpoint within the Find With Tag task to start to narrow what is going wrong. Find With Tag just does a GameObject.FindWithTag call though so as long as all of your clients are loaded then it should search all of the GameObjects.
 
You mentioned being integrated with unet, I'm wondering how this would go over with a cloud solution such as Photon?
My main concern is the data cost, as that seems to be a big limitation, but to my knoweldge BT's are more performant than say Utility AI so..
 
This post should help:

 
Top