Skip to content

Features

inkoalawetrust edited this page Nov 12, 2023 · 3 revisions

The KAI library is a host to a ton of features that make it easier and more feasible to create NPCs with advanced and/or intelligent behavior. Most of which are within the KAI_Actor class, or one of its' subtypes, like KAI_BaseVehicle allowing for the easy creation of vehicle NPCs that behave differently from normal monsters.

This page is a disambiguation for some of those features, along with some features that don't necessarily require any of the NPC classes.

The KAI library can have optional support and/or compatibility patches written for it by mods not based on it. And different mods based on it can also interact with each other as long as neither of them has their own full copy of the library, and instead uses it as a mod dependency. For example, my own Smart Marines (Rewrite TBD) and Military Vehicle Pack mods both use the library in this manner, allowing both of them to seamlessly interact with other, with only the KAI library as a shared dependency, which means that only 3 files are required in total.

NPCs made with the KAI library have the ability to determine how dangerous their enemy is, allowing them to react accordingly. For example, a KAI monster may be a lot more brave against an enemy that is only THREAT_NORMAL or below and attack them head on, be more wary and evasive of THREAT_ABOVENORMAL and THREAT_DANGEROUS enemies instead of charging straight at them, and run away in fear from THREAT_VERYDANGEROUS enemies, which are usually bosses like Cyberdemons and Spider Masterminds.

In addition to being able to assess how dangerous an actor is, the library also allows for giving hazard warnings to KAI NPCs to alert them of dangers like incoming attacks. The kinds of information each hazard can contain includes attributes like just how dangerous the hazard is, what type it is (e.g another actor or the environment itself), and where the source of the hazard is, like for allowing the NPC to know where to run away from. What the NPCs actually do with this information is up to the modder.

Wandering.mp4

KAI NPCs move much more smoothly and organically than normal monsters, no longer constrained by being able to only move in 8 cardinal directions. They can move in any direction they need to get straight to their target, and can turn around organically instead of on a dime. No more giant monsters making instant 180 degree turns.

KAI NPCs can be made to fire more intelligently at their enemies, firing at where their enemy will be at when the attack reaches, instead of where the enemy currently is. This allows them to be more accurate with their attacks overall.

The KAI library makes it easier to create entirely custom line of fire and line of sight checks for NPCs through the KAI_LOFRaycast class, which aside from LineTracer's functionality, also includes check functions and variables that make creating new LOF checks easy.

The KAI library allows for the creation of new custom chase functions for replacing A_Chase with. Along with including its' own built-in chase functions. This allows modders to make their own custom chase functions for new NPC types or specific NPCs with very unique behavior.

Clone this wiki locally