Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 30 31 [32] 33 34 ... 43

Author Topic: Anouncing The PathFinder Project  (Read 98575 times)

CobaltKobold

  • Bay Watcher
  • ☼HOOD☼ ☼ROBE☼ ☼DAGGER☼ [TAIL]
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #465 on: December 28, 2009, 10:01:34 am »

of course to implement as cooled-time and not as a countdown, for one increment is cheaper than N decrements.
Logged
Neither whole, nor broken. Interpreting this post is left as an exercise for the reader.
OCEANCLIFF seeding, high z-var(40d)
Tilesets

Vigilant

  • Bay Watcher
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #466 on: December 28, 2009, 03:40:22 pm »

I don't know if anyone's tackled this but one of the other major slowdowns on DF is when no path exists it keeps trying to find one anyways. What needs to happen is potentially request future requests for that path for some time before allowing searches again.

The game does prevent repeated requests in most cases -- the ones where it doesn't are bona fide bugs, like these:

# 000184 □ [dwarf mode][creatures]   animals locked in a room lag the game heavily from path-finding, additional lag can be caused by assigning them to be butchered
# 000631 □ [dwarf mode][idle behavior]   (Report) forbidding pet passage through the door of an enclosure creates lag

It also doesn't do it sometimes for skulkers and possibly siegers? Sometimes the entrance to my fortress temporarily gets impassable due to flooding, and if there's like 3 thieves, the FPS tanks -_-
Logged

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #467 on: December 28, 2009, 03:44:17 pm »

It also doesn't do it sometimes for skulkers and possibly siegers? Sometimes the entrance to my fortress temporarily gets impassable due to flooding, and if there's like 3 thieves, the FPS tanks -_-

Couldn't find anything in the bug list, but yeah, I think I remember reports of this happening with siegers and HFS.
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Anouncing The PathFinder Project
« Reply #468 on: December 28, 2009, 04:04:20 pm »

Giving each tile a passability group and allowing group linkings at common points of fluctuation would fix that. Having a background thread run when the pathfinder is otherwise inactive, and have the thread reabsorb smaller pockets that haven't been disconnected in a long time might be one way of using inactivity to speed up pathfinding...
Logged
Eh?
Eh!

Impaler[WrG]

  • Bay Watcher
  • Khazad Project Leader
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #469 on: December 29, 2009, 05:36:34 am »

qwertyuiopas:  I've said it before and I'll say it YET AGAIN!  Their are not going to be any processes or threads that steals cycles during 'idle' time.  It's a very very bad design concept and I'm not going to write it.  You seem to be obsessed with the idea of making everything asynchronous and all your posts are some new way to try to shove that concept into this project, give it a rest please.

In other news, I've implemented simple Pawns in Khazad that I can spawn on the map by pressing 'a'.  Each one gets a MovementController object which is created by the Central PathManager, each Controller acts as a personalized access point for Pathing from the perspective of the Pawn which can set a Destination and then repeatedly request its next movement direction without ever being aware of the Path.  I've also begun separating the Controller itself from the path by implementing a PathWalker which is a tiny class that just iterates the Path and abstracts away the internal storage details of the path, most importantly because its read only with respect to the path their will be no conflict if multiple Walkers reference the same Path which could will allow units to share a Path or for an effective PathCache to work without collision risks.
Logged
Khazad the Isometric Fortress Engine
Extract forts from DF, load and save them to file and view them in full 3D

Khazad Home Thread
Khazad v0.0.5 Download

Xgamer4

  • Bay Watcher
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #470 on: January 10, 2010, 01:33:50 am »

Anyone made any progress, outta curiosity?
Logged
insert something mind-blowing/witty here*

Impaler[WrG]

  • Bay Watcher
  • Khazad Project Leader
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #471 on: January 10, 2010, 03:47:17 am »

I've been on a bit of a development hiatus during the holidays and afterwords due to gaming but I'm starting to gradually get back into it.  I could still use some more coders of course.
Logged
Khazad the Isometric Fortress Engine
Extract forts from DF, load and save them to file and view them in full 3D

Khazad Home Thread
Khazad v0.0.5 Download

cooz

  • Bay Watcher
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #472 on: January 10, 2010, 09:41:17 am »

Out of curiosity, could this be relevant to the project?

http://mm.soldat.pl/development-log/937
Logged

PencilinHand

  • Bay Watcher
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #473 on: January 10, 2010, 01:26:06 pm »

The node space used by the author of the code referenced in that link appears to only be about a 40x40, with some experimental tests using a 200x200 node space.


That is something I have seen consistently.  Most pathfinding I have seen considers something like a single level 512x512 node space(~262k nodes) to be the upper practical limit for use(often with only cardinal movement allowed).   Most don't go that high in practice and limit their pathfinding to, at most, the length of one side of the map. 

The smallest DF map possbible is almost 100x100x20(rough numbers for a simple 2x2, about 200k nodes) with a maximum search length 3 or 4 times the length of a side.  I mean, look at dwarf heaven, a 6x6 with like 50 z levels, that is almost 4.5 million possible dwarf passable nodes.  And that is before mega projects get involved, then the sky is quite literally the limit.  DF is working on a scale all its own in most ways, pathfinding included as far as I have seen.

I find I am sometimes bothered by the comparisons drawn between other implementations and the discussions here.
Logged

CobaltKobold

  • Bay Watcher
  • ☼HOOD☼ ☼ROBE☼ ☼DAGGER☼ [TAIL]
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #474 on: January 10, 2010, 10:28:42 pm »

People like nanoforts. So, (48-768)2*30-200+
Logged
Neither whole, nor broken. Interpreting this post is left as an exercise for the reader.
OCEANCLIFF seeding, high z-var(40d)
Tilesets

zchris13

  • Bay Watcher
  • YOU SPIN ME RIGHT ROUND~
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #475 on: January 10, 2010, 10:29:36 pm »

I am going to express my amazement at the amount of nodes now.   :o

EDIT: Possible nodes. My bad.
Logged
this sigtext was furiously out-of-date and has been jettisoned

CobaltKobold

  • Bay Watcher
  • ☼HOOD☼ ☼ROBE☼ ☼DAGGER☼ [TAIL]
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #476 on: January 10, 2010, 10:35:49 pm »

Which will be needed when flying/(under)swimming pathing goes in.

But that's tiles, not necessarily nodes. There are smarter ways. (Also, average map would be 6x6 or so, which would be 288x288x~60 z on your average mountainside?)
Logged
Neither whole, nor broken. Interpreting this post is left as an exercise for the reader.
OCEANCLIFF seeding, high z-var(40d)
Tilesets

PencilinHand

  • Bay Watcher
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #477 on: January 11, 2010, 06:53:05 pm »

Which will be needed when flying/(under)swimming pathing goes in.

But that's tiles, not necessarily nodes. There are smarter ways. (Also, average map would be 6x6 or so, which would be 288x288x~60 z on your average mountainside?)

Every tile is possibly a dwarf passable node if given enough time.  Yes, there are other smarter ways of designating nodes than on a one to one with the number of tiles.  In my opinion, the most useful discussion in this thread has to do with ways of abstracting or limiting the number of searchable nodes. 

However, I worry that efforts to reduce the number of nodes become increasingly less useful the further development goes toward things like invasion tunneling and multi-tile creatures.  Granted, the vast majority of pathfinding is done by dwarfs or dwarf-like creatures now and anything we can do to improve dwarf-like pathfinding will be a great boon to the project(assuming any of this actually gets adopted).  However, I know if we can completely get around the need to maintain a one tile per node map which includes potentially critical information like blocked/unblocked, water, magma, and foor IFF the goal is to provide for ALL pathfinding needs.  Which it appears it is.

Create a flexible BSD licensed C++ path-finding library specialized for grid based systems like that of Dwarf Fortress and able to efficiently handle rapidly changing map geometry and other challenges such as but not limited too multiple travel domains, multi-tile creatures, variable movement cost terrain and path caching.

shadow_slicer gave a very good summery of the problem back at the end of November
If you decide to devote 8 bits for each tile (not for each edge, each tile!) just to determine is this tile passable by movement type x, a 256x256x16 map would require 1MB of memory. If we add ceilings, it goes to 2MB. Note that this is a really small map. A 6x6 I am currently using is 288x288x32, which is 2.5 or 5 MB. Note that this does not include any cost information, and only supports 8 movement types. If you add terrain types or other features then this only gets worse. And, as you said the number of tiles on the map is only going to increase. If you get up to hundreds of z-levels with larger embark sizes, things get nasty very quickly.
Logged

Xgamer4

  • Bay Watcher
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #478 on: January 12, 2010, 12:20:06 am »

shadow_slicer gave a very good summery of the problem back at the end of November
If you decide to devote 8 bits for each tile (not for each edge, each tile!) just to determine is this tile passable by movement type x, a 256x256x16 map would require 1MB of memory. If we add ceilings, it goes to 2MB. Note that this is a really small map. A 6x6 I am currently using is 288x288x32, which is 2.5 or 5 MB. Note that this does not include any cost information, and only supports 8 movement types. If you add terrain types or other features then this only gets worse. And, as you said the number of tiles on the map is only going to increase. If you get up to hundreds of z-levels with larger embark sizes, things get nasty very quickly.

This was talked about earlier, but I don't remember the verdict. Is this actually a problem, though? Dwarf Heaven, mentioned on the last page, was apparently 6x6 gridsize, with tile size around 288x288x50, going off the same numbers for 6x6 that shadow_slicer mentioned. That's 4 - 8MB of RAM. That's a pittance. Most computers in use have 1GB of RAM min, and most current computers come with 3-4GB. 8MB of RAM won't be missed, especially if it helps speed up pathing.

Which I think was the main concern. That it wouldn't actually have any improvement. Is that right?

As a sidenote, there was a link, to github I think, with current development. Does anyone have it, and is it actually up-to-date? I'd like to look at the code and pretend I know what I'm doing before the feeling of being in way over my head sinks in. <_<
Logged
insert something mind-blowing/witty here*

shadow_slicer

  • Bay Watcher
    • View Profile
Re: Anouncing The PathFinder Project
« Reply #479 on: January 12, 2010, 01:35:21 am »

shadow_slicer gave a very good summery of the problem back at the end of November
If you decide to devote 8 bits for each tile (not for each edge, each tile!) just to determine is this tile passable by movement type x, a 256x256x16 map would require 1MB of memory. If we add ceilings, it goes to 2MB. Note that this is a really small map. A 6x6 I am currently using is 288x288x32, which is 2.5 or 5 MB. Note that this does not include any cost information, and only supports 8 movement types. If you add terrain types or other features then this only gets worse. And, as you said the number of tiles on the map is only going to increase. If you get up to hundreds of z-levels with larger embark sizes, things get nasty very quickly.

This was talked about earlier, but I don't remember the verdict. Is this actually a problem, though? Dwarf Heaven, mentioned on the last page, was apparently 6x6 gridsize, with tile size around 288x288x50, going off the same numbers for 6x6 that shadow_slicer mentioned. That's 4 - 8MB of RAM. That's a pittance. Most computers in use have 1GB of RAM min, and most current computers come with 3-4GB. 8MB of RAM won't be missed, especially if it helps speed up pathing.

Which I think was the main concern. That it wouldn't actually have any improvement. Is that right?
Yes, my point was that this (1) was a lower bound/ conservative estimate for memory usage under that architecture and (2) would not significantly increase pathfinding speed.

I later demonstrated that a single bit/two bits per tile was too low to implement the current behavior exhibited by DF. To implement the current behavior you need at least 13 bits/tile (or even 26bits if bidirectionality is not assumed). This pushes the total to 52-208MB, just for the connectivity map. If instead of simple connectivity you want to include movement costs (let's just use 3 bits so we have 8 possible costs), we have 156MB-624MB of memory. And this is simply necessary to achieve the same behavior DF currently exhibits (while supporting 8 movement types).

Further this method is likely to be slow. That 624MB of data is competing with DF data and code for space in the L1 and L2 cache of the processor. It is likely that whenever pathfinding functions are called, the necessary data will not be in the on-CPU caches so we will have to wait at least 100 clock cycles for each read to non-cached data. Then, when pathfinding has finished (or reached a point where it decides to return), DF is likely to be completely purged from the cache so we have another ~100cycle/read delay until the cache fills again.

So yes, representing the connectivity/costs in an explicit table has serious scalability problems. If, however, the pathing library instead had DF calculate the connectivity/costs on demand, this would access the same data that DF normally uses (which is stored much more compactly than is possible in a general-purpose library), keeping it in the cache and avoids both the additional delay and the extra memory consumption. This leaves us with a whole lot of memory left over to do useful things like path caches, connected zones, and multiple hierarchy levels, etc. which will have a positive impact on pathfinding speed.

As a sidenote, there was a link, to github I think, with current development. Does anyone have it, and is it actually up-to-date? I'd like to look at the code and pretend I know what I'm doing before the feeling of being in way over my head sinks in. <_<
The current code base is part of Khazad, so you can find it on Khazad's sourceforge page.
Logged
Pages: 1 ... 30 31 [32] 33 34 ... 43