[NLA] Pathfinding still can cause game stutters

Yes. As I’ve said before, the only things that the client (lua) does is the camera, rendering in general and with r34 some unit stuff too.

It depends. If the server is completely frozen, the bar isn’t going to update and therefore stays on the last value (which is ~0.2 seconds ago I would guess). Since this can happen in extreme spikes, it’s possible that 0.2s ago, everything was okay. For example, executing repeat until false during the game results in a supposedly 4% lua gc and 96% idle. The server, however, is actually doing 100% lua right now, I’m pretty sure of that. Because there’s no chance to actually update the bar (because, well, getting values from the server is kinda impossible), well.

In the end, the bar is not the current status, but much more the status of the server in the last frame during one game tick I think.

One way to tackle this could be some sort of “ping” where the client measures the time the server requires to respond. If the server isn’t responding within a given time frame (again, I’d assume that 200ms (~one tick) would be the minimum time), it can be assumed to be stuck and the bar can explode or something like that. Anyway, room for improvement right there.

The server-client separation was there since I’ve joined around R14 and I’m quite sure it was that way since R1 (or even the graphics test) - so it’s kinda still the same issue. It just shifted a bit.

Chiming in again, got new build, it is now obvious that it is pathfinding that is causing the very slight fast momentary game freazes.(stutters) (the pathfinding bar doesnt even need to fill up the thing it still happens when the pathfinder only takes up 1/5 th in the moment of the freeze or no bar at all) (and it only happens when a citizen paths). (until instantly going back down to 0 percent after it) when no pathing is happening the bar is completely green. It is the only thing causing any momentary frezes.

The stutters are very quick, VERY quick, but they happen.

no “thinking” isn’t causing the stutters. I found. (it appears at least)

I am curious, how do you guys actually do your pathfinding?

(rp please don’t chime in I want to hear it from the devs)

I’ll assume I am not the only person this is happening to, just thought I would say taht it is still happening in this build)

edit:Noticed in the dev blog you are working on optimization still.
still need to throw this out there.

As others have said, this is a known issue, and it’s not the pathfinder. Most of the stuttering is caused by “think storms.” When a new task is created, it’s issued to every worker and they all simultaneously try to find a solution to the task. The first worker who can find a solution wins.

For instance, when a tree is chopped down, n blocks of wood appear on the ground, and each one spawns a “restock” task to m workers. Each task involves calculating a path from the worker to the wood, then from the wood back to the stockpile.

Even though the pathfinder is quite fast, the server is calculating O(n * m) paths, plus doing some more thinking work related to the task, all in 1 frame.

The solution, which we’re working on now, is pretty obvious: a task scheduler that hands out tasks in a more sensible manner.

3 Likes

Thank you good sir. for clearing taht up.

:smile:

I can’t wait.

Love teh new version… :stuck_out_tongue:

Just thought I would notify you that it was still happening.

(mind locking teh thread)

I have enountererd problems in my own coding endeavers when it comes to multiple AI things (like pathing operations/others) in a single frame causing issues like this.
Much more informative.

This topic is now closed. New replies are no longer allowed.