So I am currently working on this large scale rts, which requires using a lot of pathfinding. The problem is, I obviously cant pathfind on the server, since it takes long to compute paths, and the server would extremely lag. So I came up with an idea, anytime the server would like to pathfind, I would invoke it on client and just send the results back. I know its really bad idea in terms of safety, mainly because of hackers and stuff, but I cant think of any better idea. But I also think the risks could be minimal if its done so only the playerās units use the playerās client for path computing. What are your thoughts about this?
This sounds like a bad idea. Even without hackers etc, What if the client disconnects mid computation? Will the server be waiting for a return? You would also encounter lag to and from the client, and would need to have additional sanity checks, and a timeout handler to send the pathfind calculation to a different client.
It might be different if the pathfind was to be only used on the client though.
Do coroutines not help here?
I think that if the player disconnects, there wont be any need for his āunitsā to compute any path, because there wouldnt be anyone to issue them orders or something. And how would coroutines help in this situation? They wont change the performance impact the path computation does in any way.
I donāt know how many āunitsā you are expecting to move at any one times, but Justice the Awesome NPC system can easily cope with 500 NPCs constantly pathfinding without lag.
Could you provide me with a link to this NPC system you speak of?
There is also buried in the depths of the forum an extremely good article about network optimisation for an RTS and how they achieved very low data transfer rates with variety of optimisation methods. They run through each step they used:
Iāve actually read this post from Astrazine and even exchanged few messages with him, and the NPC system looks very promising. Thanks for your help!
Iāve read through the whole source code for the āJusticeā, and I must say that I am very dissapointed in it. It is nothing more that classic roblox pathfinding and looping through the waypoints with humanoid:MoveTo(). It isnt any better in terms of server performance
This is probably a late response but try setting the network ownership of the humanoidrootpart to ānilā. Therefore, it doesnāt sent signals to neither channels, hence less lag and non-jittering "walkto"s.
If you donāt understand what I mean, Iāll try to find a video on it to show you.
I totally know what you mean, but this ājitteringā you are talking about isnt my problem. My problem is in the high time pathfinding takes to calculate a path, resulting in total lagging of the server.
Oh! Sorry. Iāll go look for a solution.