Skip to content

Examples

Learn from complete, production-ready mod implementations.

Available Examples

Team Mode

A two-team competitive mode featuring:

  • ⚔️ Team assignment with clan-aware balancing
  • 🛡️ Friendly fire prevention
  • 💰 Troop donations between teammates
  • 🎨 Team-colored territories
  • 🏆 ELO rewards for winning team

This is a comprehensive example demonstrating most SDK features.

Example Structure

Each example follows this structure:

example-mod/
├── manifest.json           # Mod metadata
├── gameplay.ts             # Main mod class (extends Mod)
├── config.ts               # Game mechanics overrides (implements Partial<Config>)
├── executions/             # State mutations (implements Execution)
├── ui/                     # UI components (buttons, panels)
├── schedulerJobs/          # Background tasks (implements SchedulerJob)
└── utils/                  # Shared types, constants, helpers

Running Examples

Examples are located in src/examples/ and can be built with:

pnpm nx build-mods @lands.io/mod-sdk

Output will be in dist/mods/.

Key SDK Types Used

Examples demonstrate these core types from the SDK:

  • Mod - Base class for all mods
  • Config - Game mechanics customization
  • Execution - State change operations
  • SchedulerJob - Background tasks

See the API Reference for complete type documentation.