Tyrian modding: enemies and behaviors
A mod can change any original enemy, create new enemies with their own flight path, tracking and turrets, and give them their own weapons.
Enemy weapons
"enemy_weapons": [
{ "name": "drone_spread", /* same fields as a weapon power level */ }
]
They use the fields of a power level. For an enemy, a positive speed_y
goes down.
New and changed enemies
enemies[] holds two kinds of entries, told apart by their key:
"enemies": [
{ "name": "my_drone", // NEW enemy, cited by its name in levels/*.json
"base": "tech_corridor_32", // original enemy copied (optional)
"armor": 8,
"behavior": {
"path": [ { "ticks": 30, "vx": 2, "vy": 2 }, { "ticks": 30, "vx": -2, "vy": 2 } ],
"loop": true,
"track": { "axis": "x", "max_speed": 2, "every": 4 },
"turrets": [ { "weapon": "drone_spread", "every": 40, "start": 20, "direction": "down" } ]
} },
{ "original": "jungle_fighters_07", "armor": 30 } // changes an original enemy
]
A new enemy without base starts from safe values: visible, destructible, armor 10. All mods together can add 100 new
enemies. An original entry only writes the fields it sets.
Enemy fields
| Field | Meaning |
|---|---|
armor | Hit points. 0 turns the enemy into a pickup (warning). |
value | Score. |
xmove, ymove, xaccel, yaccel, xcaccel, ycaccel, xrev, yrev | Movement. |
startx, starty, startxc, startyc | Spawn offsets. |
esize | Hit box size. |
ani, animate, egraphic[] (20 at most), shapebank | Images. |
explosiontype, dgr, dlevel, dani | Death animation. |
tur[], freq[] (3 at most) | Original turrets: names of original enemy weapons (null for none) and their frequencies. A mod's own enemy weapon is fired through behavior.turrets. |
elaunchfreq, elaunchtype | Launched enemy: the name of a new enemy of the mod or of an original enemy. |
eenemydie | Enemy left behind on death (same). |
Behaviors
| Field | Values | Effect |
|---|---|---|
path[] (32 at most) | ticks 1–10000, vx/vy −128–127 | Sets the speeds for ticks frames; loop starts the path again. |
track | axis x / y / xy, max_speed 0–127, every 1–255 | Moves one unit towards the player every every frames, with no randomness. |
turrets[] (4 at most) | weapon, every/start 1–255, direction down / side / side_reverse | Fires a mod or original enemy weapon through the original turret code. |
Any error in a behavior refuses the whole behavior. Everything is integer and deterministic, and original content is not affected.
Names of the original enemies and weapons
The original game data has no names for enemies and enemy weapons. The engine computes stable names from the data and publishes them in
rewrite/mods/original-names.json, with armor, score, size and table slots:
- an enemy is
<theme>_<NN>: the theme of its image bank and the rank of its first image in that bank, for exampletech_corridor_32. Enemies that share an image but differ in stats getb,c… (tech_corridor_32b); an enemy with no image isno_image_<NN>; - an enemy weapon is
<sprite>_<NN>: the name of its first projectile sprite and a counter, for examplering_green_leftdown_01.
Episodes 1–3 and 4–5 use two different enemy tables; a name designates the same enemy in both when it exists in both. The wiki's
bestiary shows every enemy that appears in a level, with its sprite, under these names. Banks:
asteroid_field, bank_03, bank_06, bank_13, bank_20, bank_33, blade_spinners, cargo_depot, crystal_hangar, cyber_spheres, dark_waterfall, dome_city, dragon_boss, fireball_station, fleet_assault, garden_temple, gem_minefield, insect_boss, jungle_fighters, jungle_fortress, lava_centipede, mech_walker, none, ocean_world, orbital_weapons, organic_horror, pickup_items, pipe_cannons, rail_platform, rock_caves, skull_fleet, spike_fortress, tech_corridor, volcanic_ruins.
After a change of the game data, regenerate the list (and the picture sheets of the enemies) with:
cd rewrite
cargo run --release -p tyrian-mods -- catalog --data ../data --sheets ../docs/original-enemies