Skip to content

Lands.io Mod SDK

Build custom game modes for Lands.io with the official Mod SDK.

  • Getting Started

Install the SDK and create your first mod in under 5 minutes

Quick Start

  • Core Concepts

Understand the architecture: Mods, Actions, Executions, and State

Learn More

  • API Reference

Complete API documentation for all SDK classes and types

Browse API

  • Examples

Learn from real-world examples like Team Mode

View Examples

Quick Example

import { Mod, Config, Executor, Game, Player } from '@lands.io/mod-sdk';

// Optional: Override game mechanics
class MyConfig implements Partial<Config> {
  attackAmount(attacker: Player, defender: Player) {
    return attacker.troops() / 10; // Reduced attack power
  }
}

// Your mod class
export default class MyMod extends Mod {
  static override Config = MyConfig;

  onGameInit(game: Game, executor: Executor) {
    this.modState.set('score', { total: 0 });
  }

  onPlayerAdded(player: Player) {
    console.log(`${player.name()} joined!`);
  }
}

Features

Feature Description
🎮 Lifecycle Hooks React to game events like init, player join, game end
⚔️ Custom Actions Add new abilities and override existing mechanics
📊 State Management In-game state with automatic client sync
💾 Persistent Storage Cross-game data like ELO and leaderboards
🎨 UI Components Add custom buttons to the game interface
Scheduler Jobs Run background tasks on a schedule