Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Interrupted by enemy bug  (Read 654 times)

TheSilverHammer

  • Bay Watcher
    • View Profile
Interrupted by enemy bug
« on: December 29, 2007, 02:31:00 pm »

I am going to call this a bug and it is a huge problem.

If an enemy is anywhere visible, all civilians become paralyzed with fight and will do NOTHING but be interrupted and eventually die.

My last example of this was a beak dog which fell into a river (and didn't drown).  He should have been invisible since he was only able to be seen by going one z level down.   Basically no one should have known he was there, yet my entire civilian population became idle because the river was near a common path and couldn't do anything include eat or drink.   After getting some archers to kill the thing suddenly all the civilians unlocked and started operating normally.

I think there is a simple fix for this that isn't CPU intensive.   Nobody should be 'interrupted' unless they creature is right next to them on the same Z level OR is attacked by a creature who uses a ranged attack.

A more complex fix which I wouldn't suggest because it might cause a huge amount of lag is line of sight checks (which are obviously not happening right).   An efficient way to handle this might be to just do a line of sight check from the enemy's point of view and if it can see a dwarf then the dwarf can see it.   This way you may cut the number of line of sight checks down considerably.

Finally, even if an enemy is visible, the AI shouldn't lock up a dwarf.  What seems to be happening is that a dwarf's task is removed, then the next frame causes it to re-assign a task (usually the same one), which in turn is interrupted ending in an endless cycle.

I would suggest that certain task be considered uninterpretable, such as moving, health care, medicine, eating and drinking, and such.   I would also suggest that an interrupted task is changed to a 'move' to a safe location task immediately instead of simply unassigning it and allowing the dwarf to pick a new task.

Finally, if a task is in a threatened area, like a corpse or item or whatever, those tasks will be flagged as threatened and will NEVER be assigned until they are not threatened.  Similarly some tasks can have a 'safe' flag on them, meaning it is know that the area is 'safe' even though a monster might be 10 feet away.  A pike-man one tile below or on the other side of a 1 tile wide stream isn't a threat.

Logged

dreiche2

  • Bay Watcher
    • View Profile
Re: Interrupted by enemy bug
« Reply #1 on: December 29, 2007, 02:44:00 pm »

My two moneys: While I agree that there could be some more sophisticated mechanisms to keep dwarves away from threatened areas, or to get them to go through areas which are not really threatened at all (ground hog across a channel), I don't know if I'd call it a "huge problem" - after all your archers solved the problem.

Also, I actually do think that line of sight checks are performed. If something is one z-level down and you get close to it, you can see it - otherwise, how could your archers have shot the enemy?

Logged

Paul

  • Bay Watcher
  • Polite discourse with a dash of insanity.
    • View Profile
    • Need an affordable website? I can help.
Re: Interrupted by enemy bug
« Reply #2 on: December 29, 2007, 03:48:00 pm »

It definitely needs some tweaking. I've been trying to build big residential complex tower above ground, and a few levels up I started getting CONSTANT canceling of building the tower when the dwarves got to the top and saw various wild animals far below across the map. The only way I managed to finish the tower was to have a military force stationed across the map to kill everything that wandered by and reactivate all the suspended wall sections over and over and over until I managed to get the outer wall of that level up. A giant eagle roamed into the map and I had to stop construction for months until it finally wandered off, since none of my marksdwarves managed to shoot it down.

It's at the center of a 3x3 site, so I guess everything that wanders by is "in range" for scaring the dwarves even though they are way above anything that they see and nothing could even get to them.

Logged
Do you like Science Fiction? I'm writing the Weaveborn Saga over on Royal Road and my website. Link

dreiche2

  • Bay Watcher
    • View Profile
Re: Interrupted by enemy bug
« Reply #3 on: December 29, 2007, 04:58:00 pm »

hm yeah maybe a more sophisticated algorithm could use line of sight to start the fear check, and then consider the amount of tiles it would take to reach the enemy (i.e. *around* channels, not through closed doors, etc) to decide whether the fear reaction is actually triggered.

Maybe with special rules for ranged weapons, very scary monsters, fearful dwarves, etc...

Edit: although a roaming giant eagle is probably a pretty good reason to avoid construction work on a tower  :)

[ December 29, 2007: Message edited by: dreiche2 ]

Logged

TheSilverHammer

  • Bay Watcher
    • View Profile
Re: Interrupted by enemy bug
« Reply #4 on: December 29, 2007, 08:10:00 pm »

It is a huge problem when I have 80 dwarfs who will not move until the monster is gone.   At the time my military took it sweet time to respond because they were tired and thirsty and wanted to eat, drink and sleep.   I full 'season' went by where my dwarfs were doing nothing.  I could not get them to move no matter what, even forbidding them to be outside wouldn't move them.

Even after I got them to move, about 20 of them died from thirst or hunger because they starved while drinking, or died from dehydration while they were sleeping.

I loose more dwarfs from this kind of thing opposed to actual deaths from monster attacks.  The solution needs to be more then just a line of site issue.  At a minimum, if a dwarf is scared of a monster, the dwarf needs to run away to safe spot and the task it was trying to do should be moved to the bottom of the priority for all dwarfs. If they were trying to eat, then after they move to a safe area, they should select a new food object instead of going back to the same threatened one over and over.

Logged

Helmaroc

  • Bay Watcher
    • View Profile
Re: Interrupted by enemy bug
« Reply #5 on: December 29, 2007, 08:29:00 pm »

quote:
Originally posted by dreiche2:
<STRONG>My two moneys </STRONG>

Took me a second to get that.

Logged

Greenwolf

  • Bay Watcher
    • View Profile
Re: Interrupted by enemy bug
« Reply #6 on: December 30, 2007, 12:08:00 am »

i had a thought on this one.

what about, rather than having dwarves walk into danger and then run away in fear, we make them avoid it in the first place.
dangerous creatures could produce a 'room' effect around themselves, spreading to something like the nearest 5 or so tiles around them that they can access(perhaps variable by creature/ranged weapon).  All tiles covered in the creature's area of influence would be considered inaccessible to civilians, same as a magma leak would do.

This way, dwarves would simply cancel/suspend tasks that are inaccessible due to the enemy, and move on to something else, the same as they would after a cave-in, locked door, or flood.  Life would go on, and dwarves wouldn't wander blindly into the midst of goblin archers.

The fear code could of course be left in, but perhaps only for ambushes, when a critter jumps out and scares a dwarf who happens to be walking by on business.

Logged

penguinofhonor

  • Bay Watcher
  • Minister of Love
    • View Profile
Re: Interrupted by enemy bug
« Reply #7 on: December 30, 2007, 12:13:00 am »

There's a tree I am now completely unable to cut because whenever a dwarf decides to try and cut it, there's this sea lamprey all the way across the 25-tile wide river that's 4 z-levels below the tree. I don't like that.
Logged