RimWorld

RimWorld

166 ratings
Smarter Raider AI
3
4
4
4
2
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5, 1.6
File Size
Posted
Updated
263.814 KB
Mar 11, 2023 @ 9:56am
Aug 14 @ 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://steamcommunity.com/sharedfiles/filedetails/?id=2973997911
Popular Discussions View All (3)
3
Aug 12 @ 3:45am
"Exception in Verse.AI" Error Spam
nanufrog
3
Jul 5 @ 3:48am
1.6 bug possibly yours
moo
0
Aug 27 @ 7:14pm
Mod folder of SRAI empty ?
JOLLY.R [PLS]
220 Comments
pogoman  [author] Aug 26 @ 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
Azerbaijan_Technology Aug 26 @ 10:05pm 
I don't believe the prompt to make preparing raiders attack earlier when shot is working, I'm also not 100% sure if the improved reaction time actually works.
pogoman  [author] Aug 25 @ 3:59am 
yeah i dont have anomaly so havent been able to test shamblers unfortunately. @안녕하세요 any feature in particular you would like toggleable? Some things can already be toggled off like every raid sapping, smart raids can be disabled by setting min tech level to ultra etc
Melon Aug 23 @ 9:02pm 
I think this mod really slowed down shamblers for me. Not sure what causes it but they often stand around doing nothing. All raiders sometimes have moments of idleness but its particularly noticeable in shamblers. Other than that though the mod has been working great.
안녕하세요 Aug 15 @ 11:12pm 
각각의 요소를 활성/비활성 할 수 있게 해주실 수는 없을까요? 그러면 정말 좋을 것 같아요

Could you make it so that each feature of the mod can be enabled or disabled individually? That would be really great.
Nic Aug 15 @ 12:18pm 
oh and one funny observation (not funny as in ha ha), the musket does 29 damage but has 5 sharp pen, the R-6 Charge Rifle has, I think, 12 damage but can pen anything, I can't think of a reason why a round ball fired at you at less than the speed of sound does more damage than literal plasma fired at you over the speed of sound, either way, R-6 rifles rule and muskets drool because of their inability to fire many rounds thus not doing really any suppression nor even having that high of a chance to hit any rounds because there's not many rounds being fired
Nic Aug 15 @ 12:12pm 
with the 7.9s reload time and how close the raider was, he definitely could've got to my pawn before he reloaded so him going after my pawn would've been ideal, I think that an easy fix to this situation is just having the raiders prioritize the guy with a weapon that's right there, then ransack your base, then, I guess, other pawns on the map, funny though that these raiders are addicted to destroying my horseshoe pin like it's crack, but like a chronically addicted crack addict, it's going to get them killed, still funny though, if I were the one making this mod (and even knew how to code and not just change variables in files as the only way to mod, and delete stuff) I would set the priority to destroy the horseshoe pin if it's in the open to be really high, new game mode, protect your horseshoe pin.
Nic Aug 15 @ 12:08pm 
what exactly happened was there was a ruin on the left, a mountain on the right, a ~5 cell gap between the two, and my base below, the raid came from above, I would just wait in the ruins for him to start coming my way so he didn't use his gun to shoot at me (which he switched between weapons really well, no problems there) then once he was decently close and out of cover I would take a pot shot at him then go back behind cover to reload, one time though he didn't run back for cover and just kept on going, I'm guessing it was because I waited extra long for him to get closer and going between the ruins and the mountain where I couldn't shoot him was closer than that other cover
pogoman  [author] Aug 15 @ 2:31am 
actually i think there's a threat point metric per pawn that could be used for this. will investigate
pogoman  [author] Aug 15 @ 1:16am 
@Nic if your pawn was in combat mode and waiting with a musket the raider would have tried to avoid him. It raises an interesting point though, in this instance the raider was technically stronger. I predominantly used to play with CE so any pawn with a gun was always a massive threat. Could add a table of threat levels for different guns in the options. Musket sounds like it would be pretty low down