Project Structure¶
Understanding how to organize your mod files.
Recommended Structure¶
my-mod/
├── manifest.json # Mod metadata and configuration
├── gameplay.ts # Main mod class (default export)
├── config.ts # Game mechanics overrides
│
├── executions/ # Custom game executions
│ ├── donate.ts
│ └── special-attack.ts
│
├── ui/ # UI components
│ └── buttons/
│ └── donate-button.ts
│
├── schedulerJobs/ # Background jobs
│ └── leaderboard-update.ts
│
└── utils/ # Shared utilities
└── shared.ts # Constants, types, helpers
File Responsibilities¶
manifest.json¶
Defines mod metadata:
{
"id": "team-mode",
"name": "Team Mode",
"version": "1.0.0",
"entry": "gameplay.ts",
"supportedGameModes": ["singleplayer", "multiplayer"]
}
gameplay.ts¶
Your main mod class that extends Mod:
export default class MyMod extends Mod {
static override Config = MyConfig;
onGameInit() { /* ... */ }
onPlayerAdded() { /* ... */ }
registerActions() { /* ... */ }
}
config.ts¶
Override game mechanics:
export class MyConfig implements Partial<Config> {
attackAmount() { /* ... */ }
maxPopulation() { /* ... */ }
}
executions/¶
Game state mutations triggered by actions:
export class DonateExecution extends Execution {
execute(game: Game): void {
// Modify game state
}
}
ui/¶
Custom UI components like action buttons:
export class DonateButton extends ModActionButton {
get icon() { return 'donate.png'; }
get label() { return 'Donate'; }
}
Build Output¶
When built, your mod is bundled into a single file in dist/mods/: