RimWorld

RimWorld

180 ratings
Smarter Raider AI
4
4
4
4
2
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5, 1.6
File Size
Posted
Updated
263.814 KB
11 Mar, 2023 @ 9:56am
14 Aug @ 1:20am
107 Change Notes ( view )

Subscribe to download
Smarter Raider AI

Description
Tynan says Rimworld is a storyteller, not a skill test. This is for people who want it to be both.

This mod focuses on reworking the raid AI strategy to be more in line with what a player would do, all whilst attempting to maintain vanilla performance. This is done by leveraging the existing vanilla avoid grid used in smart raids and extending it to incorporate player pawns as well (not just turrets), and forcing it to be always enabled for every raid type.

Summary of main changes:
  • All enemy pawns will now avoid areas your turrets or drafted pawns have line of sight to (yes no more killboxes).
    Note: If a turret or pawn is engaged in a firefight the avoid grid will be disabled for that unit, meaning other raiders will now consider the area safe to advance into. This promotes initial strategic movement of raiders around your defences, but then simulates the chaos of war once the battle commences.

  • If a pawn dies a temporary 1 tile radius avoid grid will appear to tell other raiders to go around if they can. This negates the effectiveness of trap killboxes and stops raiders queueing up for death at any given entrance to your base.
    (similar to Careful Raids mod. Thanks @Nidvinter for suggestion).

  • Any raider with a weapon defined as breachable (set in mod options), will now attempt to breach first (regardless of whether it is a breach or normal raid). By default these are weapons including the keywords "stickbomb, concussion, doom, triple inferno, chargeblast, thermal, thump". i.e. a raider carrying a doomsday will fire it at your walls if there are no available colonist targets.

  • Raiders will prioritise pillaging and destroying colony buildings and will take the safest path to do this. If there is no safe path and they have no breachers then they will sap/attack walls in the safest locations.

  • Raiders will now engage enemies behind impassable cover (i.e. embrasures) within 2-4 seconds of coming into range (vanilla default is up to 8 seconds).

Due to all of the above it is much harder to 'Game' the AI. Strategic defence of the whole colony and not just one entrance is very important.

If you would like to see how the mod works you can toggle show avoid grid in dev mode and then spawn a raid.

Compatibilities:

Can add/remove from save without issue.

Incompatible with Careful Raids.

Incompatible with Breachable Embrasures - An AI-Behaviour Change (this mod fixes the same issue)

Compatible with Combat Extended (load this mod after).

Partially compatible with CAI (load this mod before). CAI does not use the avoid grid generated by this mod, so only SRAI's breaching and sap changes work while both are loaded.

Will be flagged as incompatible with Line of Sight Fix. The code causing the conflict is an optional performance fix for Combat Extended than can be disabled in the in-game options. If you aren't running Combat Extended this option will be hidden and disabled by default, however regardless of the state of the setting Rimpy will still complain, as the code exists in the dll. But there won't actually be a conflict unless the option is specifically enabled. The code itself dynamically redirects patches to the los function to use vanilla code in certain situations as the CE los function is poorly optimised.

Github: https://github.com/pogoman/Smarter-Raider-AI

========================================

My other mod:
No Foreign Xenotype Wanderer Join Events
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=2973997911
Popular Discussions View All (4)
3
12 Aug @ 3:45am
"Exception in Verse.AI" Error Spam
nanufrog
3
5 Jul @ 3:48am
1.6 bug possibly yours
moo
1
4 Sep @ 12:58am
Mod folder of SRAI empty ?
JOLLY.R [PLS]
229 Comments
feihuxia 21 Oct @ 3:07pm 
could you delete a temporary 1 tile radius avoid grid,in another page downloader?
Vril 19 Oct @ 11:31am 
Doesnt hold a candle to CAI mod, but its better than vanilla at least.
mtjoel 19 Oct @ 7:43am 
Good alternative for CAI on 1.6 since unfortumately they likely wont be updating it
Eddlm 16 Oct @ 3:52am 
Could you make the "avoid tile if someone died here" a configurable radius? A bigger radius may make the pawns more dynamic, would love to try it. Also is there any possibility that the "priorise pillaging" can be made configurable? As in, priorise destroying stuff, or kidnapping, or killing. Out of curiosity.

And thanks for your work!
Vintage Fruitcake 2 Oct @ 8:27pm 
https://gist.github.com/HugsLibRecordKeeper/a79f29bfa3ef4d048a155535b2e27c5e
Full log if you need it. I'm running a fair number of mods, so I only gave a pastebin of the relevant NRE.
Vintage Fruitcake 2 Oct @ 8:24pm 
https://pastebin.com/S7faGNUG
I think there's an NRE issue caused by your mod when a pawn on a map that's unloaded dies. Those world pawns should still be loaded and HeDiffs are still ticking, and some HeDiffs in my example killed a pawn and caused a NRE issue.
LikewiseHH 22 Sep @ 12:09am 
Hi pogoman,

Great mod! Quick question: I observed that raiders often dont reload what entering a map. So they rush into combat and only then do the reloading. Could this be fixed on your end? Playing with Combat Extended but aside from that there should be no mod messing with the raider AI.

Thanks!
艾青 20 Sep @ 8:40pm 
Is it compatible with the real fog of war?:steamhappy:
Azerbaijan_Technology 30 Aug @ 7:32am 
It's always nice to know how the mod actually works, appreciate it.
pogoman  [author] 26 Aug @ 11:47pm 
The current modifier i went with is there's an 8% chance on a raider taking damage for the wave to attack, so it's still a little random. Previously 30% of the wave had to die. If you open up dev mode you can test, usually takes about 5-6 instances of damage before they attack. Improved reaction time depends, if they are breaching they are less likely to react to attacks as they have a mission. This is in the base game and i left it as if they can breach your walls quickly it's of higher strategic importance. Might be you arent talking about breachers here so let me know more details