README.md

MU_Aliens #

Jiangyu conversion of MU_Aliens.

What broke #

  • In the current game, UseSkill effects fire only when their skill is added during unit creation. The handler class has no on-use code path. The passives re-add the spawn skills every round start, and those re-adds fire nothing, so the chain passive to UseSkill to rocket organ clone only runs when a structure is created.
  • The AI only uses skills whose AIConfig fits the situation. The spawn skills had the smoke grenade's config (line-of-sight blocking) and the rocket organ's (direct attack). Both score 0 for a building spawning onto an empty tile, so the AI never used them either.
  • IsTargeted: false on the rocket organ clones crashes Skill.ApplyToTile in the current game. This killed the placement chain ("in game nothing happens").
  • The attack AI config the rocket organ clones inherited crashed enemy turns in Attack.OnExecute.

What changed #

  • The rocket organ clones are now the AI-facing spawn skills. They carry the construct scarecrow's SpawnPhantom AI config, the mechanism the vanilla scarecrow uses to spawn phantoms. The SpawnEntity handlers are unchanged.
  • IsTargeted: false removed and IsAttack: false added on all 13 clones (the two crashes above).
  • AnimationType: None on the spawn skills. They inherited the grenade throw animation, buildings can't play it, and every use silently failed after a 10 second AI timeout.
  • Cooldown markers (effect.MW_CDx_spawn_*) apply on use instead of every round start. Round-start application blocks the AI on every turn it gets. Lifetime is still 5 turns.
  • Passives add their skills with OnlyWhenSkillNotPresent so copies stop stacking every round.
  • Placement is untouched. UseSkill still fires at unit creation, so structures fire their first wave when they appear. The Clear Cooldown skills work now (they were fine, the rest of the chain wasn't).

Review these #

  • close_range tag no longer exists, replaced with short_range. Current tags: long_range, minimum_range, short_range.
  • SpawnAreaSettings: 255 dropped, the enum only defines 0/1/2/4.
  • m_LocalizedStrings dropped. The field now holds structured string objects, not the raw strings the original patches set, and the same text is carried by Title and Description, which are kept.
  • Spawn skill range is 3 instead of 1. SpawnPhantom won't target anything with a range 1 skill. Units can appear up to 3 tiles out.
  • Spawn AI config has opponent range 0-99, so structures spawn regardless of player distance. The Clear Cooldown skills keep the scarecrow's 5-10 band.
  • Placeholder icons pointing at assets the game does not ship are dropped.
  • The tower spawn skills each carry a UseSkill that points at themselves. It is preserved exactly as authored, its purpose was not clear from the data, and in the current game it does nothing. Worth checking against the original intent.

Known issue #

When a structure is fully boxed in, the spawn finds no free tile and the game logs a caught NullReferenceException. The missing null check is the engine's, not the mod's. In a nine round test it fired twice and the mission carried on both times.

Layout #

Path Contents
templates/ KDL clones and patches: armies, commodities, entities, missions, perks and skills.
assets/additions/sprites/ Unit badges and mission-preview markers.
unity/Assets/Authored/ Source .glb per structure, plus the base, normal and mask maps its material is built from.
unity/Assets/Prefabs/ Baked structure prefabs, referenced from KDL as asset="<name>/main".
code/ Empty. The mod is data only.

Building it #

In Jiangyu Studio:

  1. Open Project (Ctrl+Shift+P), pick this folder.
  2. Compile (Ctrl+Shift+B).
  3. Deploy on the compile dialogue that appears.

jiangyu.json imports alien_nest_chunk_1. Compile copies it from the local game install into unity/Assets/Imported/, and the structure materials bind to its Menace/lit_highlight shader.

The data is the KDL files under templates/, and should be edited with a real text editor. The visual editor in Jiangyu Studio is untested against these files and may not handle everything in them (I don't ever use the visual editor, I find it easier to hand-write KDL).

Rebaking a structure #

Only needed when a .glb changes. The bake takes its material from the first renderer on a reference prefab. The nest chunk's first renderer is transparent, so use unity/Assets/Authored/_reference/alien_opaque.prefab as the reference, it points at an opaque material.

From Studio's palette run Sync Unity Project, then Open Unity Editor. In Unity, open the Jiangyu menu, pick "Bake weapon prefab from glTF..." and fill in:

Field Value
Source glTF (.glb) Assets/Authored/<name>/raw.glb
Reference prefab Assets/Authored/_reference/alien_opaque.prefab
Base map (_d) Assets/Authored/<name>/0_base.png
Normal map (_n) Assets/Authored/<name>/0_normal.png
Mask map (HDRP) Assets/Authored/<name>/0_mask.png
Output dir Assets/Prefabs
Output name <name>

Press Bake. It writes Assets/Prefabs/<name>/main.prefab and its material. asset="<name>/main" in the KDL points at that prefab.

BGL_Spire has two material slots. "Fill from source glTF" under Per-slot overrides lists them. Give each row its own maps:

Slot Maps
Material.001 0_base.png, 0_normal.png, 0_mask.png
Material.002 1_base.png, 1_normal.png, 1_mask.png

Each model folder has a materials.json with the same pairing. Point the Material manifest field at it instead of filling rows by hand.

Replacing a .glb #

The shipped .glb files have two fixes a fresh export won't:

  • Mask maps are repacked for HDRP (R metallic, G occlusion, B detail, A smoothness). glTF puts roughness in G and metallic in B. Bake an unpacked mask and the model renders chrome blue. Leaving the mask field empty is safe, the bake uses a neutral 1x1.
  • No skinning. The bake errors on skinned meshes, so export without an armature. BGL_BlastChamber had a skin originally, its raw.glb here is flattened to the bind pose.