I don’t understand how I can make a cooperative game without replicating characters. In my game, the players will never see each other, they walk through different rooms, and I need to replicate all several variables. Replication as a protection against cheats does not make much sense here because the player-server can safely cheat, and playing together means that you are playing with friends and cheats are inappropriate there.
Therefore, I do not need pawn replication, it creates a lot of additional unnecessary difficulties. I’ve already done everything in the game, everything works well, except for one thing, I can’t create units under AI control by the client-player himself, for some reason only the server can create them, and because of this one thing, the engine system pulls everything else and forces me to do everything in the game replicated, that is, to do everything for replication, all the characters, shots, etc., a lot of unnecessary work, but I don’t need all this, it doesn’t make sense in my game.
If there is some way for the client-player himself to connect the AI controller and run a “behavior tree” for a character created by the client-player?
You can enable “Allow Client Side Navigation” in Project Settings. Also, make sure the AI is not replicated and I think you need to manually spawn an AI controller for it and possess it client side too.
For me, this worked:
Thank you very much for the answer, yes the controller is connected, but the “Behavior tree” for processing the AI behavior still does not work, although it connects in the ai controller, I do the same on the server player, the “Behavior tree” works as it should.
Can you tell me how you did it? Or tell me what I’m not doing wrong? Here is the code of my nodes when creating an Ai controller.
This code works if I run spawn on the server and does not work if I run it on the client.
I create the character as you described above.
I can move the character created by the client using a simple “AI move to” node, but he does not want to run the “behavior tree” although he does not give any errors.
No, there’s actually a “get self” there, it’s just that I experimented later and forgot to put it back in place. Otherwise, he wouldn’t be running it on the server either. That is not the problem, sorry.
Are you sure that you managed to run the “behavior tree” on the client side? I have read a lot of information and everything says that this can only be done on the server side.
You may be able to simply move it, but not trigger events and processing on the “behavior tree”.
I recorded a video of this test project, maybe you can watch it and see the reason why it doesn’t start? Or I can send this test, almost empty project that you have seen it. I just don’t understand which way to dig, where else to look for this information and which check mark to click to make it work.
Yes, it is, but I have already figured it out, I use “Load Level Instance” for dynamic level loading and “Procedural Content Generation” (pcg), although there were problems there too - before a new level load, you need to clean up the old load, but the node “Unloading Instanced Levels” sometimes led to a complete unreal engine freezes.
Here is a video of me recreating the solution in a new ThirdPersonBP project. If the AI doesn’t move, then the project setting “Allow Client Side Navigation” shouldn’t be necessary, but I left it in.
I did the same thing in a new project and it doesn’t work, what version of the engine do you have? It can be seen that this is not the latest version, I have a suspicion that this is the reason for the discrepancy. Can you send me your draft to eliminate any inaccuracies?
Yes, I just created this project in version 4.27 and it works fine, I do not know if these are flaws in the latest version or if the developers specifically decided to abandon this feature, but I will try to reach them.
Anyway, thank you very much for showing me this method, it can save me a lot of time.