web stats

KATA 4 OF 8 · XML LAYER

Server-Side Content: Custom Zombies & Spawns

This is the most valuable trick in the XML layer: adding a custom enemy that reuses a vanilla model, so it works server-side with no client download and EAC stays on. It is exactly how the popular server-side zombie packs work, and it is why they re-port to new game versions faster than anything else.

What you'll build

A tougher zombie, zombieReinforcedBrute, that extends a vanilla zombie (inheriting its model and animations) but with more health and a custom name - then make it spawn in the wild. Two files: entityclasses.xml defines what it is; entitygroups.xml decides where it appears.

Why "server-side" matters

An entity is server-side as long as it does not introduce new assets (models, textures, sounds). Because this zombie extends a vanilla class, it borrows that class's existing model - so the client already has everything it needs to render it. The server just tells clients "spawn entity zombieReinforcedBrute," and they draw it with vanilla art. Result: players join without installing your mod, and EAC stays on. The moment you give it a custom model, that becomes a client asset (Kata 5) and the mod stops being server-only.

Step 1 - Define the entity class

In Config/entityclasses.xml, append a new class that extends a vanilla template and overrides a couple of properties:

<configs>
  <append xpath="/entity_classes">
    <entity_class name="zombieReinforcedBrute" extends="zombieBoe">
      <property name="HealthMax" value="600" />
      <property name="ExperienceGain" value="900" />
    </entity_class>
  </append>
</configs>
  • extends copies every property of the named vanilla class (here zombieBoe, a standard zombie) as the starting point - including its model. You only declare what you want to change.
  • Verify your extends target exists by opening the game's Data/Config/entityclasses.xml. Common bases include the per-zombie classes and the zombieTemplateMale template.

Step 2 - Make it spawn

A defined class never appears on its own; the spawning system pulls from entity groups. Add your zombie to an existing group in Config/entitygroups.xml:

<configs>
  <append xpath="/entitygroups/entitygroup[@name='ZombiesAll']">
    <entity name="zombieReinforcedBrute" prob="0.05" />
  </append>
</configs>
  • prob is a relative weight within the group, not a percentage. 0.05 against entries weighted ~1.0 makes it a rare spawn - start low, you can always raise it.
  • Open vanilla entitygroups.xml to pick the right group: biome groups, horde groups, and broad sets like ZombiesAll all exist, and which one you target decides where your zombie shows up.

V3.0 note: V3.0 "Dead Hot Summer" moves entitygroups.xml back to proper XML elements (the <entity name prob> form above). The old text-based group format still loads "currently," but it is deprecated - author the element form. See V3.0 mod compatibility.

Test it

  1. Restart. Check the log for Loaded Mod and no red entity errors.
  2. Spawn it directly to confirm the class loads: open the console (F1) and run spawnentity with your player id and the entity - or use the creative menu. If it appears with vanilla art and your new health, the class works.
  3. Confirm the spawn by playing (or fast-forwarding nights) until the group rolls your entity. Because prob is low, raise it temporarily to 1.0 while testing, then set it back.

Common pitfalls

  • Bad extends. If the parent class name is wrong, the entity has no model and errors on spawn. Copy the exact name from vanilla.
  • Group does not exist. Appending to entitygroup[@name='Typo'] silently adds nothing. Confirm the group name in vanilla entitygroups.xml.
  • Spawn floods. prob is a weight - a high value relative to the group makes your zombie the majority of spawns. Tune low.
  • You "made it server-side" but added a model. Reusing a vanilla model keeps it server-only; a custom mesh makes it a client asset (Kata 5) and players must install it.

Next: Kata 5 - Custom Assets: Icons, Models & Bundles. So far everything reused vanilla art. Next you bring your own - and cross the line where players must download the mod.