Download

How to use AIController to test networked game?

I’m working on a network game and I would like to use AI bots to act as player. I would start multiple clients and use a bot to replace the player in each of these clients.

I notice that there is some engine code that expects a PlayerController (UPlayer for example). To respect that code, I created my own PlayerController and I’m successfully instantiated a BehaviorTree to run the player stub behavior logic.

However, there is quite a load of code in the AIModule which requires the owner to be an AIController. Not to mention all the handling of the navigation system that is achieve in the AIController.

I don’t really see a clean way of achieving this. I could probably use multiple inheritances, but I feel it’s going to be painful to maintain. Any suggestions?
Thanks

I think AI runs on the server though so I’m not really sure that would test a networked game well.

You should be able to run from editor with more players in other windows locally, so you can definitely see that clients get all the data correctly. It’s under the options for how to launch the game when testing.

Unless you also want bots and are trying to test them. As far as I know, bots should work just fine. Unreal Tournament and Shooter Game should have samples of how to set up bots in case you haven’t looked at that yet.

AI does indeed run on server and that’s what I was trying to adapt.

My goal is to use a cluster of PC to connect/disconnect client and generate network traffic by having bot facing each other like if they were players. The amount of RPC call (including replicated properties) will be much higher that way.

I’m currently trying to inherits from PlayerController and use composition to hold an AIController which will repossess the Pawn. I’ll see how that turn out, but it think it will work.