I am working on RTS game and currently finished pathfinding. It works well (A* / A* + JPS), but the problem I am facing is a game lag whenever I am forcing units to move for some “long” distance.
For example, on 100x100 grid with node size of 1m the average calculation time is <= 30 msec to move from one diagonal corner to another (with obstacles). But during that mouse click event, when calculation just starts, a tiny lag of 0.5-1 sec appears and whole game slightly freezed.
I’ve done a lot of searching, but the only examples I have found were on how to calculate Prime numbers using AsyncTask(), but I don’t know how can I use it in my case, I need to have a connection in this case between main thread and others.
Can someone, please, give some close to world example using threads in UE4?
P.S. My current pathfinder is an actor component class.