Skip to content

widgrensit/asobi

Repository files navigation

asobi

asobi

Multiplayer game backend on Erlang/OTP. Hot-reloadable, Apache-2.

Hex.pm Hexdocs CI License

DocsLive demoDiscordIssues

asobi hot-reload: edit a Lua file, save, live match updates — no restart
Edit a Lua file. Save. Live match updates. No restart. Try it.


Who it's for

Solo devs and small teams building indie 2D multiplayer. If you're on Godot, Defold, LÖVE, Phaser, or Flame+Flutter, asobi ships the backend pieces you'd otherwise rebuild from scratch: matches, matchmaker, chat, leaderboards, economy, voting, phases, worlds, presence, inventory.

Not the right fit for twitch-latency AAA shooters — WebSocket/TCP has a floor around 4ms. Great for turn-based, casual, MMO zone, roguelike, co-op, party, and social games.

Try it in 60 seconds

git clone https://github.com/widgrensit/asobi
cd asobi/examples/hotreload-demo && docker compose up

Open http://localhost:3000, then edit lua/match.lua and save — the running match updates live. No restart, no reconnect, no kicked players.

Two ways to use asobi

Write your game in Lua — use the asobi_lua Docker runtime. One container, hot-reloadable Lua match scripts, batteries included. No Erlang required. This is what most people want.

Write your game in Erlang — depend on this library directly. You get the same match supervisor, matchmaker, leaderboards, economy, world server, and voting primitives, implemented as OTP behaviours you compose with the rest of your release.

%% rebar.config
{deps, [
    {asobi, "~> 0.1"}
]}.

Features

  • asobi_match — behaviour for per-match logic, backed by a supervised gen_server with ETS state backup on crash.
  • asobi_matchmaker — pluggable strategies (fill, skill_based); your own via the asobi_matchmaker_strategy behaviour.
  • asobi_world_server — persistent worlds with lazy zones, spatial grid indexing, terrain chunk serving, adaptive tick rates.
  • asobi_vote_server — plurality, ranked choice, approval, weighted. Fixed / ready-up / hybrid / adaptive windows. Spectator voting, veto tokens, majority-tyranny mitigations.
  • asobi_phase, asobi_season_manager, asobi_timer — phase engine, season lifecycles, five timer primitives.
  • Rate limiting via seki (sliding window, per route group), sessions cached in ETS, presence via pg, chat / social / economy / inventory / storage / tournaments / notifications as Nova controllers.
  • Client SDKs for Godot, Defold, Unity, Unreal, JS/TS, Dart, Flame — see below.

Benchmarks

Single node, 8 cores, same-machine client. See guides/benchmarks.md for full numbers.

Peak
WebSocket throughput 83,000 msg/sec @ 3,500 concurrent connections
RTT p50 / p99 4.4 ms / 6.5 ms
REST reads (matches / friends / wallets) 7–14 ms p50
Memory per connection ~15 KB

Not a twitch-FPS backend — WebSocket/TCP has a latency floor. Excellent for turn-based, casual, MMO zone, roguelike, co-op, and party games. Pair with a UDP relay if you need sub-3ms physics.

Client SDKs

Engine Package Docs Example
Godot 4.x (GDScript) asobi-godot Guide Demo
Defold (Lua) asobi-defold Guide Demo
LÖVE (Lua) asobi-love — ships May 2026
Phaser (TypeScript) asobi-phaser — ships May 2026
Unity 2021.3+ (C#) asobi-unity Guide Demo
Unreal Engine 5 (C++) asobi-unreal
TypeScript / JS (Browser + Node) asobi-js
Dart / Flutter asobi-dart Guide
Flame (Flutter) flame_asobi Demo

Documentation

Migrating?

Related projects

Stability

Note

asobi is pre-1.0. The API is stabilising; expect minor breaking changes until 1.0. We will never relicense — see guides/exit.md for the "if asobi disappears tomorrow" runbook.

Run it yourself, or use the cloud

asobi is Apache-2 and self-hostable. One Docker container runs the full stack — see docker-compose.example.yml for a production-shaped setup with Postgres.

Don't want to operate it? asobi.dev/cloud is the managed version — €9/mo Indie tier, EU-sovereign, same open-source core. If we ever pivot, you still have the code — see guides/exit.md.

FAQ

Does asobi replace Nakama / Colyseus / PlayFab? For the indie-2D multiplayer slot, yes. For AAA shooters needing per-match dedicated UDP servers, no — pair asobi with a UDP relay.

Can I write my game logic in something other than Lua? Yes. Depend on asobi as an Erlang library and write match code in Erlang, or call the REST/WebSocket API from any language. Lua is the easy mode.

Does it scale across machines? asobi is single-node by design — one BEAM node handles tens of thousands of connections. Shard at the app level (game-per-node, region-per-node), don't try to cluster a single match across hosts.

What happens if asobi disappears? Apache-2, single-binary deploy, Postgres backing store. Nothing in your stack is load-bearing on us. See guides/exit.md.

Contributing

See CONTRIBUTING.md for the build setup, pre-push checklist, and test matrix. Security issues: see SECURITY.md.

License

Apache-2.0. See LICENSE.