Docs / Quick start — Godot

Quick start — Godot

Connect a Godot 4.x project to a running Asobi server in about five minutes. Don't have a server yet? Run the server quickstart first.

1. Install the addon

Clone or copy asobi-godot into addons/asobi/ inside your project, then enable it via Project → Project Settings → Plugins.

2. Bootstrap the client

Drop a Boot.gd autoload:

extends Node

const HOST := "localhost"
const PORT := 8080

var client: AsobiClient

func _ready() -> void:
    client = AsobiClient.new(HOST, PORT, false)  # use_ssl = false
    add_child(client)

3. Authenticate

func login() -> void:
    var auth = await client.auth.register_async("player1", "secret123", "Player One")
    if auth.error:
        push_error("auth failed: %s" % auth.error)
        return
    print("logged in as %s" % client.player_id)

Auth requests are rate-limited at 5/sec per IP. Production builds should use a platform provider — see Auth & rate limiting.

4. Open the WebSocket and queue

client.realtime.connected.connect(func(): print("ws connected"))
client.realtime.matched.connect(func(data): print("matched: %s" % data.match_id))
client.realtime.match_state.connect(func(state):
    print("tick %d, %d players" % [state.tick, state.players.size()]))

await client.realtime.connect_async()
await client.realtime.add_to_matchmaker_async("arena")

5. Send input

client.realtime.send_match_input_async(
    JSON.stringify({"action": "move", "x": 1, "y": 0}))

Input is fire-and-forget. The next match_state signal will reflect the server's authoritative response.

What's next