Lua SDK

Server-side game modes written in Lua, hosted by asobi_lua. No client integration — your game code runs on the asobi server.

View on GitHub

Installation

Use the official Docker image:

docker pull ghcr.io/widgrensit/asobi_lua:latest
docker run -p 8080:8080 -v $(pwd)/game:/app/game ghcr.io/widgrensit/asobi_lua

Mount your Lua game-mode files under /app/game. asobi_lua hot-reloads them on save.

Game mode skeleton

A minimal match-mode Lua file:

-- Server-side game mode (runs inside asobi_lua)
function on_player_joined(match, player)
    game.broadcast(match, "welcome", { player_id = player.id })
end

function on_match_input(match, player, input)
    player.x = player.x + (input.move_x or 0)
    player.y = player.y + (input.move_y or 0)
    -- match.state is diffed and broadcast automatically each tick.
end

World mode

Worlds are lazy-zoned and support terrain streaming. Your Lua code decides which zone a player spawns in; asobi manages the tick, reconnection, and broadcast.

-- Server-side world game mode
function on_world_started(world)
    game.log("world started: " .. world.id)
end

function on_player_joined(world, player)
    -- Zone is picked automatically based on spawn position.
    game.broadcast_zone(world, player.zone, "welcome",
                        { player_id = player.id })
end

Reference

See the Lua API reference and Lua cookbook for the full game.* surface.