GS - Browser
A Godot asset that adds an in-game server browser and building blocks. Although we recommend using our web or app-sided server browser, this will allow you to create your own!
A server browser for Godot 4.7+: a query client and a list model. It asks game servers what they are, then gives you sources, filters, sorting, favourites and history. Part of the dot-* family. It needs only dot-core.
It speaks three protocols, so one browser can list any server:
| Protocol | Used for |
|---|---|
| DQP over UDP | Servers made with dot-server-query. |
| DQP as JSON over a WebSocket | Browser (web) builds, which cannot open a UDP socket. Picked automatically when the platform has no UDP. |
| A2S | Existing servers and tools that speak nothing else. |
dot-server-query is what this asks, but it is not a dependency. The wire formats are implemented here.
Install
- Copy
addons/dot_browser/andaddons/dot_core/into your project. - Enable dot-browser in Project > Project Settings > Plugins.
Quick start
var browser := DotBrowser.new()
browser.add_source(DotBrowserSourceList.of(PackedStringArray([
"eu1.example.com:27015",
"127.0.0.1:27016",
])))
browser.entry_updated.connect(func(entry: DotBrowserEntry) -> void:
table.redraw(entry))
add_child(browser)
await browser.refresh()
for entry in browser.filtered():
print(entry.describe())
# 127.0.0.1:27016 A dot server dm_atrium 8/32 14 ms
To ask one server everything, for a details panel:
await browser.query(entry.target, PackedStringArray(["info", "players", "rules"]))
for player in entry.player_list:
print(player["name"], player["score"])
Sources
A browser knows how to ask a server what it is. A source says which servers exist. A source produces addresses, never player counts: what a server is, is what the server says when asked.
| Source | What it gives |
|---|---|
DotBrowserSourceList |
Addresses typed in, or a JSON file you ship. |
DotBrowserSourceBackbone |
A site's server listing (GET /api/content/server/list), read anonymously over HTTP. Off until DotBrowserBackboneConfig.backbone_url is set (--browser-backbone-url or DOT_BROWSER_BACKBONE_URL). |
| Your own | Subclass DotBrowserSource and return targets. |
Settings
The defaults are shown.
| Setting | Default | What it does |
|---|---|---|
concurrency |
8 | Queries in flight at once during a refresh. Default 8, 0 = unlimited; negative is refused, and above 256 (or 0) a refresh warns. |
timeout_ms |
2500 | How long to wait for a server. |
retries |
1 | Extra tries after a timeout. |
Things the browser gets right
| Problem | What it does |
|---|---|
| A2S counts humans plus bots as players. | Reports the bot count separately, so a server with eight bots is not shown as an eight-player server. |
| Multi-packet replies from many servers arrive interleaved. | Stitches each reply by its own server and id. |
| A refresh of many servers can hang. | Runs the fan-out with a bounded number of queries at a time. |
Test
godot --headless --path . --import
godot --headless --path . res://examples/browser_selftest.tscn
The self-test includes a real query over a loopback socket and exits non-zero on any failure. The design is in docs/design.md.
Status
Built and maintained with Claude Code. The test suites pass, but little of this has been in front of real players yet. Please report rough edges by opening an issue.
Licence
MIT. See LICENSE. Only the TMC back-end web infrastructure is not open source.
互动趋势
GS - Browser 是一个 Godot 资源。它拥有 1 次下载、27 次浏览和 0 次收藏。 此条目属于 1 个合集 和 1 个标签。
评价
登录后即可发表评价。
评论 (0)
登录后即可评论。
