Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be πŸ“–

GenosDB for Godot

An asset by estebanrfp
The page banner background of a mountain and forest
GenosDB for Godot hero image

Quick Information

0 ratings
GenosDB for Godot icon image
estebanrfp
GenosDB for Godot

Serverless peer-to-peer multiplayer for Godot games exported to the Web, powered by GenosDB (https://github.com/estebanrfp/gdb): WebRTC data channels plus a reactive, persistent graph database that runs entirely in the browser. No backend, no signaling server to run.Web only: P2P works on the HTML5/Web export. On desktop the API is a safe no-op, so the same code runs everywhere (single-player in the editor, multiplayer on the Web).The API mirrors GenosDB, so using this plugin teaches the real GenosDB API: Net.join(name, [relays]) -> gdb(name, {rtc:{relayUrls}}) Net.send(data) -> channel.send(...) ephemeral -> signal message(id, data) Net.put(data, id) -> db.put(node, id) graph -> signal graph_changed(id, action, data) Net.remove(id), Net.map(query); signals peer_join / peer_leaveSetup is 3 steps: copy addons/godot_genosdb, enable the plugin, export to Web. The plugin auto-registers the "Net" autoload and auto-injects the JS bridge (loaded from a CDN) into index.html. No manual HTML editing, nothing to bundle.New in 0.2.0: custom Nostr relay support fixed and documented (pass your own relays to join), and the bundled demo is now a full cozy co-op farm β€” 4-directional animated farmer with axe chopping, trees that regrow, a race-free shared wood counter, P2P chat with speech bubbles, a shared-world Reset button (db.remove), CC0 pixel-art tileset, sound effects and ambient music. Every mechanic maps to a real GenosDB call.Live demo (open it in two browser tabs): https://estebanrfp.github.io/godot-genosdb/Every tab is another farmer in the same shared world: trees fall in every window (and stay fallen for late-joiners via the persistent graph), the wood counter matches everywhere, and chat bubbles pop over each player.Renderer: GL Compatibility recommended. Demo art & audio are CC0 (see CREDITS.md).

Supported Engine Version
4.3
Version String
0.2.0
License Version
MIT
Support Level
community
Modified Date
15 hours ago
Git URL
Issue URL

🌾 godot-genosdb β€” Serverless P2P multiplayer for Godot (Web)

Add real-time, peer-to-peer multiplayer to a Godot game exported to the Web with zero servers, using GenosDB (WebRTC data channels + a reactive, persistent graph database that runs entirely in the browser). The plugin's API mirrors GenosDB, so using it teaches you the real GenosDB API.

β–Ά Live demo: https://estebanrfp.github.io/godot-genosdb/ β€” open it in two tabs: each shows the other farmer moving, and a tree you chop falls in every window (and stays fallen, even for someone who joins later).

πŸ“¦ What's in this repo

Path What
addons/godot_genosdb/ The plugin (drop-in Godot 4 addon) β†’ plugin docs
scenes/, scripts/, assets/, project.godot The demo's full source (the co-op farm)
docs/ The exported Web build (this is what GitHub Pages serves)
web/build.sh, web/serve.py Build & local-serve helpers

πŸ“₯ Install the plugin in YOUR game (3 steps)

  1. Copy the folder addons/godot_genosdb/ into your own project's addons/ folder (create addons/ if it doesn't exist).
  2. In Godot: Project β†’ Project Settings β†’ Plugins, find β€œGenosDB for Godot” and switch it to Enabled.
  3. Export to Web (Project β†’ Export β†’ Web; renderer GL Compatibility recommended). The plugin auto-injects the GenosDB bridge into your exported index.html β€” you don't edit any HTML.

No npm, no bundling: the bridge loads GenosDB from a CDN. No signaling server: GenosDB uses decentralized Nostr relays.

Use it in code (the API mirrors GenosDB)

func _ready():
    Net.peer_join.connect(func(id): spawn_remote(id))
    Net.peer_leave.connect(func(id): remove_remote(id))
    Net.message.connect(_on_state)        # ephemeral (fast)
    Net.graph_changed.connect(_on_world)  # persistent (synced + stored)
    Net.join("my-room")                    # = gdb("my-room", {rtc:true})
    Net.map({})                            # = db.map({}, cb)  -> graph_changed

func _physics_process(_d):
    Net.send({ "x": position.x, "y": position.y })          # = channel.send(...)

func chop_tree():
    Net.put({ "type": "tree", "hp": 0 }, "tree_3")          # = db.put(node, id)
GenosDB (JS) Net (Godot) Layer
gdb(name, {rtc:true}) Net.join(name) room
room.on('peer:join'/'leave') signal peer_join / peer_leave room
channel.send(data) Net.send(data) ephemeral
channel.on('message', cb) signal message(id, data) ephemeral
db.put(node, id) Net.put(data, id) graph
db.remove(id) Net.remove(id) graph
db.map(query, cb) Net.map(query) + signal graph_changed(id, action, data) graph

Full API: addons/godot_genosdb/README.md.


β–Ά Run the demo

Editor (single-player): open the project in Godot 4.6+ and press β–Ά. Move with WASD/arrows, chop trees with E / Space. (P2P is Web-only, so in the editor it runs as a normal single-player game.)

Web (multiplayer), locally:

GODOT=/path/to/Godot ./web/build.sh        # exports into docs/
python3 docs/serve.py 8088                 # open http://127.0.0.1:8088 in two tabs

Or just open the live demo above.

🧠 How it works (the hybrid model)

GenosDB isn't only WebRTC β€” it's a reactive graph database that syncs P2P and persists. So the demo uses both layers, the recommended GenosDB pattern:

  • Ephemeral β€” player positions over a GenosRTC data channel (Net.send).
  • Persistent β€” tree state in the GenosDB graph (Net.put / Net.map); a late-joiner gets the current world automatically (via the initial action) and chops survive reloads.

πŸ›  Tech

  • Godot 4.6 β€” GL Compatibility, Web export, no threads β†’ any static host.
  • GenosDB / GenosRTC β€” loaded from CDN; auto-injected on export.

Author

Esteban Fuster Pozzi (@estebanrfp) β€” Full Stack JavaScript Developer

License

MIT

Serverless peer-to-peer multiplayer for Godot games exported to the Web, powered by GenosDB (https://github.com/estebanrfp/gdb): WebRTC data channels plus a reactive, persistent graph database that runs entirely in the browser. No backend, no signaling server to run.

Web only: P2P works on the HTML5/Web export. On desktop the API is a safe no-op, so the same code runs everywhere (single-player in the editor, multiplayer on the Web).

The API mirrors GenosDB, so using this plugin teaches the real GenosDB API:
Net.join(name, [relays]) -> gdb(name, {rtc:{relayUrls}})
Net.send(data) -> channel.send(...) ephemeral -> signal message(id, data)
Net.put(data, id) -> db.put(node, id) graph -> signal graph_changed(id, action, data)
Net.remove(id), Net.map(query); signals peer_join / peer_leave

Setup is 3 steps: copy addons/godot_genosdb, enable the plugin, export to Web. The plugin auto-registers the "Net" autoload and auto-injects the JS bridge (loaded from a CDN) into index.html. No manual HTML editing, nothing to bundle.

New in 0.2.0: custom Nostr relay support fixed and documented (pass your own relays to join), and the bundled demo is now a full cozy co-op farm β€” 4-directional animated farmer with axe chopping, trees that regrow, a race-free shared wood counter, P2P chat with speech bubbles, a shared-world Reset button (db.remove), CC0 pixel-art tileset, sound effects and ambient music. Every mechanic maps to a real GenosDB call.

Live demo (open it in two browser tabs): https://estebanrfp.github.io/godot-genosdb/
Every tab is another farmer in the same shared world: trees fall in every window (and stay fallen for late-joiners via the persistent graph), the wood counter matches everywhere, and chat bubbles pop over each player.

Renderer: GL Compatibility recommended. Demo art & audio are CC0 (see CREDITS.md).

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
GenosDB for Godot icon image
estebanrfp
GenosDB for Godot

Serverless peer-to-peer multiplayer for Godot games exported to the Web, powered by GenosDB (https://github.com/estebanrfp/gdb): WebRTC data channels plus a reactive, persistent graph database that runs entirely in the browser. No backend, no signaling server to run.Web only: P2P works on the HTML5/Web export. On desktop the API is a safe no-op, so the same code runs everywhere (single-player in the editor, multiplayer on the Web).The API mirrors GenosDB, so using this plugin teaches the real GenosDB API: Net.join(name, [relays]) -> gdb(name, {rtc:{relayUrls}}) Net.send(data) -> channel.send(...) ephemeral -> signal message(id, data) Net.put(data, id) -> db.put(node, id) graph -> signal graph_changed(id, action, data) Net.remove(id), Net.map(query); signals peer_join / peer_leaveSetup is 3 steps: copy addons/godot_genosdb, enable the plugin, export to Web. The plugin auto-registers the "Net" autoload and auto-injects the JS bridge (loaded from a CDN) into index.html. No manual HTML editing, nothing to bundle.New in 0.2.0: custom Nostr relay support fixed and documented (pass your own relays to join), and the bundled demo is now a full cozy co-op farm β€” 4-directional animated farmer with axe chopping, trees that regrow, a race-free shared wood counter, P2P chat with speech bubbles, a shared-world Reset button (db.remove), CC0 pixel-art tileset, sound effects and ambient music. Every mechanic maps to a real GenosDB call.Live demo (open it in two browser tabs): https://estebanrfp.github.io/godot-genosdb/Every tab is another farmer in the same shared world: trees fall in every window (and stay fallen for late-joiners via the persistent graph), the wood counter matches everywhere, and chat bubbles pop over each player.Renderer: GL Compatibility recommended. Demo art & audio are CC0 (see CREDITS.md).

Supported Engine Version
4.3
Version String
0.2.0
License Version
MIT
Support Level
community
Modified Date
15 hours ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers