你的下一项功能
对局
使用显式修订号、不透明状态和独立结果报告的回合制游戏。
Godot

可见的结果
使用两个玩家会话协调大厅、轮流回合和独立的最终报告。
此步骤尚无视频。指南和MCP请求已可使用。
回合制对局
准备同一个项目
在仪表盘中选择与游戏配置相同的项目。
对局 →首次请求不需要额外定义。没有对应游戏数据时,空结果也有效。
使用两名玩家的独立会话:创建大厅、加入、指定顺序启动、交替提交字节状态,最后各自报告相同的最终结果。
首个示例只读取数据,不创建群组、对局或对象。空列表也是有效的首次响应。
实现此功能
你可以预览指南。运行需要有效的项目密钥。 准备项目
已安装 SDK、导入项目配置,且玩家已登录。
此 SDK 示例使用 develop。请检查已安装的 SDK 是否具备所需 API。
先通过快速入门连接目标玩家,再通过明确的按钮或场景操作调用read_my_matches()。仅打开文件不会发送请求。
GDScript
1extends Node
2
3# Explicit action after restoring the SAME existing player identity.
4func read_my_matches() -> void:
5 var user = Horizon.auth.getCurrentUser()
6 if user == null:
7 return
8 var result = await Horizon.matches.getMatches(user.userId)
9 if not result.success:
10 push_warning(result.errorCode)
11 return
12 print("Ledger revision: ", result.data.revision)
13 for row in result.data.recent:
14 print(row.id, " ", row.status) # May still be active after this player's forfeit.
15 # Respect result.data.pollAfterSeconds. No background poll.
16# Full two-player, durable-original example in the verified SDK:
17# addons/horizon_sdk/examples/features/matches_example.gd
18# read_matches()/create_reviewed(options), read_match(id), perform_reviewed(kind, body).
19# Each is an explicit player action. Original project+player intent survives host changes.
20# SDK methods: joinMatch(userId,id,originalRevision), startMatch(userId,id,originalRevision,order),
21# submitTurn(userId,id,originalRevision,PackedByteArray,finish),
22# reportResult(userId,id,originalFinalRevision,PackedByteArray,sortedWinnerIds).
23# Unknown create: recovery reads and explicit reconciliation, never a replacement create.
24# Report agreement is ordinary consensus, not validated combat or an automatic reward.
两名玩家,一个原始回合
使用两名玩家的独立会话:创建大厅、加入、指定顺序启动、交替提交字节状态,最后各自报告相同的最终结果。
发送前保存精确请求。超时后读取状态并核对。绝不悄悄替换修订号或原始意图。
报告使用不可变的最终修订号。一致并非可信胜利证明;冲突或缺失报告不会推断胜者。
排位运行需要已确认的排位对局和现有Validated Actions流程。普通对局报告不发放奖励。
PHP支持普通对局REST路由。不支持排位验证和实时功能,必要时返回FEATURE_NOT_SUPPORTED。
测试你的新功能。
使用两个玩家会话协调大厅、轮流回合和独立的最终报告。
在仪表盘中选择与游戏配置相同的项目。
接口
- GET
/matches - GET
/matches/limits - GET
/matches/open - GET
/matches/{matchId} - POST
/matches - POST
/matches/{matchId}/join - POST
/matches/{matchId}/decline - POST
/matches/{matchId}/start - POST
/matches/{matchId}/turn - POST
/matches/{matchId}/timeout - POST
/matches/{matchId}/leave - POST
/matches/{matchId}/cancel - POST
/matches/{matchId}/result - POST
/matches/{matchId}/ranked-run


