Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: A* search caching  (Read 1205 times)

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
A* search caching
« on: September 08, 2008, 02:13:28 pm »

I'm building a lot of bedrooms all at once.  The beds are all in a single carpenter shop, the doors are in two glass furnaces.

There is an annoyingly long delay between choosing the location and selecting the furniture.

I suspect that the delay is in the A* search.

My suggestion is, if an item being searched for is in the same place as a previously searched-for item, just reuse that path information.

I think that the extra CPU time maintaining the cache would usually be much less than the time saved by not repeating the same A* search over and over.
Logged

Align

  • Bay Watcher
    • View Profile
Re: A* search caching
« Reply #1 on: September 08, 2008, 05:18:06 pm »

I'm sure there's some reason common paths aren't saved currently, updating only when possible obstructions could arise.
Logged
My stray dogs often chase fire imps back into the magma pipe and then continue fighting while burning and drowning in the lava. Truly their loyalty knows no bounds, but perhaps it should.

Idiom

  • Bay Watcher
  • [NO_THOUGHT]
    • View Profile
Re: A* search caching
« Reply #2 on: September 08, 2008, 07:08:18 pm »

Is the cache faster than the CPU recalculating it? How many paths can you save before you take up serious memory amounts?  What of ever changing path obstacles?
Logged

Granite26

  • Bay Watcher
    • View Profile
Re: A* search caching
« Reply #3 on: September 09, 2008, 08:29:35 am »

I think he's talking about during a single game pause.  As soon as the game starts running again, throw them away.