Tyrian modding: your first level
In about fifteen minutes: a mod called my_first_level that adds a new enemy, my_drone, to the first level of
episode 1, played straight from the editor, then packaged as a .zip to share. No Rust recompiling.
This tutorial uses the Godot level editor from the source repository. To make a mod without the editor, write
levels/ep1_09.json by hand as shown on Level events.
0. Prepare (once)
cd rewrite
scripts/build-linux.sh # engine library, resources and the level scenes
godot -e --path godot # opens the editor with the Tyrian plugin enabled
The Tyrian dock, on the right, holds the start row, Play from here, then the mod tools: the mod's folder name, the enemy name, its x position, Add an enemy here, Export to the mod and Build the .zip package.
1. Open a level (1 min)
In the FileSystem dock, double-click res://levels/ep1_09.tscn: the first level of episode 1, TYRIAN. The 2D view shows the map
and the dock shows the level and its current cur_loc.
2. Add an enemy at the start (2 min)
Leave the start row at the bottom of the map (cur_loc 0), keep the enemy name my_drone and the x position 130, and
click Add an enemy here. The status line confirms the new event.
my_drone is the new enemy declared in the enemies section of the mod template, with its flight path in data. An
original enemy is cited by its name the same way, for example tech_corridor_32. The editor adds a spawn event, exported
as { "time": 0, "spawn": "my_drone", "x": 130 }.
3. A second enemy further on (2 min)
Set the start row to 280, or scroll the 2D view and use the button that takes the row at the top of the view, then click Add an enemy here again.
4. Export to the mod (1 min)
Export to the mod writes user://mods/my_first_level/: a copy of the template (mod.json and
README.md) and levels/ep1_09.json, which holds all the level's events under the events key and so replaces the
original list. You can check it without the game:
cd rewrite
cargo run --release -p tyrian-mods -- check --data ../data --mods "<user folder>/mods" --enable-all
cargo run --release -p tyrian-mods -- run --data ../data --mods "<user folder>/mods" --enable-all --level ep1_09 --ticks 700
The second command reports how many times my_drone appeared.
5. Build the package (1 min)
Build the .zip package produces user://mods/my_first_level.zip, containing the my_first_level/ folder. Players
install it from Setup → Mods → Install a mod (.zip).
6. Play from here (2 min)
Set the row you want and click Play from here. The editor exports first if events changed, then starts the level fast-forwarded to that position. Close the game window to return to the editor.
7. Turn it on in the game
Setup → Mods: Enter toggles the mod, Esc reloads. The choice is kept in mods.cfg.
Going further
- The Example Behaviors reference mod has a complete new weapon and a new enemy with a
zig-zag path, player tracking and a turret. It is not in the game package: find it in
rewrite/mods/_retired/example_behaviors/of the repository. - Every field is described in mod.json and items and Enemies and behaviors.