Skip to content

[Performance] Pathfinding is inefficient to CPU resources.

AendaeronBluescaleAendaeronBluescale Member Posts: 335
edited October 2013 in The Road to v1.2
If several NPCs or player characters have to find a large way around obstacles, the FPS falls, making the game stuttering.

Best example: Firewine bridge; walk over the bridge to the eastern border of the bridge, hoping to encounter enemies below the bridge. Then watch the stutter unfolding as both PCs and NPCs try to figure out a large way around half the area map.

Suggestion: Outsource pathfinding to a separate thread.

Comments

  • sarevok57sarevok57 Member Posts: 6,002
    did you try setting affinity to all your cores when playing the game? that should take all the lag out
  • astralliteastrallite Member Posts: 10
    don't you mean setting affinity to a single core? Trying to run a single-threaded game on multiple cores is more likely to cause lag, not decrease it.
  • AendaeronBluescaleAendaeronBluescale Member Posts: 335
    What I mean is that Beamdog should program a separate threading for pathfinding (essentially make BG:EE multicore compatible)
  • AlkaluropsAlkalurops Member Posts: 269
    I don't think it's as easy as running code in a separate thread. Besides, baldur.exe already uses 12 threads, so it's possible pathfinding already runs in its own thread.

    It seems to me they have more severe performance problems, which could be caused by anything, from algorithmic issues to cache misses.
  • BerconBercon Member Posts: 485
    Implementing multithreading to legacy code base like infinity engine sounds like a plan.
  • SasayakiSasayaki Member Posts: 137
    As a software engineer, if pathfinding is causing lag, it's an algorithmic issue. I've seen A* do crazy good pathfinding in single thread, and I played around with some games where I moved pathfinding into its own thread for performance reasons. In the end using A* was a much better solution.
Sign In or Register to comment.