Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Simple idea for improving enemy siege AI  (Read 692 times)

Skullsploder

  • Bay Watcher
    • View Profile
Simple idea for improving enemy siege AI
« on: July 14, 2014, 04:57:11 am »

I know the Great Toad plans on implementing a system whereby goblins don't wanna walk down the same trap filled corridor that just automatically turned the leader of their squad into finely diced bits, but, in lieu of or in addition to that, I thought why not add in a simple way of interfacing items and kill locations with the pathfinding system.

That is: If there is a goblin corpse sitting on a tile, the pathfinding algorithm for goblins treats that tile as costing an extra 9 points to move over or something, and as, over time, goblins (or humans, or elves) bring back reports of your specific fort to their civilisation, pathfinding costs where goblins die slowly accumulate. So you could have where, if a goblin makes it out of a siege and off of your map alive, he spreads his rumours/reports to his superiors on the deadly layout of your fortress, and, as a result, the pathfinding cost for every tile on which a goblin died increases by one. Over time this accumulates until the +large, serrated adamantine disk+ filled trap hallway no longer seems a better route to the trade depot than the three tile wide wagon route that winds around the mountain and back.

It fits in with the narrative (i.e. rumours of a place/hall/bridge/gate that is death to goblins/humans/elves slowly builds up), and it wouldn't cost any in FPS, as we can already assign our own pathing costs to tiles with the designate tool, with no cost to FPS (in fact, if done right, it actually increases your FPS).

Also, we already know that the engine can deal with different pathing costs for different tiles for different creatures because the traffic designations you the player applies only affects the dwarves and not members of other civs.

Thoughts? I personally don't think this would be too difficult to implement, and given that you generally don't have hundreds of goblins dying in the same instant, I don't think running an extra line or three of code on a goblin's death would be too taxing on the hardware.
Logged
"is it harmful for my dwarves ? I bet it is"
Always a safe default assumption in this game 

Deepblade

  • Bay Watcher
  • Tholtarmid
    • View Profile
Re: Simple idea for improving enemy siege AI
« Reply #1 on: July 14, 2014, 07:18:55 am »

Would removing the traps reset this counter?
Logged
Deepblade's Standardized Creature Parts, for when you're pissed about all the different types of animal products there are.

Skullsploder

  • Bay Watcher
    • View Profile
Re: Simple idea for improving enemy siege AI
« Reply #2 on: July 14, 2014, 07:42:55 am »

No, the counter wouldn't be linked to the traps specifically, but rather permanently attributed to the location of unit deaths, in the same way as marking a traffic designation permanently assigns the marked area as having different pathing cost. The same would apply if you'd built a drowning chamber, minecart shotgun... it would eventually even lead to goblins avoiding coming into range of your marksdwarves on the battlements until absolutely neccessary if you'd opted for a more traditional castle type design.

That said, I just realised it would probably be best to have deaths mark out a 3*3 area rather than a 1*1, else enemies would still find shorter paths through the killing fields.

Also, a really determined player could get around this by carving a new trap hallway for every single siege, but, honestly, even though this is a small and easily subvertible tweak I think most players would find it refreshing for enemies to adapt over time to their defensive layouts.
Logged
"is it harmful for my dwarves ? I bet it is"
Always a safe default assumption in this game 

FrankMcFuzz

  • Bay Watcher
  • Accomplished Cat Cooker
    • View Profile
Re: Simple idea for improving enemy siege AI
« Reply #3 on: July 14, 2014, 08:54:37 pm »

No, the counter wouldn't be linked to the traps specifically, but rather permanently attributed to the location of unit deaths, in the same way as marking a traffic designation permanently assigns the marked area as having different pathing cost. The same would apply if you'd built a drowning chamber, minecart shotgun... it would eventually even lead to goblins avoiding coming into range of your marksdwarves on the battlements until absolutely neccessary if you'd opted for a more traditional castle type design.

That said, I just realised it would probably be best to have deaths mark out a 3*3 area rather than a 1*1, else enemies would still find shorter paths through the killing fields.

Also, a really determined player could get around this by carving a new trap hallway for every single siege, but, honestly, even though this is a small and easily subvertible tweak I think most players would find it refreshing for enemies to adapt over time to their defensive layouts.

Once Toady implements actual sieging (I believe ladders and tunneling is in the cards), this would be a very useful feature. Because, for example, today one person might not have multiple entrances, resulting in goblins getting scared of the single entance and reducing siege chance or confusing pathing, but regarding this formula if they can tunnel in, they will tunnel into various locations that have the lowest points (IE, not into the barracks or above magma), resulting in a more interesting/challenging/super deadly siege.
Logged
Urist cancels rest injury: Too injured