In a multiplayer game, I have a need to use FindPathToLocationSynchronously on clients so I can draw predicted movement paths locally. Unfortunately, AI controllers don’t exist on clients. So I was hoping (in C++) to leverage the NavigationSystem into my player controller. I’m currently digging through engine code to see if I can figure this out but it’s not looking great. I imagine this has been done before so I was hoping to find an answer here.
Thanks
Edit: I found the project setting “Allow Client Side Navigation” which now allows me to access the navigation system in the player controller with
Well, I am drawing the path clientside in realtime. Currently just using debug lines but I’ll make it something cleaner later. The idea is that as the player moves their cursor, we draw the path that the AI will take to get there so that when they click, they have already confirmed the route that will be taken.
In order to replicate this, I would have to send RPCs to the server at a very frequent interval and get an array of vectors back. That seems like it would be pretty taxing network-wise and any lag would be extremely noticeable visually.
You’re right that there could be issues though. If an obstacle is not shown in the correct location clientside, their pathfinding will generate incorrectly. If this turns out to be a big issue, we may have to scrap the live drawing of the path and instead do something like … click once to see the path (which will do the RPC and get the vectors from the server) and click again to confirm it and move.
What’s to stop you setting this array up as a simple replicated array and a boolean for bDrawPathing? Then you only need to send RPCs for the start and end.