Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Dwarf Pathing (yes again)  (Read 749 times)

juanoleso

  • Bay Watcher
    • View Profile
Dwarf Pathing (yes again)
« on: May 14, 2009, 12:27:05 pm »

I had an idea last night.  The only time that a dwarf really needs to path to anything is to find how to get somewhere.  Items and places don't "move" so they only need to be path'd to once per job.  I think that civilian dwarves should be mostly just a representation for an action.

For instance
- Urist takes a hauling job
- Urist builds a path to the item and back and writes it to memory regardless of non-block obstacles in the way.
- Urist determines that job should take X game turns
- Urist icon follows the path in memory within the determined game turns
- Urist completes job after X game turns as long as no non-block obstacles interfere

If 200 dwarves are doing a 200 tile job and 3 bytes for every coordinate of the path thats only like 200k of memory which is not much (may not be thinking straight, didn't sleep last night, let me know...).  CPU should go down because dwarves are no longer constantly pathing or checking whats directly around them.

If a non-block obstacle does interfere it would have to trigger the dwarf to perform some kind of action (i.e. a certain radius or area of control for a goblin would trigger a flight response for a dwarf whose next path coordinate falls in the AoC and the path is cencelled).  Also, a civilian dwarf would have to re-path if a block obstacle were created on their path.  I'm no programmer, but I do script and I don't think it would be too hard to check for these things...

feel free to tell me I'm wrong if thats the case.

Thanks

Logged

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Dwarf Pathing (yes again)
« Reply #1 on: May 14, 2009, 12:56:29 pm »

Are you saying that currently, dwarves have to path each time they move?  Because that's not the case.  Generally, after a creature finds a path, that path is stored for the creature to keep using until it reaches its destination (or gets interrupted).
Logged

juanoleso

  • Bay Watcher
    • View Profile
Re: Dwarf Pathing (yes again)
« Reply #2 on: May 14, 2009, 01:43:45 pm »

hmm...yeah...I'll go try and sneak some zzz's somewhere...
Maybe my not so good idea will help someone come up with a better one...
Logged

Drake1500

  • Bay Watcher
    • View Profile
Re: Dwarf Pathing (yes again)
« Reply #3 on: May 14, 2009, 01:52:54 pm »

hmm...yeah...I'll go try and sneak some zzz's somewhere...
Maybe my not so good idea will help someone come up with a better one...

No no, it's a good idea. It's just that the idea's already implemented.  ;D Really, you're just complimenting Toady on his foresight.  ;)
Logged