Skip to content

Mod interoperability

inkoalawetrust edited this page Jul 4, 2024 · 4 revisions

One of the non-gameplay features of the KAI library is interacting with multiple mods that use its' code for their NPCs, and being able to make mods that don't use the library whatsoever be able to maintain partial support without requiring the library as a dependency, below is a list of a few of the ways that the library can and/or is supposed to maintain mod interoperability:

Interoperability between different KAI-based mods

The KAI library can be used like any other mod (Since it is one), which means that you can base your mod on the stock version of the library, which will guarantee that it will be able to interact and support other mods that also use the stock version. That is what I myself (inkoalawetrust) are doing with my own mods that use the library, to maintain compatibility between each other. Ideally by packing the library into a .pk3 archive called KAI.pk3

However, if you want to make your own custom version the library, and/or merge it on your project, like how most GZDoom libraries are used, then you can also do that, though keep in mind that being able to work with other KAI-based NPCs, and resolving class and function name conflicts with the stock library, or other mods that use their own forks of it is up to you in that case.

KAI support for non-KAI mods

Besides being usable as a dependency for other KAI mods. Mods not made with the KAI library can also add optional, partial support for the library through the KAI_DataToken item, which can be used to add certain types of KAI data to non-KAI actors. All without your non-KAI mod being unable to run due to missing classes or methods if the library isn't loaded alongside it.

For more information, check out this guide.

Compatibility patches for non-KAI mods

Continuing from above, another way of adding KAI support to a non-KAI mod could be through an external patch, as opposed to first party optional support on the mod itself. For example, making an event handler that checks a hardcoded list of class names from that mod as they spawn, and gives the matching ones data tokens with hardcoded values in them. Like giving every instance of a custom Cyberdemon in this hypothetical mod a data token with a threat level of THREAT_VERYDANGEROUS.

See also

Clone this wiki locally