边缘世界 RimWorld

边缘世界 RimWorld

155 个评价
Drafted AI
4
6
2
2
2
   
奖励
收藏
已收藏
取消收藏
Mod, 1.6
文件大小
发表于
更新日期
610.321 KB
8 月 11 日 上午 5:32
9 月 21 日 下午 12:49
27 项改动说明 ( 查看 )

订阅以下载
Drafted AI

描述
Automate micromanagement for pawns when they are drafted, while considering friendly fire avoidance, cover, lines of sight, enemy weapons, and more.

Heavily inspired by Search and Destroy and Avoid Friendly Fire



Detailed Description
Adds a toggleable gizmo to your pawns when they are drafted. When ON, the pawn will:

If ranged weapon equipped:
  • 1. If mod option "Respect Allowed area" is on, move to allowed area.
  • 2. If closest hostile is further away than the pawn's weapon range, move towards the closest hostile.
  • 3A. If a hostile IS within weapon range, the pawn performs a search. The search assigns a score to potentially good positions. The score is based on several things:

    • Estimated damage taken from all hostiles:
    - For ranged hostiles, this takes their shooting skill and weapon stats into account, as well as the position's cover, to compute DPS taken (this is totally accurate to what in-game says).
    - For melee hostiles, this similarly computes their effective DPS, their distance to the position, and their movement speed, and combines it into a value that is interpreted as DPS taken. This is further multiplied by "Hostile Melee Respect," which can be changed in mod options.

    • Estimated effort to get to that position from where the pawn currently is. This takes the pawn's movement speed into account. This is further multiplied by "Walking distance penalty weight," which can be changed in mod options.

  • 3B. After a list of positions with scores is generated, final checks are run to find an acceptable one:

    • Closest enemy distance is between 2 cells and the pawn's weapon range.
    • It's not in the friendly-fire zone.
    • It can actually be moved to (not a chair, chunk, etc.) and no other pawn is already pathing there.
    • The pawn can actually shoot a hostile from there, without risking friendly fire to other pawns, animals, or mechanoids you own. THIS is where MOST checks fail in practice!

  • 3C. If no acceptable position is found in the search, the decision on what to do next depends on WHY it didn't find anything. If no hostile was found, it's probably behind a wall, so we just move closer to it. If an angle to shoot a hostile from was found, but there was friendlies in the way, regroup with the others.
  • 4. If the best position found IS the current position, the pawn will choose a target to shoot. It checks every hostile in range to find the one it has the highest accuracy against, while also not risking friendly fire. If no target is acceptable, the pawn regroups.

If melee weapon equipped:
  • 1. If mod option "Respect Allowed area" is on, move to allowed area.
  • 2. The pawn checks every hostile, starting with the closest. It will move to attack the first one it can reach without going outside its allowed area or entering a friendly-fire zone.
  • 3. If no acceptable target is found, the pawn regroups with other drafted AI-pawns.



Player Controls & Options
Pawn-Specific Options Gizmo:
Adds an additional gizmo for changing a pawn's default behaviour:
  • I avoid FF from others: The pawn will avoid friendly fire zones. Could be useful to turn off for melee pawns who need to charge through a firing line.
  • Others avoid risking FF on me: If turned off, other AI-controlled pawns will accept this target potentially being hit by missed shots(friendly fire).
  • I reposition to minimize damage from enemies: Default on, but could perhaps be useful to turn off for Minigun wielders that are supposed to hold their ground even if very exposed to enemies

Mod Options:
  • Adds a gizmo to most things to tag it as a forced "fake" hostile. Useful for destroying insect eggs or hives after a big fight.
  • Ignore fleeing hostiles. With 3 modes: Never | Ignore when active threats (default) | Always ignore
  • Enable Friendly Fire avoidance systems. On by default, if turned off, all friendly fire options will be hidden, and all functionality relating to friendly fire avoidance disabled.
  • Ignore forced targets while other threats exist. Off by default
  • Respect Allowed area: If on, the AI uses the same "Allowed area" for the pawn as when it's undrafted. Useful for defending a base. (Off by default)
  • Extinguish fires on burning friends. With 3 modes: Off | Drafted only(default) | All
  • Melee pawns behave like bodyguards: Melee pawns will focus on defense rather than offense. They will try to stay back and out of the way of ranged pawns until enemies get too close
  • Allow shooting near melee-attacked friends: If a pawn gets targeted by a nearby hostile using melee-attacks, allow AI-controlled pawns to take risky shots to help. Will show an "Allow FF" text on a pawn when this is activated. (Off by default)
  • Update interval: The AI's "reaction time" in ticks (60 = 1 second). Lower is better but more performance intensive.
  • Number of cells to search: The budget used in the detailed search (step 3A). Higher is better, but more performance intensive.
  • Walking distance penalty weight: How much to prefer staying close to the current position.
  • Hostile Melee Respect: Higher values will make ranged pawns stay further away from melee hostiles.
  • Draw FF-zone: Visualizes the friendly fire zone for selected pawns.
  • Draw Search-zone: Visualizes the area the AI searched for a better spot for selected pawns. Warning: Big performance impact



Troubleshooting & FAQ
Q: My pawn isn't shooting at an enemy! Is the AI broken?
A: Almost certainly not! The AI is extremely cautious and is likely holding fire for a very good reason. The most common reasons are:
  • Friendly Fire: This is the #1 reason. Another friendly pawn or animal is in the potential line of fire. The AI will try to reposition instead of taking a risky shot, but sometimes no angle is found and the pawn will just not shoot. Use the Pawn-Specific Options Gizmo to change it.
  • Target is Fleeing: By default, the AI will ignore fleeing targets to focus on active threats. You can change this in the Mod Options, or select the fleeing enemy and mark them as a "Forced target".



How to Debug
If you believe you've found a bug or the AI is behaving strangely, you can use these built-in tools to help diagnose the problem.
  • Draw Search-zone: Enable this in the Mod Options. When you select a pawn, it will draw a colored overlay on all the cells the AI "thought about" when deciding where to move. This can be useful to quickly visualize the situation from the pawns POV.
  • Pawn Action Log: This is the most powerful tool. First, enable Developer Mode in the vanilla game options. A new debug gizmo, "Drafted AI DEBUG: Print PawnLog," will appear on your drafted pawns. Clicking it will print the pawn's last 10 AI decisions to the debug log, explaining why it chose to move, shoot, or wait.
If the bug is for a specific pawn, in a specific situation. Clicking "Print PawnLog", copying it from the debug log and paste it to something like https://justpaste.it/ could be of great help to me.
Faster help:
[discord.gg]



Known Limitations
  • The AI is optimized for open spaces. In very tight indoor corridors, manual control is often superior.



If you enjoy this mod, buy me a coffee!
Support me on Ko-fi[ko-fi.com]
190 条留言
MoreGamesToPlay 11 月 25 日 下午 2:23 
They also do not seem to be taking in account the final weapon range value when trying to shoot at an enemy and just stay too far from an enemy to shoot them.
MoreGamesToPlay 11 月 25 日 下午 2:20 
A thing I've noticed is my pawns forming small groups as they move and constantly walking infront and behind eachother, slowing them down and they do this while fighting too, which causes them to back up from the target/not shoot. This happens even when the friendly fire avoidance is turned off
kev675243 11 月 3 日 下午 1:28 
besides pawns with longer aim time range weapons constantly switching targets, is it possible to adjust what's considered a fleeing enemy? With run and gun ranged units still fight back and raiders with mechanoids just linger on the map, still causing trouble
Limestone Slab 10 月 19 日 下午 2:13 
Have you considered making a lite version of this for raiders?
Droider 10 月 19 日 下午 12:16 
2 small questions.
1. Does this work with Run and Gun?
2. A friend told me this makes abilities activate automatically like raider impids, is this correct? I didnt see anything about that in this page.
kev675243 10 月 17 日 下午 11:54 
At least before they get close enough or enough of my pawns form a firing line
kev675243 10 月 17 日 下午 1:37 
I've noticed the pawns seems to have a hard time sticking to a single target in a horde, causing them to continuously switch targets and not shooting
Dealer Mangan 10 月 17 日 上午 12:00 
Could you please add a toggle to the bottom right menu to hide the gizmos when selecting a pawn?
Ace ⛟ 10 月 7 日 上午 1:19 
Would it be possible for you to increase the max "Update interval" From 60 ticks to 120 ticks. I believe if there was at least a 90 tick pause between updates it would give pawns enough time to finish reloading ammunition with Yayo's Combat 3.
Romara 10 月 6 日 下午 6:07 
I REALLY like how this works save one feature:
When I land on a new area and turn it on, drafted pawns just go into hunter killer mode, seeking out EVERYTHING on the map. Is there a way only react to enemies in a smaller area around themselves, or maybe off the last location they were assigned to?

I love how they react, for the record, I just wish I could set some passive guard rails that werent based on area management.