-
Notifications
You must be signed in to change notification settings - Fork 2
Tutorial 01 Sprite And Text Tweak
Goal. Recolor one Pokemon's battle sprite and rewrite one line of dialogue; see both in-game within ten minutes.
Prerequisites. Getting Started, Concepts: Lifecycle. No Lua experience assumed.
Files created.
mods/tutorial_01_firstmod/
├── manifest.json
├── main.lua
└── transforms.lua
-
Scaffold.
python3 tools/modkit.py scaffold tutorial_01_firstmod python3 tools/modkit.py validate tutorial_01_firstmod
Outcome:
validatepasses on the empty mod — it drives the real loader headlessly, so a green run here means a clean load in-game. -
Declare an asset transform. This is the legal posture, learned first: you ship a recipe, never ROM-derived pixels. Add to
manifest.json:"assets_transforms": "transforms.lua"
And write
transforms.lua:-- runs once, sandboxed, against the player's own imported cache return function(ctx) local front = ctx.readImage("battle/front/mew.png") ctx.writeImage(ctx.recolor(front, { { 255, 255, 255 }, { 255, 170, 200 }, { 180, 60, 120 }, { 40, 0, 20 }, }), "battle/front/mew.png") end
The recipe reads the cached sprite, recolors its four shades (lightest first), and writes the result under the mod's derived root. Because the derived path mirrors the cache path, it shadows the original wherever the engine loads it (
src/render/Assets.lua) — no registry call needed. Outcome: on next launch the transform runs once (watch for theassets.transformedlog line). -
Rewrite a line of dialogue. In
main.lua:return function(mod) mod.content.text:override("_PalletTownSignText", "MODDED SIGN.\nHello from a mod!") end
textis a record registry of generated-text labels;overridereplaces the string.\nbreaks the line. Outcome: reading the Pallet Town sign shows your text. -
Enable and see it. The mod is enabled by default; restart the game, start or continue a save, and check Mew's front sprite (the dex, a battle, or the title attract) and the Pallet Town line.
-
python3 tools/modkit.py validate tutorial_01_firstmodpasses. - Mew renders in your palette; the Pallet Town sign shows your line.
- Disable the mod in the manager and restart: both revert to vanilla exactly. That is the parity invariant, and every tutorial ends with it.
-
Shipping pixels instead of a transform. Copying a PNG out of
assets/generated/into your mod distributes Nintendo's art;modkit packrefuses cache-derived bytes. The transform generates the art on the player's machine from their own import. -
Editing
assets/generated/directly. Re-import wipes it whole; transforms write tosave/mod-derived/<id>/, which survives. -
Case in cache paths. Cache sprite files are lowercase
(
battle/front/mew.png, backs atbattle/back/mewb.png).
Next: Tutorial 02 — Balance Patch.
Engine 1.0.0 · mod API 2 · repository · Discord
This project ships no ROM data. All game content is decoded on the player's machine from their own verified Pokemon Red ROM; mods ship recipes and original assets, never extracted content.
Start here
Concepts
Tutorials
- The ladder
- 01 Sprite and Text Tweak
- 02 Balance Patch
- 03 New Species
- 04 New Item and Ball
- 05 New Move
- 06 NPC and Dialogue
- 07 New Map
- 08 Quest
- 09 Custom Music
- 10 New Mechanic
- 11 Custom UI Screen
- 12 Mini Total Conversion
Reference
Guides
Playing