Documentation

Your game is a module. Create a new directory, declare your dependencies, and instantly leverage 24 battle-tested systems—combat, inventory, skills, quests, multiplayer sync, and more. Ship working multiplayer games in days, not months.

Each module is designed to work independently or compose with others. One server can host multiple games with isolated state.

Core Concepts

Game-Scoped Modules

Modules use the factory pattern to create game-specific instances. One Wyrt server can host multiple games, each with isolated state. Dependencies are injected via context, not globals.

// modules/my_game/index.ts
export default class MyGameModule implements IModule {
  name = 'my_game';
  version = '1.0.0';
  dependencies = ['wyrt_combat', 'wyrt_items'];

  async initialize(context: ModuleContext) {
    // Get dependencies via context (not globals)
    const combat = context.getModule('wyrt_combat');
    this.combatManager = combat.createCombatManager('my_game');
  }
}

WebSocket Request Handlers

Define request handlers with built-in rate limiting and JWT authentication. Handlers are auto-registered from the requests/ directory.

// modules/my_game/requests/attack.ts
const handler: Request = {
  cost: 5,      // Rate limit cost per request
  auth: true,   // Requires JWT authentication

  async exec(user: User, data: Data, payload: any, context: ModuleContext) {
    const { targetId } = payload;
    const damage = context.getModule('wyrt_combat')
      .getCombatManager('my_game')
      .attack(user.id, targetId);

    user.send({ type: 'attack_result', damage });
  }
};
export default handler;

Hot-Reloadable YAML Data

Define game content in YAML files. The engine watches for changes and reloads automatically—no server restart required. Custom loaders transform YAML into typed objects.

# modules/my_game/data/items/weapons.yaml
Iron_Sword:
  name: "Iron Sword"
  type: weapon
  slot: mainhand
  damage: [8, 12]
  requirements:
    level: 5
  sellPrice: 50

Steel_Axe:
  name: "Steel Axe"
  type: weapon
  slot: mainhand
  damage: [12, 18]
  requirements:
    level: 10
    strength: 15

Slash Commands

Register admin and player commands from the commands/ directory. Built-in permission system distinguishes admin vs player commands.

// modules/my_game/commands/spawn.ts
const command: Command = {
  name: 'spawn',
  description: 'Spawn a mob at location',
  admin: true,  // Requires admin privileges

  async exec(user: User, args: string[], context: ModuleContext) {
    const [mobId, x, y] = args;
    const mobs = context.getModule('wyrt_mobs').getMobManager('my_game');

    mobs.spawn(mobId, { x: +x, y: +y, zone: user.zone });
    user.system(`Spawned ${mobId} at ${x},${y}`);
  }
};
export default command;

Event Bus

Decouple modules with the event system. Emit events from combat, listen from loot and respawn. No direct dependencies between modules.

// Cross-module communication via events
context.events.on('player:death', async (data) => {
  const { playerId, killerId, zone } = data;

  // Drop loot
  const loot = context.getModule('wyrt_loot').getLootSystem('my_game');
  loot.dropPlayerLoot(playerId, zone);

  // Queue respawn
  const respawn = context.getModule('wyrt_respawn').getRespawnManager('my_game');
  respawn.queueRespawn(playerId, 5000);
});

// Emit events from anywhere
context.events.emit('player:death', { playerId, killerId, zone });

Modules

Core

Essential engine functionality and shared authentication

Gameplay

Combat mechanics, buffs, projectiles, and respawn systems

Progression

Skills, quests, and crafting for player advancement

Inventory

Item management, equipment slots, and loot drops

World

Rooms, positions, mobs, and resource nodes

Multiplayer

Teams and coordinated multiplayer features

Social

Chat, friends, guilds, and party systems

Auth

OAuth providers and authentication methods

Generated from module source code · Last updated: 12/8/2025