Running in Circles - Solved (maybe)

Everything about development and the OpenMW source code.
Post Reply
dteviot
Posts: 144
Joined: 17 Dec 2014, 20:29

Running in Circles - Solved (maybe)

Post by dteviot » 13 Sep 2015, 00:29

Feature 2229 notes that Actors have a "habit of running" in circles. And I've been working on fixing this.
So far, I've found 5 causes of this.
  • Flying creatures check that creature had reached navpoint did not allow for vertical distance between creature and navPoint. Fixed.
  • Infrequent checking to see if actor reached a navpoint resulted in Fast moving actors overshooting navpoints between checks, then circle back to try an hit it again. Partial fix: Now test each frame. so long as rate is above about 15 FPS, overshoot should not occur, even for actors with speed of 100.
  • AiFollow/AiCombat. When navigation toggles from "line of sight" short-cutting to "follow pathgrid". If nearest navpoint is behind actor, Actor would circle back to nearest point before continuing. Not fixed. Loss of "Line of Sight" means player should not see this either.
  • Bug in pathing logic, turns actor in wrong direction when moving south. Fixed in Monday's commit.
  • "Psudo circling". When Actor has AiWander with a short distance (<= 128), actor moves between two very close navPoints. This resembles running in a circle with the center between the two nav points. Not fixed, as not a bug and behaviour can be seen in Vanilla. Example: Phane Rielle in Balmora's South wall cornerclub.
Anyway, At this point I believe I've fixed the noticeable "running in circles" behaviour. But I'd appreciate it if anyone can tell me about any more instances of it they find. Ideally, with save games where it occurs.

Chris
Posts: 1558
Joined: 04 Sep 2011, 08:33

Re: Running in Circles - Solved (maybe)

Post by Chris » 13 Sep 2015, 03:49

dteviot wrote:Infrequent checking to see if actor reached a navpoint resulted in Fast moving actors overshooting navpoints between checks, then circle back to try an hit it again. Partial fix: Now test each frame. so long as rate is above about 15 FPS, overshoot should not occur, even for actors with speed of 100.
Perhaps a more robust solution could be used. Maybe instead of comparing the actor's current position with the navpoint on each check, you could compare the actor's path. In other words, construct a line from where the actor was (on the last update) to where they are now, and if that line passes close enough to the navpoint consider them to have reached it; do a point-to-line distance test instead of point-to-point. So even if a large movement causes them to overshoot the navpoint, you'll still be able to tell that they reached it without needing to double-back to it.

dteviot
Posts: 144
Joined: 17 Dec 2014, 20:29

Re: Running in Circles - Solved (maybe)

Post by dteviot » 13 Sep 2015, 21:42

Chris wrote:
dteviot wrote:Infrequent checking to see if actor reached a navpoint resulted in Fast moving actors overshooting navpoints between checks, then circle back to try an hit it again. Partial fix: Now test each frame. so long as rate is above about 15 FPS, overshoot should not occur, even for actors with speed of 100.
Perhaps a more robust solution could be used. Maybe instead of comparing the actor's current position with the navpoint on each check, you could compare the actor's path. In other words, construct a line from where the actor was (on the last update) to where they are now, and if that line passes close enough to the navpoint consider them to have reached it; do a point-to-line distance test instead of point-to-point. So even if a large movement causes them to overshoot the navpoint, you'll still be able to tell that they reached it without needing to double-back to it.
Been there, tried that.
Scrawl veto'ed it.
He was concerned it might result in actors getting stuck in the geometry because they don't follow the path grid sufficiently closely. He had a point. There's places where the path grids are so close to walls that the Actors can brush against walls and get stuck. There's at least 3 in Ebonheart where it happens.

Post Reply