OPENTYRIAN2000 / ENHANCED WIKI Site EN · wiki in English Download
Wiki / Modding / Enemies and behaviors
Modding

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

FieldMeaning
armorHit points. 0 turns the enemy into a pickup (warning).
valueScore.
xmove, ymove, xaccel, yaccel, xcaccel, ycaccel, xrev, yrevMovement.
startx, starty, startxc, startycSpawn offsets.
esizeHit box size.
ani, animate, egraphic[] (20 at most), shapebankImages.
explosiontype, dgr, dlevel, daniDeath 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, elaunchtypeLaunched enemy: the name of a new enemy of the mod or of an original enemy.
eenemydieEnemy left behind on death (same).

Behaviors

FieldValuesEffect
path[] (32 at most)ticks 1–10000, vx/vy −128–127Sets the speeds for ticks frames; loop starts the path again.
trackaxis x / y / xy, max_speed 0–127, every 1–255Moves one unit towards the player every every frames, with no randomness.
turrets[] (4 at most)weapon, every/start 1–255, direction down / side / side_reverseFires 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:

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