Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Stop plant-trampling the easy way!  (Read 2647 times)

PTTG??

  • Bay Watcher
  • Kringrus! Babak crulurg tingra!
    • View Profile
    • http://www.nowherepublishing.com
Stop plant-trampling the easy way!
« on: November 11, 2008, 11:49:56 am »

Simple: have all shrubs that have been designated for harvesting also become designated as 5 traffic points higher than normal, so that given a choice, dwarves step around them. It's kind of frustrating to see a line shrubs in the middle of a forest be trampled down just because they are in the one, ant-like line the dwarves walk on.

Since this uses the normal traffic designations system, there should be no extra lag.
Logged
A thousand million pool balls made from precious metals, covered in beef stock.

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #1 on: November 11, 2008, 03:02:01 pm »

Elegant, I like it.
Logged

Grek

  • Bay Watcher
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #2 on: November 11, 2008, 03:22:49 pm »

Silk too.
Logged

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #3 on: November 12, 2008, 02:36:08 pm »

For tower-caps and saplings on my doorstep, I manually set their tile as Restricted... but adding this (or some version) as a core pathing feature would make forests a tidbit more interesting.
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!

Tormy

  • Bay Watcher
  • I shall not pass?
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #4 on: November 12, 2008, 03:50:15 pm »

Yep, good idea.  :)
Logged

Joseph Miles

  • Bay Watcher
  • DF isn't a game, its a way of life!
    • View Profile
    • http://bugger92.proboards91.com/
Re: Stop plant-trampling the easy way!
« Reply #5 on: November 12, 2008, 04:06:04 pm »

Maybe make it higher than 5, just in case you get a really badly organized map and that 5 wouldn't change the pathing. But, yeah, I like it.
Logged
Cog - He's the new Urist.
Yes they are a bunch of drunken unstable retards, but they're MY drunken unstable retards, and I will take care of them.
It could be worse, that cat could be alive.

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #6 on: November 12, 2008, 04:17:33 pm »

For tower-caps and saplings on my doorstep, I manually set their tile as Restricted... but adding this (or some version) as a core pathing feature would make forests a tidbit more interesting.

Hmm.  Automatically restricting saplings makes sense, but this suggestion wouldn't cover it, since you can't designate saplings for anything.  Maybe this could be implemented instead under Orders -- "Dwarves avoid trampling harvestables," or something?
Logged

Dame de la Licorne

  • Bay Watcher
  • Cats? Check. FPS? Uh-oh...
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #7 on: November 12, 2008, 04:23:21 pm »

Maybe this could be implemented instead under Orders -- "Dwarves avoid trampling harvestables," or something?

But saplings also aren't classified as harvestable, so the order should probably be "Dwarves avoid trampling shrubs/saplings", and have it toggle between this setting, no avoidance (maybe default?) and "Dwarves avoid trampling shrubs (or harvestables)".  Since right now tramping through fields doesn't seem to damage the crop yields, it may sound better to have the third toggle be shrubs, but if Toady ever changes the code so that field tramping does damage the crop yield, "harvestables" would be a better option for the third toggle.  Comments?
Logged
If software was real world, then it'd be something equivalent of hitting a nail with a hammer and having a building collapse on the other side of town.

Don't worry people, sometimes -moments occur

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #8 on: November 12, 2008, 04:35:52 pm »

^^^ Yeah, I meant "things that are harvestable or might be eventually," sorry.  You could break it down into narrower types of potentially harvestable things, I guess, but I'd be content with all-or-nothing.
Logged

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #9 on: January 20, 2009, 06:16:37 pm »

Bumping this thread because really it's such a great, simple idea.
Logged

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #10 on: January 20, 2009, 06:26:48 pm »

It's at least a little complicated.  I think it'll cost two bits per tile to implement, or 415k of memory on a 6x6 map that's all dug out.  When a harvestable grows, you store its current pathfinding cost into two bits, and overwrite its value on the map with the shrubbery cost (if higher).  When the harvestable is removed (harvesting, death, etc), you restore the original values.  If the player designates a new path cost overtop of your shrubberies, just store that new value into the the tile's cost and into the 'backup', so it'll keep the new value when the shrubbery goes away.

You kinda have to do it that way.  Because if you didn't change the pathfinding cost, and instead checked to see "is there a shrubbery here" every step of pathing, you'd see slowdowns.  Pathing loops can be made -really- tight, and adding even a single extra check for each tile is something that you don't want.

And yeah, even deep underground needs to be checked for shrubberies, in case you found spores and have a tree farm somewhere!
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #11 on: January 20, 2009, 06:35:05 pm »

Aren't traffic weights already allocated in the fixed-size tile data though?  I could swear I'd seen a couple bits reserved for those on a memory hackers' chart.
Logged

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #12 on: January 20, 2009, 06:40:43 pm »

Yeah--Right now there's two bits (or should only be two bits, at least) for traffic.  If you want your shrubs to -temporarily- change the traffic cost, you need two MORE bits to back up your pre-shrub values.

Otherwise, when you restrict the area around your carp-filled death pond to keep dwarves from going near, a shrubbery that grows in that area and then dies will reset that square to normal traffic.  And shrubs that grow on a primary, high-traffic footpath will reset their squares to normal too.

Remember, every optimization you can add saves time.  That's why there's a flag on every tile that says it's occupied or not, instead of having to run through the list of critters in that square--checking one flag instead of a bunch of critters is faster.  And if you back up old traffic values, you don't have to check ANY new flags.
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

Mel_Vixen

  • Bay Watcher
  • Hobby: accidently thread derailment
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #13 on: January 20, 2009, 06:46:52 pm »

Well the knackpoint lies in the pathingalgorithm.

IIRC it checks the Pathingcosts for each tile(which already are part of the the Map so no new Bits) on every pathfinding you just have to tweak in an additional check if theres a shrub or Sappling which should be quit easely.
« Last Edit: January 20, 2009, 06:51:11 pm by Heph »
Logged
[sarcasm] You know what? I love grammar Nazis! They give me that warm and fuzzy feeling. I am so ashamed of my bad english and that my first language is German. [/sarcasm]

Proud to be a Furry.

Footkerchief

  • Bay Watcher
  • The Juffo-Wup is strong in this place.
    • View Profile
Re: Stop plant-trampling the easy way!
« Reply #14 on: January 20, 2009, 06:48:31 pm »

Oh, I see your point.  You could do it with just one extra bit though -- a "trample-able thing in this tile" flag that tells the pathfinder to ignore the tile's own traffic weight and use a global value instead, or pick the higher of the two or something.  This would prevent you from doing something fancy like automatically assigning traffic weights that vary based on plant type, but that's not much of a problem.  Also, I think the tile structure will have some free bits anyway now that splatters are getting shifted to a dynamically allocated system.
Logged
Pages: [1] 2