Games

Generic HTTP bridge

How to connect Generic HTTP bridge to valkyr: install the bridge, configure it and see which events and actions it supports.

Method
Plain HTTP and JSON
Status
experimental
Events
frame shot ability economy item sound spawn profile decoy match_end client
Actions
kick restrict ban

Any game server that can make HTTP requests can use valkyr without a dedicated plugin. This page is the whole protocol; the full reference is the valkyr-server API (v1).

Protocol in five rules

  1. Transport: HTTP/1.1, JSON bodies in UTF-8, default base URL http://127.0.0.1:7420. Authenticate with Authorization: Bearer <key> (role ingest for everything on this page).
  2. Units: meters, Y up. Yaw in degrees around Y, 0 looks along +Z and 90 along +X. Pitch in degrees, positive looks up. Times are integer milliseconds: server_time_ms on your server clock (monotonic), and client_time_ms as reported by the client (use the server time when you do not have one).
  3. Players are unsigned 64 bit integers chosen by you (account ids). Write them as JSON integers, not strings or floats.
  4. Events are objects with a type: frame, shot, spawn, sound, ability, economy, item, profile, decoy, match_end, client. Send them in time order, in batches of at most 5000, to POST /v1/matches/{match_id}/events. The match is created on first use; end it with POST /v1/matches/{match_id}/end.
  5. Enforcement: poll GET /v1/actions?since=<cursor>&limit=100 every few seconds, apply each action (kick, restrict, ban if you enabled it) to the matching player, and pass the returned cursor as since next time. Or configure a webhook on the valkyr-server instead of polling.

Event shapes

JSONJSON
{"type":"spawn","player":7,"server_time_ms":0,"position":{"x":0,"y":0,"z":0},"team":1}{"type":"frame","player":7,"seq":1,"client_time_ms":10,"server_time_ms":30, "position":{"x":0,"y":0,"z":0},"yaw":90,"pitch":0,"on_ground":true,"jump":false}{"type":"shot","player":7,"client_time_ms":500,"server_time_ms":520,"weapon":1, "yaw":90,"pitch":-2,"target":8,"bone":"head","latency_ms":25}{"type":"sound","player":8,"server_time_ms":530,"position":{"x":4,"y":0,"z":9},"radius":20}{"type":"ability","player":7,"server_time_ms":900,"ability":3}{"type":"match_end","server_time_ms":600000}

Optional fields can be left out (target, bone, latency_ms, team, on_ground, jump).

curl examples

ShellShell
KEY=replace-with-an-ingest-keyBASE=http://127.0.0.1:7420 ## Health (no key needed)curl -s $BASE/v1/health ## Level geometry (optional, enables line of sight and noclip checks)curl -s -X PUT $BASE/v1/matches/m1/world \  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \  -d '{"colliders":[{"min":{"x":-1,"y":0,"z":9},"max":{"x":1,"y":3,"z":10}}],"occluders":[],"floor_y":0.0}' ## A batch of eventscurl -s -X POST $BASE/v1/matches/m1/events \  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \  -d '{"events":[        {"type":"spawn","player":7,"server_time_ms":0,"position":{"x":0,"y":0,"z":0},"team":1},        {"type":"frame","player":7,"seq":1,"client_time_ms":0,"server_time_ms":50,         "position":{"x":0,"y":0,"z":1},"yaw":0,"pitch":0,"on_ground":true,"jump":false}      ]}'## -> {"accepted":2,"verdicts":[]} ## Enforcement queuecurl -s "$BASE/v1/actions?since=0&limit=100" -H "Authorization: Bearer $KEY"## -> {"actions":[{"id":12,"player":7,"action":"kick","reason":"...","match_id":"m1","at_ms":123}],"cursor":12} ## End of matchcurl -s -X POST $BASE/v1/matches/m1/end -H "Authorization: Bearer $KEY"

Errors come back as HTTP 4xx or 5xx with {"error":{"code":"snake_case_code","message":"..."}}.

Guidelines

  • Send what the server knows: positions after your own movement code ran, shots your server accepted. Do not trust client claims more than your server does.
  • Batch every 100 to 500 ms; one request per event wastes CPU on both sides.
  • Keep the valkyr-server on localhost or a private network. It speaks plain http://; put a TLS terminating reverse proxy in front of it if traffic has to cross a public network.
  • Use one match id per match (or per server session for persistent worlds), and one id prefix per game server when several share a valkyr-server, because the action queue is shared.

WebSocket

valkyr-server does not offer a WebSocket endpoint. Batched HTTP requests are enough for telemetry; if you need push delivery of actions, use the signed webhooks instead of polling.

Status: the protocol above follows the valkyr-server v1 contract; the curl lines were not run against a live server here.

Game and platform names belong to their owners and are used only to describe compatibility. valkyr is not affiliated with them.

Edit this page on GitHub