Pay rewards for peer-hosted matches¶
A dedicated match has a game server you run, so otomo believes its report. A peer-hosted
match (transport: p2p_host) has no such witness: one player's game simulated it. How much you
believe your players is a decision about your game, not about the platform, so otomo leaves it to
you. You write the policy in the economy.trust document; otomo stores what players report,
checks it against the match's roster, and pays exactly what your policy allows, through the same
limits and budgets as a dedicated report.
A cooperative game where cheating only spoils one group's evening can trust its players. A game with trading or a ranked ladder should trust nobody, and keep those modes on dedicated servers.
What the game sends¶
During the match, each player's game reports its own facts (a pickup, a kill), and after it the host reports the outcome:
POST /api/player/economy/match-reports (the player's own token)
{"match_id": "...", "role": "peer",
"facts": [{"name": "loot.pickup", "key": "loot:<match>:<player>:water_essence:3",
"fields": {"resource": "water_essence", "amount": 1}}]}
{"match_id": "...", "role": "host", "idempotency_key": "outcome:<match>:<run>:host",
"outcome": {"run_id": "...", "result": "completed", "participants": [{"player_id": "...", "present": true}],
"fields": {"reward_classes": "mission.reward.fire.pair,loot.resource.fire_essence"}}}
The answer is {match_id, status: accepted|late|rejected, accepted: n, replayed: n, rejected: [keys], detail}.
A key the player already sent is a replay. Nothing is paid on this call. The otomo SDK's hosting layer
sends both for you (P2PPeerReporter, HostSession.ReportOutcomeAsync).
When it pays¶
When the match ends, the matchmaker records its roster, its origin (p2p_host) and its host.
After your settle_after delay, otomo settles the match once:
- reports from players who were not in the match are ignored, and a report naming the match
after the roster exists is refused (
not_in_match,not_p2pfor a dedicated match); - only the host's outcome counts, and only for the players it marks present;
- your policy turns what it believes into reward classes, and each player's classes go through the
match-report path:
classes.*.max_per_match,match.max_classes,match.max_units, the budgets (use"tier": "p2p_host"or"*") andmode(observecounts,enforcecuts); - a report that arrives after settlement is kept and answered
late; it pays nothing.
The policy: economy.trust → p2p_host¶
"p2p_host": {
"trust": "players",
"settle_after": "60s",
"facts": {
"loot.pickup": {"class": "loot.resource.{resource}", "count": "amount", "max_count": 1, "max_per_match": 100}
},
"outcome": {
"results": ["completed"],
"classes_field": "reward_classes",
"allowed_classes": ["mission.reward.*", "loot.resource.*"],
"max_classes": 64,
"refuse_if": {"debug_commands": "1"}
}
}
| Field | Meaning | Default |
|---|---|---|
trust |
none: keep reports, pay nothing. host: believe only the host (its outcome and its own facts). players: believe each player about its own facts, and the host about the outcome |
none (also when there is no p2p_host section) |
settle_after |
how long after the match ends reports still count (0 to 24h) | 60s |
facts.<name> |
your claim rule for a fact name: class (a declared reward class, or a template whose {field} parts come from the fact's fields), count (the numeric field that says how many; absent means 1), max_count (cap per fact, default 1), max_per_match (cap on the rule's total per player per match; 0 is no cap) |
none: an unknown fact pays nothing |
outcome.results |
which results pay (completed, failed) |
none |
outcome.classes |
classes every present player earns for such a result | none |
outcome.classes_field |
the outcome field where the host lists the classes it rolled (comma separated). Needs allowed_classes; a class outside it is ignored. A class may repeat: each repeat is one more |
none |
outcome.max_classes |
the most entries taken from that list | 16 |
outcome.refuse_if |
outcome fields that void the whole match, e.g. a host that offered debug commands | none |
A mistake in the document (an undeclared class, an unknown trust level) is a load failure: the economy keeps the last good rules and logs why.
Turning it on¶
- Create the
economy.trustnamespace (audience server) if your deployment has none, and publish your document in a release on the channel the economy reads. - Switch a matchmaking pool to
"transport": "p2p_host"(see Game servers). - Watch the economy's log for
p2p match settledlines, andmatch_reportrows with tierp2p_hostin the admin website's player ledger.
To stop paying, publish "trust": "none": matches already settled stay paid, later ones pay nothing.