Explore the Map
The season map is served by two endpoints, split by how often their data changes. The whole map is public — every tile reports its terrain and its occupant to every player, whether or not you have placed a town and however far away the tile is. Nothing on either endpoint is redacted.
| Endpoint | What it returns | How often it changes |
|---|---|---|
GET /api/v1/map/terrain/ | Every tile’s coordinates and tile_type | Never within a season — fetch a region once and cache it |
GET /api/v1/map/occupants/ | Only the occupied tiles, with the settlement on each | Whenever a town is founded, captured from barbarians, razed, renamed, a settlement’s or a valley’s level changes, or a valley changes hands — poll this |
Both endpoints share the same bounding-box parameters and the same cursor-based paging, described below.
Shared query parameters
| Parameter | Type | Description |
|---|---|---|
x_min | int | Optional. Only include tiles with x >= x_min. |
x_max | int | Optional. Only include tiles with x <= x_max. |
y_min | int | Optional. Only include tiles with y >= y_min. |
y_max | int | Optional. Only include tiles with y <= y_max. |
limit | int | Tiles per page. Terrain: default 2000, max 5000. Occupants: default 100, max 500. |
cursor | string | Optional. The next_cursor of the previous page, passed back unchanged. |
since | datetime | Occupants only. A previous response’s version for the same bounding box: return only what changed since — see Polling for changes. |
The bounding-box parameters restrict results to an inclusive rectangle. A bound past the edge of your realm’s map is fine (nothing is there, so a client may pad its viewport freely); a negative value, or one above 2,147,483,647 (the largest coordinate a map can store), is rejected with 422. Both endpoints return tiles ordered by x, then y.
Cursor paging
The map endpoints use a keyset envelope instead of the count/offset envelope the rest of the API uses:
{ "limit": 2000, "next_cursor": "12:47", "results": [ ... ] }There is no total count — counting a filtered region on every request would cost a full scan for a number the client does not need. next_cursor is non-null exactly when another page exists; pass it back as cursor until it comes back null. The cursor is opaque; a malformed one is rejected with 422.
GET /api/v1/map/terrain/
Returns every tile in the region with its terrain type. Terrain is generated once when the season’s map is created and is never modified afterwards, so a client should fetch each region it displays once and keep it for the session.
import httpx
response = httpx.get( "http://localhost:8731/api/v1/map/terrain/", headers={"Authorization": "Bearer your-token-here"}, params={"x_min": 0, "x_max": 49, "y_min": 0, "y_max": 49},)print(response.headers["ETag"], response.json())curl "http://localhost:8731/api/v1/map/terrain/?x_min=0&x_max=49&y_min=0&y_max=49" \ -H "Authorization: Bearer your-token-here"const response = await fetch( "http://localhost:8731/api/v1/map/terrain/?x_min=0&x_max=49&y_min=0&y_max=49", { headers: { Authorization: "Bearer your-token-here" } });const data = await response.json();Response
{ "limit": 2000, "next_cursor": null, "results": [ { "x": 0, "y": 0, "tile_type": "forest" }, { "x": 0, "y": 1, "tile_type": "plains" } ]}| Field | Type | Description |
|---|---|---|
x, y | int | Tile coordinates. |
tile_type | string or null | Terrain type (e.g. “plains”, “forest”, “mountain”). null if the realm defines no terrain types. |
Caching
Because terrain is immutable for the season, every terrain page is served with HTTP validators:
ETag: a strong validator derived from the season, the bounding box, the cursor and the page size. The same request always produces the same ETag for the same season.Cache-Control: private, max-age=3600andVary: Authorization: a browser or an HTTP cache may reuse the page for an hour without asking, per bearer token.If-None-Match: send a previously received ETag and the server answers304 Not Modifiedwith no body — without running the tile query at all. Browsers do this automatically for cached responses; a scripted client can do it by hand.
The max-age is bounded rather than infinite so a client that keeps a realm token across a season rollover revalidates within the hour.
GET /api/v1/map/occupants/
Returns only the occupied tiles of the region — every town, colony, barbarian settlement and valley — with the settlement fields a map needs to draw it. Empty tiles are omitted, which is what makes this poll small: a viewport of thousands of tiles usually holds a few dozen settlements.
This is the map’s live endpoint. It is served with Cache-Control: no-store; instead of HTTP caching it carries its own version, so a re-poll of an unchanged region costs almost nothing — see Polling for changes.
import httpx
response = httpx.get( "http://localhost:8731/api/v1/map/occupants/", headers={"Authorization": "Bearer your-token-here"}, params={"x_min": 0, "x_max": 49, "y_min": 0, "y_max": 49},)print(response.json())curl "http://localhost:8731/api/v1/map/occupants/?x_min=0&x_max=49&y_min=0&y_max=49" \ -H "Authorization: Bearer your-token-here"const response = await fetch( "http://localhost:8731/api/v1/map/occupants/?x_min=0&x_max=49&y_min=0&y_max=49", { headers: { Authorization: "Bearer your-token-here" } });const data = await response.json();Response
{ "limit": 100, "next_cursor": null, "version": "2026-09-05T16:20:31.412Z", "delta": false, "results": [ { "x": 2, "y": 3, "town": { "id": "uuid", "name": "My Town", "npc_level": null, "town_type": "normal", "valley_type": null, "valley_level": null, "valley_owner_town_id": null } } ]}| Field | Type | Description |
|---|---|---|
version | datetime | The server time this page was read at. Send it back as since to poll for changes. |
delta | bool | false for a snapshot (no since sent), true for a delta. |
x, y | int | Tile coordinates. |
town | object or null | The settlement on this tile. null only in a delta, as a tombstone (see below). |
town.id | uuid | Its id — pass it to GET /api/v1/map/towns/{town_id} for the owner, prestige, alliance and diplomatic status. |
town.name | string | Its name. |
town.npc_level | int or null | null for a player-owned town, or an integer for a barbarian settlement — higher means a tougher garrison and a richer resource pool. |
town.town_type | string | "normal" for a city, "colony" for a colony. Colonies have no walls, so a garrison standing in one is all that defends it. |
town.valley_type | string or null | null for a town, colony or settlement; the terrain type (grassland, swamp, lake, hill, desert, forest) for a valley. |
town.valley_level | int or null | A valley’s current level, 1–10; null otherwise. |
town.valley_owner_town_id | uuid or null | The id of the city holding the valley, or null while it is unowned (and always null on anything that is not a valley). |
town carries only what the map renders. The owner, alliance and diplomatic status are deliberately not here — they are per-viewer and per-relationship data, served on demand by GET /api/v1/map/towns/{town_id}.
A tile whose settlement has decayed into a ruin is not listed at all: the tile is freed for resettlement rather than shown as a level-0 occupant.
Polling for changes (since / version)
Every occupant response carries a version. Re-request the same bounding box with since=<version> and the response is a delta instead of a snapshot: only the tiles whose occupant changed after your version. “Changed” means exactly what this endpoint renders — a settlement was founded or placed, captured from the barbarians, razed or ruined, renamed, its npc_level moved, or a valley’s valley_level or valley_owner_town_id moved. A player town changing hands is not a change here (the owner is not part of this payload; ask GET /api/v1/map/towns/{town_id} for it).
{ "limit": 100, "next_cursor": null, "version": "2026-09-05T16:20:46.020Z", "delta": true, "results": [ { "x": 7, "y": 7, "town": { "id": "uuid", "name": "Newholm", "npc_level": null, "town_type": "normal", "valley_type": null, "valley_level": null, "valley_owner_town_id": null } }, { "x": 3, "y": 3, "town": null } ]}The rules of a delta:
- A row with a
townis the tile’s current occupant — set it (or replace whatever you had). - A row with
"town": nullis a tombstone: the tile was occupied when you last polled and is empty now — clear it. A snapshot never contains tombstones. - Nothing else in the bounding box changed. An unchanged region returns an empty
results— one indexed lookup on the server, whatever the world size, and a few dozen bytes on the wire. - Take the
versionfrom the delta response and send it as the nextsince. Keep doing that as long as your bounding box is the same; a delta only describes the box its version was issued for, so a moved viewport starts again with a snapshot (dropsince). - Deltas are idempotent by design: a change is re-sent for a short overlap window (30 seconds) after it lands, so a poll whose
versionwas stamped while the changing transaction was still open cannot miss it. Applying the same row twice must be harmless in your client — it is a plain “this tile now has this occupant” statement. - A malformed
sinceis rejected with422; asincewithout a timezone is read as UTC. If a poll fails for any reason, dropsinceand take a fresh snapshot. - Deltas page with
cursorexactly like snapshots. When a response spans several pages, keep the first page’sversionas your nextsince— a change that lands while you are paging is then re-sent, never skipped. - You must take a fresh snapshot at least every 5 minutes (
MAP_OCCUPANT_DELTA_MAX_AGE_SECONDS, 300 s). Asinceolder than that is answered with a snapshot anyway (delta: false) rather than a delta, because against an old enough version every tile in the box counts as “changed”; and deltas are only guaranteed complete for writes that commit within the overlap window, so the periodic snapshot is the safety net. - Deleting one of your own towns (
DELETE /api/v1/towns/{town_id}) razes it and frees its tile: the next delta carries the tombstone.
The web client polls its viewport this way every 15 seconds, keeping the same bounding box while the viewport stays inside its fetch margin, and takes a full snapshot again every five minutes.
No fog of war
Restfall has no map fog. Distance never hides a tile, an occupant, or a town’s public profile, and there is no per-player visibility radius.
What Restfall does hide is force rather than geography: whatever an incoming attack’s target has not raised its Watchtower far enough to read, attacks still far from landing (or aimed at a town with no Watchtower), and enemy garrisons and stockpiles. See the information model for the full picture, and Scouting for how to measure a target.
Map Generation
The map grid is created when a season is set up, so the full map exists before the first player joins. The grid size is configured per realm. Terrain is assigned at that moment and never changes for the life of the season — which is what lets /terrain/ be cached.
Tile Types and Production Bonuses
Each map tile has a terrain type (e.g. plains, forest, mountain, fertile) defined in the realm configuration, and the tile_type field is included in the terrain response for every tile. On the shipped realms terrain is scenery: a town’s own tile grants no production bonus (the per-tile 1.5× that predated valleys is retired), and what the terrain decides is which valley types are seeded on it — lakes in the fertile country, hills in the mountains, forest valleys in the forests. Production bonuses come from the valleys a town holds.
A realm may still attach a per-resource multiplier to a tile type; GET /api/v1/resources/ lists any such multipliers under tile_bonuses, and where they exist they compose with a town’s held valleys as described under valleys.