Docs · Arena
Arena
A grid game where bots think onchain. Train a brain, enter it, play.
The arena is a survival game on a grid. Every tick, each player turns left, keeps straight or turns right, then moves one cell and leaves a trail. Hitting a wall, a trail, or the cell another head targets the same tick knocks you out. The last one standing takes the pot (minus 5 %).
A bot's brain
A bot is any registered model with 64 inputs and 3 outputs. At every tick the arena builds the bot's view and calls the model:
- the view is 8×8 cells, centered in front of the head and turned so the bot always faces up; row 0 is the farthest ahead, the head sits at row 7, column 4;
- each cell is
0(free),127(wall or trail) or64(an opponent's head); - the outputs are left, straight, right; the highest logit wins.
Train any policy that maps this 8×8 view to three logits, export it to ONNX and compile it like any other model. The view, the starting cells and the collision rules are exactly the contract's, so what you measure offline is what plays onchain.
Read matches over HTTP
GET https://www.usewired.net/api/v1/arena gives the contract, the number of matches and the brains already entered. GET https://www.usewired.net/api/v1/arena/matches/{id} gives one match:
{
"id": "1",
"status": "finished",
"size": 14,
"tick": 62,
"winners": [2],
"players": [
{ "seat": 0, "kind": "bot", "brainName": "Warden", "alive": false, "diedAt": 3, "head": { "row": 5, "col": 8 }, "dir": "down" }
],
"grid": [[4, 4, 4, …], …]
}grid has one number per cell: 0 is free, n is the trail of seat n - 1.
Play a match
From the site: Arena picks the brains, creates the match, starts it and advances it with a key kept in your browser.
From a contract or a script, call the arena contract:
| Function | What it does |
|---|---|
createMatch(uint8 size, uint8 maxSeats, uint128 entry, uint32 tickBlocks, uint32 openBlocks) | Opens a match and returns its id. Size 8 to 24, 2 to 8 seats. |
joinBot(uint256 id, bytes32 brain) | Enters a bot. The match starts as soon as it is full. |
join(uint256 id, address pilot) | A human seat. pilot is a session key that steers without a wallet popup. |
steer(uint256 id, uint8 seat, uint8 turn) | Human seats only, from the pilot: 0 left, 1 straight, 2 right. |
start(uint256 id) | The creator can start from two players; anyone once the match is full or registration closed. |
tick(uint256 id) | Anyone can advance a running match once tickBlocks have passed. |
cancel(uint256 id) | Refunds a match that never reached two players. |
viewOf(uint256 id, uint8 seat) view returns (bytes) | The 8×8 view a brain would get right now. |
Starting cells and directions are drawn from a seed taken from the previous L2 block hash when the match starts.
Entries and the pot
entry is in USDG (6 decimals). Each seat pays it when joining (approve the arena first); the winner takes the pot minus 5 %. Ties split it.
Arena contract: 0x2723b2c2eb008b6d1800cdc58a436865336231c6.