Skip to main content

What Is CraftyGame?

Every game published on Crafty must extend CraftyGame. CraftyGame is the contract between your game and the platform:
  • game lifecycle,
  • player join/leave callbacks,
  • timer/match control helpers,
  • server-authoritative movement helper for 3D templates.

Required Lifecycle Hooks

Override these in your game script:
Use untyped player for maximum compatibility across:
  • CraftyCharacter3D players (3D action template),
  • custom CraftyPlayer subclasses (2D/RTS/card/turn-based).

Common Platform Methods On CraftyGame

Hook Responsibilities

  • _game_init(): one-time setup (spawn points, static data, signal wiring).
  • _game_start(): begin active match flow.
  • _game_end(): finalize and cleanup.
  • _player_joined(player): attach defaults for a newly connected player.
  • _player_left(player): cleanup per-player transient state.

Server-Authoritative Pattern

3D Template Pattern (Optional)

If your player scene uses CraftyCharacter3D, you can use the built-in movement helper:
For non-3D games, ignore apply_default_movement and implement your own state model with set_synced.

Minimal Example