Does the Behavior tree work in multiplayer?

I’m doing an multiplayer based RTS game. Everything working on server but in client i can’t move characters. Client sees changes in server. After quick search in google i found move to location is not working in multiplayer. So i try behavior tree but its not working too. in 4.7.6 behavior tree is not running. Blackboard variable is not changing. in 4.8 p4 behavior tree is running blackboard variable changing but “MoveTo” not working. What should I do? i need move to actor and move to location. im doing multiplayer because im start to think add enemy in game. Dont know why but i think add enemy in game with multiplayer is better. if you want see my problem I have edited topdown project and put in dropbox.

If the AI Pawn is set to replicate and replicate movement, he should normal replicate the position etc. Since he is spawned from serverside, you will want to only replicate the states he is in. Make replicated bools, for Attacking Animation etc that only the server changes. Since they are replicated, the client version will also get the update and the AnimationBP will show the correct animation. The Client doesn’t need to know about damage or something, the server will calculate that for him. so everything that happens in the behavior tree should be done on the server and only the position etc (though replicate movement bool of the pawn) should be replicated.

At least that’s how i imagine it. It’s been a time since i tested that.

thanks for answer but ai controller and character is replicated and movement replicated some variables replicated but still “MoveTo” not working in client…

You are sure that you call the MoveTo only serverside? And then the client version of the AI isn’t moving on client side? Have you tried creating your own BTTask and using the Move To Location or what ever it is called of the AI Cobtroller instead of the predefiened MoveTo?

AI in unreal engine works only on the server, bu design. However we did introduce a way to have clients own an instance of NavigationSystem as well. Go to your project settings and set Navigation System -> Allow Client Side Navigation. This should allow you to use Move To calls on clients.

Cheers,

–mieszko

Ok, i did not know that you could allow clientside movement. Ist that replicated or will the AI only move on client side?

If you want to move AI you should always do that on the server. That’s the way UE4 AI is set up. If you want to use AI on clients then be prepared for handling multiple issues derived from that we don’t use AI that way.

im calling “MoveTo” only serverside i think. i didnt create any custom events. I tried to MoveToLocation in ai controller but its not working too.

with this in client side when im order to move somewhere character just turning around not moving and server not detect client character action but client detect server side.

i edited topdown project and uploaded to dropbox but if you want screen shot no problem

in server there is no problem everything working.

in player controller (TopDown Project) im detecting move location and order to move. I am sending location to Character with interface then sending to AIcontroller(TopDownAI). In AI Controller with this setup Move to location is not working. Then I tried Behavior tree but its not working too. In behavior tree i created service its just printing blackboard variable “MoveLocation”. in world settings im using pawn for camera.

and character capsule component collision needs to be “overlap only pawn”

Hm i guess at this point we could need a screenshot of your setup. Where you call the move to, how the tree looks and the tasks etc if you have some.

any ideas?

Hey, please don’t bump question before they are unanswered for at least 4 days. Otherwise this will clutter the AnswerHUB and other people have problems getting their new questions seen.

For your problem i have no idea right now. MieszkoZ is the AI master here.
Just wait for him to reply (:

bump, 6 years later

1 Like