Custom AI
Information about how to create and manage custom AI variants.
Creating Custom AI - decls
This is an ADVANCED GUIDE. You are expected to have a decent understanding of decls, textures, and entities.
See the Following Books Before Proceeding
Basics
For starters, do all of your editing on an existing AI, so you know what the results will look like before you spend a large sum of time managing an entirely new AI variant.
For your custom AI, you want to copy all the decl files that will be changed. The entityDef file is the most important and mandatory for almost all custom AI. Paste the vanilla decls into a resource patch with a very high priority. Patch priority changes between each update, so you will most likely need to change it after each update. As of Update 6.66 rev 1.1, it is recommended to use e6m1_cult_horde_patch1, e6m2_earth_horde_patch1, or e6m3_mcity_horde_patch1.
Be sure to rename the decls too, so they do not replace properties of the vanilla AI.
After making changes to the decls, you will need to link them to the other modified decls if necessary. Make sure to do so for all of the modified decls. For example, to link the demon's FX, go to the entityDef file and change:
fxDecl = "character/gargoyle/gargoyle";
to
fxDecl = "character/stonegargoyle/stonegargoyle";
The stonegargoyle FX decl is a modification to the vanilla gargoyle decl.
For every added asset, you will need to add them to the EternalMod\assetsinfo JSON file. This must be done in BOTH the directory that contains all the added decls AND the level patch that holds your entities file(s). Here is an example:
e6m3_mcity_horde_patch1\EternalMod\assetsinfo\e6m3_mcity_horde.json
{
"assets":
[
{
"name":"ai/fodder/stonegargoyle",
"mapResourceType":"entitydef"
},
{
"name":"character/stonegargoyle/stonegargoyle",
"mapResourceType":"fx"
},
{
"name":"samplePath",
"mapResourceType":"sampleResource"
}
]
}
e5m2_earth_patch2\EternalMod\assetsinfo\e5m2_earth.json
{
"resources":
[
{
"name":"e6m3_mcity_horde_patch1.resources"
}
],
"assets":
[
{
"name":"ai/fodder/stonegargoyle",
"mapResourceType":"entitydef"
},
{
"name":"character/stonegargoyle/stonegargoyle",
"mapResourceType":"fx"
},
{
"name":"samplePath",
"mapResourceType":"sampleResource"
}
]
}
samplePath & sampleResource are not actual assets.
In this example, the added assets are in e6m3_mcity_horde_patch1 because that resource patch has a very high priority and a low resource amount. The Stone Gargoyle custom AI will be loaded into the highest Reclaimed Earth patch (e5m2_earth_patch2).
When you are adding a new decl that is a variation of an existing file, if possible, always make it inherit from the vanilla demon counter part. This is especially important for the entityDef and md6def. A lot of The Ancient Gods Part 2 and Spectre demons do this, so use them as reference.
Some decls, such as FX, cannot be inherited.
Creating Custom AI - entities
See Creating Custom AI - decls before proceeding
idAI2 - Reference
Reference the original idAI2 file for the vanilla AI and copy it into a separate text file. Like the the entitydef decl file, this links all the decls together in a usable format. You will need to copy all of the decl references in this entity, just like for the entitydef file.
Make sure to inherit from the added entitydef decl.
materialRemap is used to apply the custom textures to the new demon. Under renderModelInfo, a materialRemap parameter can be added (if it does not already exist). The following is an example.
renderModelInfo = {
model = "md6def/characters/monsters/gargoyle/base/gargoyle.md6"; // base gargoyle model to use
materialRemap = {
num = 2;
item[0] = {
from = "models/monsters/gargoyle/gargoyle"; // replace existing texture
to = "models/customization/monsters/mancubus/set12/mancubus_guns_set12"; // to this
}
item[1] = {
from = "models/monsters/gargoyle/gargoyle_body";
to = "models/customization/monsters/mancubus/set12/mancubus_body_set12";
}
}
}
materialRemaps should also be done in the entityDef decl.
Notice that the set12 skin for the the Mancubus is used. See Creating Custom AI - textures for more information.
idTarget_Spawn - Reference
The idTarget_Spawn entity is used to spawn the custom AI. You will need more per custom AI that you want to spawn. Make sure to change the spawn positions for each. Always reference the idAI2 entity when spawning the custom AI, so you would not accidentally spawn the vanilla AI.
Troubleshooting
The process of getting custom AI working is a rather challenging task. You are bound to encounter some issues. Double check all of your modified decls and reference them with their vanilla counterparts. Same applies to entities. Ask yourself the following:
- Are you spawning your AI correctly?
If not, check the idAI2 and idTarget_Spawn for typos. The encounter manager can also have syntax errors.
- Are the textures loading consistently?
If not, check the materialRemaps or TGA files for typos. Also, check if the textures are added correctly in the assetsinfo JSON file.
- Does your AI function as intended?
If not, check the decls for typos or mislinks. The entitydef file might be the root of your problems if there is a mislink.
Double check BOTH assetsinfo JSON files for typos. Most crashes occur from syntax errors.
See Also
Creating Custom AI - textures
See Creating Custom AI - decls before proceeding
Creating Custom Textures
While adding custom textures into the game is possible, it is not the optimal choice. Even if the added textures are in a relatively high patch directory, there is the chance that some of them will not load properly, especially if there are a lot of added assets in the mod(s).
Instead, it is recommended to replace the textures of an existing playable demon skin. Since injecting gameplay-altering mods disable Battlemode entirely, there is little concern for distorting playable demon skins. You will want to edit the regular demon skin like normal and replace its name with the cosmetic skin that you want to replace. Make sure to include the ENTIRE file extension ( ex: mancubus_body_set12.tga$streamed$mtlkind=albedo )
Also, be sure to replace ONLY the matching $streamed$ TGA extension. In the case of Gargoyles, replace any .tga$streamed$mtlkind=albedo file with that of the same extension for a set12 mancubus skin, for example. Most cosmetic skins are located in warehouse\models\customization\monsters
If your extracted textures do not have the $streamed$ TGA extension, then reference here - Resource Data
Then, you need to modify the material2 decls for demon skin in warehouse. They will be used to remap the textures on the custom AI. For the Stone Gargoyle, copy all the regular Gargoyle material2 decl parameters into the demon skin material2 decl equivalent that you set.
For example, the following would be copied over:
models/monsters/gargoyle/gargoyle_body
to
models/customization/monsters/mancubus/set12/mancubus_body_set12
It is best practice to replace a demon skin material2 decl with a similar name to the custom AI material2 decl.
In the copied gargoyle_body decl, which is now named mancubus_body_set12, replace the RenderLayers with your modified demon skin textures. The following is an example:
RenderLayers = {
item[0] = {
parms = {
bloommaskmap = {
filePath = "models/monsters/gargoyle/gargoyle_body_e.tga";
}
sssmask = {
filePath = "models/customization/monsters/mancubus/set11/mancubus_body_set11_sss.tga";
options = {
format = "FMT_BC3";
}
}
smoothness = {
filePath = "models/monsters/gargoyle/gargoyle_body_g.tga";
}
normal = {
filePath = "models/monsters/gargoyle/gargoyle_body_n.tga";
}
specular = {
filePath = "models/monsters/gargoyle/gargoyle_body_s.tga";
}
albedo = {
filePath = "models/customization/monsters/mancubus/set12/mancubus_body_set12.tga";
}
}
}
}
Once each material2 decl is modified, you will need to use a materialRemap in the renderModelInfo of BOTH the entityDef decl and idAI2 entity. The following is an example:
renderModelInfo = {
model = "md6def/characters/monsters/gargoyle/base/gargoyle.md6";
materialRemap = {
num = 8;
item[0] = {
from = "models/monsters/gargoyle/gargoyle";
to = "models/customization/monsters/mancubus/set12/mancubus_guns_set12_hq";
}
item[1] = {
from = "models/monsters/gargoyle/gargoyle_body";
to = "models/customization/monsters/mancubus/set12/mancubus_body_set12";
}
item[2] = {
from = "models/monsters/gargoyle/gargoyle_cs";
to = "models/customization/monsters/mancubus/set12/mancubus_body_set12_hq";
}
item[3] = {
from = "models/monsters/gargoyle/gargoyle_eyes";
to = "models/customization/monsters/mancubus/set12/mancubus_eyes_set12";
}
item[4] = {
from = "models/monsters/gargoyle/gargoyle_fbg";
to = "models/customization/monsters/mancubus/set12/mancubus_legs_set12_hq";
}
item[5] = {
from = "models/monsters/gargoyle/gargoyle_gore";
to = "models/customization/monsters/mancubus/set12/mancubus_head_set12_hq";
}
item[6] = {
from = "models/monsters/gargoyle/gargoyle_head";
to = "models/customization/monsters/mancubus/set12/mancubus_head_set12";
}
item[7] = {
from = "models/monsters/gargoyle/gargoyle_wings";
to = "models/customization/monsters/mancubus/set12/mancubus_legs_set12";
}
}
lightRigDecl = "gargoyle/gargoyle_default";
}
If you want to go far enough to apply the textures to sync kills (glory kills, chainsaw kills, crucible kills, berserk kills), the apply the same materialRemap to added entitydef\characters\monsters decls and reference them in the added entitydef\syncmelee decls.