- A hostile test client crafts INPUT packets byte by byte and sends them
through NetGame.take_input() into a real match: extreme axes, the same
tick claimed repeatedly, the whole lead window at once, past, far-future
and maximum ticks, fire toggled every tick with slot swaps, builds aimed
anywhere with junk kinds and materials and no materials, and
pickup/drop/select tricks. Speed stays within sprint speed per tick,
shots within the weapon's rate, pieces within build reach and paid for,
and every item is conserved.
- Fix: a command tick beyond the simulation's lead window no longer moves
NetGame's dedupe marker, so one bogus far-future tick can't lock out a
player's real commands.
- Connections are rate-limited per address (32 per 10 s, 8 handshakes in
progress) with a new REASON_BUSY and a message for it.
- ParserFuzz mutates real messages from a bot match and random bytes and
feeds them to every network decoder, the snapshot receiver and the list
server. 20,000 per make check; make fuzz runs 1,000,000 (about 40 s):
no errors, 2.9 KB of memory growth.
- ARCHITECTURE.md: "Trusting nothing from clients".
Closes#40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- LAN discovery: a listening server answers QUERY packets on its game port
plus one (ServerBeacon, off with --no-lan). ServerBrowser scans eight game
ports from 24650 by broadcast.
- A self-hostable list server: --list-server [--port=N] (ListServer,
default UDP 24660). Game servers register with --list=HOST[:PORT] and
--name=NAME; they are listed under their source address only after
echoing a CHALLENGE token. Entries expire after 45 s, 8 per address,
256 in all; every source is rate-limited (SourceLimiter).
- NetDiscovery messages: every QUERY is padded to 512 bytes and no answer
is bigger, so neither service amplifies spoofed requests.
- tidewall --browse [--list=...] [--lan-target=IP] [--lan-port=N] prints
the servers found as JSON until menus (A10) show them.
- People who connect mid-match or during results watch a living player
(Match.watch) and take places ahead of bots in the next lobby, instead
of being told the server is full. Bots fill only the places left when
the match starts.
- Tests: codec round trips, size limits and a 40,000-message fuzz; list
server with fake servers (challenge, stolen and wrong tokens, renewal,
expiry, caps, flood); LAN scan over loopback; watchers over UDP; lobby
backfill. make discovery-check runs it all as real processes.
Closes#37
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The client program now turns a connection into a match someone can play.
- ClientSession: a ClientGame, the keyboard and mouse as commands
(ClientInput), and a MatchView of the client's own copy of the world.
- ClientMirror writes what the client is showing into that world every
frame: other players from the recent past, its own player where it was
predicted, items, the barge, the clock and the sea. The existing views
draw it unchanged.
- LocalServer: offline play is the same ServerLoop and NetGame in the same
process, with packets handed across in memory, so there is one path.
- main.gd: --connect=HOST[:PORT] joins a server, otherwise an offline
match; --autoplay and --client-seconds=N for scripts and checks.
- The camera aboard the barge follows the player's own place on the deck.
Tests drive a scripted client through a whole match on a real server over
loopback UDP, lobby to results, and through an offline match. `make
client-check` does it with two real processes, and `make client-captures`
renders what the client sees.
Closes#77
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Built pieces, props' health, opened chests and the tide's schedule now reach
clients as WORLD messages on the reliable channel, and each player is told
what they carry as OWN messages.
- NetWorld: the WORLD and OWN wire formats, and world_hash(), a digest of
everything replicated this way.
- WorldSender: one message after each tick in which something changed, the
same for everyone, and the whole state for someone joining or a new match.
StructureSet and PropSet keep the change lists it reads.
- ClientWorld: applies them to the client's world, so pieces and broken props
are solid for prediction. A piece's health follows from its building and
damage, so building costs nothing on the wire.
- Placing ahead of the server: a provisional piece goes up with the command
and is replaced by the server's, or taken back once a snapshot shows the
server had its chance. Snapshots carry the newest WORLD number for that.
- Protocol version 3.
A test plays a whole scripted match on a real island with a ClientGame
attached and compares the two worlds' hashes throughout.
Closes#36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A network client draws other players in the past and its commands take time
to arrive, so by the time the server fires a shot the target has moved on:
8 ticks at a 50 ms round trip, 12 at 200 ms.
Each PlayerCommand now carries view_lag: how far back its player was seeing
everyone else, in quarter ticks. The simulation keeps where every player's
body has been for the last 15 ticks (HitHistory), and a hitscan shot is
traced against other players where they were at the moment the shooter saw,
and against the world as it is now. Projectiles aren't rewound.
The client claims only when it was looking and where it aimed; the server
works out the hit from its own record. The moment is never more than
Tuning.LAG_COMPENSATION_MAX_TICKS back, never in the future, and never
earlier than a moment the same player has already claimed.
Commands are 15 bytes, so the command log's version is 2. The lag is in the
log, and replays judge every shot as the match did.
Measured in test/net/test_lag_compensation_link.gd over a simulated link:
a client firing at a walking target as drawn on its own screen hits 41 of
41 shots at 50, 100 and 200 ms round trips, 0 of 41 with the lag ignored,
and 0 of 41 at 500 ms, past the cap.
Closes#35
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The client's side of a networked match, in src/net/:
- ClientGame takes the server's notices and snapshots, generates the island
from the seed and answers with commands. It works on packets, so it runs
over a NetClient or a test's simulated link.
- ClientClock decides which tick the next command is for, from the server's
echo of the newest command tick it has received, holding three commands
waiting at the server.
- ClientPrediction runs each command on a copy of the client's own player
with the server's movement code, and compares every snapshot with what it
predicted. A difference is replayed from the server's state and eased in.
- SnapshotInterpolator draws everyone else four ticks in the past, between
snapshots, on a clock steered gently by arrivals.
Snapshots now carry the client's own block: exact position and velocity,
the water around the player, stamina and state flags, so a prediction can
match the server to the bit. The command echo is now the newest tick
received rather than taken. Protocol version 2.
Snapshots go out every second tick. The interval was three ticks, which is
10 a second, not the 20 the documents claimed; 15 a second is the nearest
even spacing and what interpolation is tuned for.
Drop.ride() holds the barge ride for the server and the client alike, and
NetGame's joining, input and snapshot steps can be called without a socket.
Measured in test/net/test_prediction_link.gd over a simulated link with
100 ms each way, 20 ms jitter and 2% loss: no corrections to own movement
in about 1,400 snapshots per client, and the other player drawn 0.4 mm on
average from where a perfect link would draw them.
Closes#34
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NetSnapshot defines the game traffic after the handshake: delta snapshots of
quantized entity records, the client's input packet and a reliable match
notice. SnapshotSender builds each client's snapshot against the newest one
it acknowledged, tells it only about entities near the player it is watching,
and keeps every snapshot under 1,200 bytes, nearest first, with a staleness
bonus so nothing starves. SnapshotReceiver rebuilds the picture, ignores old
and repeated snapshots and asks for a fresh start if it is ever sent a delta
on something it doesn't hold.
NetGame joins the transport to the match: people who connect become
participants, their inputs go through ServerLoop.submit() once per tick, and
snapshots go out 20 times a second. `--server --listen` makes the headless
server take network players and wait in the lobby for the first of them.
Measured by test on a 24-player match start with every player a client, a
tenth of packets lost and late acknowledgements: 2.4 KB/s mean and 2.5 KB/s
for the worst client, packet headers included, against a 40 KB/s limit.
Closes#33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`make bot-matches` failed on its default seeds because its difficulty checks
(easy places worst, hard takes the most eliminations) are noisier than the
differences they look for over 20 matches.
Measured on three 20-seed batches (seeds 1-20, 21-40, 101-120): easy bots won
0, 4 and 2 matches against an even share of 6.7, and took the fewest
eliminations every time. Mean place doesn't separate the levels, and hard is
not reliably ahead of normal by any whole-match measure.
The batch now checks that easy bots win less than an even share and take the
fewest eliminations, and skips the difficulty checks under 20 matches, where
they mean nothing. Hard against easy stays covered by the duel test.
Closes#76
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ENet over UDP, used directly through ENetConnection, with a handshake before a
connection counts as a player.
- NetProtocol: HELLO, WELCOME and REJECT layouts, the protocol version, name
cleaning, the reasons a connection ends and a sentence for the player about
each. Decoders return nothing for malformed input and never raise an error.
- NetServer: listens, takes each guest through the handshake, and reports
joined, left and refused. It refuses a different protocol version, a full
server, a malformed HELLO and a guest that stays silent, each with its own
reason. Handles are never reused; duplicate names get a number.
- NetClient: connects, introduces itself, and ends up joined or closed with a
reason. Leaving says goodbye so the server knows at once; a client that
vanishes is dropped by ENet's timeout.
- Tests run a real server and clients over loopback UDP, with bare ENet peers
sending malformed and random packets.
The headless server doesn't listen yet; N2 connects this to the match.
Closes#32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`make match` plays one whole match from the lobby to the results and back to the
lobby: one scripted player and 23 bots on a local server, with no script errors.
- CommandLog records the seed, the rules and every command the server is given.
MatchReplay plays a log again with nobody thinking and ends on the same state
hash; `make match` saves the log, reads it back and checks that.
- ServerLoop.submit() is now the one way commands reach the simulation, so a
recording server sees them all.
- ScriptedPlayer plays a human seat: it drops, loots, fights and flees as a bot
does, and also cuts driftwood and builds a breakwater and a wall.
- Bots draw randomness from their own per-bot generators, not the simulation's
streams. A bot thinking no longer changes the simulation's state, which a
replay without bots needs.
- MatchView and EntityView draw a match from one Simulation: terrain, sea,
points of interest, props, pieces, players, the barge, items and chests, with
stand-in shapes for the art pass to replace.
- `make match-captures` renders eight stages of the recorded match.
Closes#31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BotBrain plays a match with the commands a player sends: it picks a landing
marker near the barge's route, loots points of interest (following their own
walking routes into huts, lofts and piers), fights opponents it can see,
bandages itself, and gets to ground the coming tide will leave dry. BotWorld
is the map every bot shares: loot markers, routes, and each tide phase's safe
ground, which is the dry land joined to the island's highest walkable ground.
Three difficulties (Tuning.BOT_DIFFICULTIES) set reaction time, sight range
and aim error. The server mixes them unless --bot-difficulty says otherwise.
NavGrid labels connected regions when it is built, so a goal that is cut off
is turned down without a search of the whole island (about 70 ms each).
make bot-matches plays 20 bot-only matches and checks winners, drownings and
difficulty. Seeds 101 to 120: 20 of 20 with a winner, 7 of 460 deaths were
drownings (1.5%), easy bots placed worst (13.7 against 11.8 and 12.0) and
hard bots took the most eliminations (186 against 137 and 132).
Closes#28
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NavGrid is the map bots plan on: a point per 2 m terrain sample, solid on cliffs and
where solids stand between step and head height, and costlier where the water is
deeper than wading. Path search uses Godot's AStarGrid2D. The grid syncs every tick:
new solids (walls, pieces) block points at once, removed ones are found by a rolling
scan, and points turn wet as the tide and flood reach them. Each change is stamped
with its tick.
NavBot follows a path with ordinary PlayerCommands: it steers at waypoints, sprints
on long dry stretches, jumps when stalled, and marks a point blocked after repeated
stalls. Every half second it checks its remaining path against the change stamps and
plans again if water or a wall now crosses it. One path is planned per server tick
across all bots.
The server builds the grid while the lobby waits and its bots now roam between
random reachable places, replacing the placeholder wander bot.
Tests: 150 of 150 random reachable targets reached on 50 islands in the sweep; the
test runs 2 per island and needs 95%. New walls and rising water both cause a new
path around them; a broken wall opens the grid again; with no dry way round, the bot
swims. 23 roaming bots on an island: p99 tick 1.6 ms against the 12 ms budget.
Closes#27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The simulation now names what ended each player: weapon, fall, drown or tide, from
the cause of the blow that took the last health. Hits carry the weapon's item code.
Match keeps a kill feed (eliminator, cause, weapon, tick), per-player stats (damage
dealt and taken between opponents, eliminations, never teammates), and a summary()
with place, eliminations, damage and survival time. Players who fall on the same
tick share the better place and are marked tied. When the last players fall
together, the tie-break raises one team to first and the rest share the next place.
Eliminated players spectate: first whoever knocked them out, then a living
teammate, then the next living player in join order. When a target falls or
leaves, the view follows its eliminator or moves on, on the same step. Spectators
can cycle forwards and back. In results everyone watches the winner.
The headless server logs every placement and the match summary.
Closes#26
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tide now runs every match, from the drop on, and water flows along the
terrain instead of standing everywhere under one level.
- Tide (src/sim/tide.gd): Tuning.TIDE_PHASES as a schedule of holds and
rises. Level, forecast (each hold announces its level), stage, drowning
rate, surge timing and the time limit are pure functions of the tick.
- SafeGround (src/sim/safe_ground.gd): safe ground from elevation on an 8 m
grid, and per-island planned levels. A phase's level is lowered, when it
must be, to just under the top of the largest piece of land still dry when
the phase begins; every phase still rises at least TIDE_MIN_RISE_METRES and
the last keeps its table level.
- Flood (src/sim/flood.gd): a 4 m grid aligned with building cells. Water
reaches cells from the world's edge through ground under the sea and edges
no breakwater stack seals. Cut-off ground stays dry until overtopped or
breached, then fills at BREACH_FLOW_METRES_PER_SECOND. Incremental: only
the edges where water stopped are re-tested, once a second.
- Players, drowning and structure wear use the local water. Breakwaters wear
by head and fail past BREAKWATER_MAX_HEAD; a breach floods what's behind.
- Storm surges: each phase's `surge` damage hits pieces near the water when
its rise begins.
- Sudden death after the last rise, then a time limit. Match breaks ties
(most health, highest feet, earliest join) at the limit and when the last
players fall together, so every match ends with a winner.
Tests: test_tide (18) covers the schedule and forecasts, planned levels,
overtopping, a sealed ring, breach and fill rate, spill-over, pressure wear
and head failure, dry pieces, surges, drowning under the real tide, sudden
death, the time limit and simultaneous eliminations. test_island's 100-seed
sweep now checks that every phase leaves safe ground reachable on foot from
the whole main landmass within the phase's time (closest margin 14 s).
A full rise with 24 bots measured p99 1.5 ms, max 1.9 ms per tick.
Closes#25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Match (src/sim/match.gd) runs a server's matches back to back: lobby,
countdown, drop, play and results, then a fresh island and the lobby again.
It is stepped once per server tick and has no scene-tree or clock dependency.
- MatchRules holds max and min players, team size, the lobby, countdown and
results timers (defaults in Tuning.MATCH_*) and whether bots fill empty
places.
- Participants are server-chosen handles. Joining during a match waits for
the next; leaving during the drop or play places the leaver as eliminated.
- Placements, winners (last team standing) and events for phase changes,
joins, leaves, places, match start and end.
- Match 0 uses the server's seed; later matches derive their seed from it and
their index. The next match's Simulation is built when the lobby opens.
- ServerLoop now drives a Match (immediate rules by default, so the smoke
match is unchanged: same state hash), rebuilds bots each match, and counts
server ticks across matches. The headless server logs match events.
Tests: test_match (13) covers every transition, leaving in each phase, an
empty lobby, an empty match, teams, late joiners, and ten consecutive matches
that each start identical to a freshly built simulation. A ServerLoop test
checks the server goes back to the lobby and starts the next match.
Closes#24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seeded loot at every point of interest's loot markers, rolled once per match
from the "loot" stream by LootSet.plan() and placed by Simulation.place_loot().
- Each marker holds a sea chest (chance by location) or floor loot (rolls on
the location's weapon/consumable/ammo/nothing weights). Weapons roll a tier
from the location's tier weights and come with their ammunition; chests
hold a weapon (best of two tier rolls), a consumable and spare ammunition.
- Interact opens the nearest closed chest in reach unless a pickup is nearer,
and spills its contents as pickups.
- Washed-up crate props hold one roll of the crate table and spill it when
broken by any means.
- If the rolls leave fewer POI weapons than LOOT_MIN_POI_WEAPONS (one per
player in a full lobby), extra weapon rolls top up floor spots.
- Chest and crate state is part of state_hash(). ServerLoop places loot.
Tests: test_loot (12), including a statistics run of 1,000 loot seeds over
four generated islands that checks tier shares against the tables, that
shrines beat hamlets, and that every match has a weapon per player at POIs
and 1.25 per player counting crates.
Closes#23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Eight slot weapons: the six from the design plus the rivet repeater (fast,
short-range automatic) and the harpoon gun (slow heavy bolt, 2.5x damage to
built pieces). Four quality tiers, Rusted to Captain's, scale damage and reload
time. The line thrower now yanks the shooter towards where its line lands,
through a data field (pull_speed) any weapon can use.
Four consumables: sailcloth bandage (heals to 75), brine tonic, cork vest and
the new tar patch. Fire with one held starts using it if it would help; it
takes effect after its use time. Changing slot, dropping, sprinting, swimming
or elimination interrupts it and uses nothing up. All checks run on the server.
A data-validation test covers every weapon, tier, consumable and ammunition
type, including unknown stat keys, name format and that every ammo type is
used. The GDD's weapons section lists the roster.
Closes#21
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Weapons fire from the server's own copy of the shooter's eye and look, at the
weapon's fire rate, from the loaded magazine. An empty trigger pull or the
reload button starts a reload of the weapon's reload time from carried
ammunition; switching slots cancels it. Each shot is one or more pellets
scattered evenly inside a spread cone from the "weapons" stream. Spread is the
hip spread (smaller when aiming), plus bloom that builds in sustained fire,
plus a moving or airborne penalty.
Hitscan pellets trace at once in 16 m segments; projectile weapons (the
whaler's longgun and line thrower) spawn entities that fly under gravity and
trace each tick. A trace stops at the first of terrain, a solid (built pieces
and props take the damage) or another player's body. Players lose armor first,
then health; the top of the body takes the weapon's headshot multiplier; and
damage falls off linearly from range_full to range_max. Stats come from
ItemDef, so adding a weapon is a Tuning entry only.
Closes#20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five slots plus the always-carried boathook (selection 0), ammunition carried
apart from the slots, and items lying in the world as pickup entities. All
changes are made by the server from commands: interact picks up the nearest
pickup in reach, drop (new BUTTON_DROP) leaves the held stack at the feet, and
both act once per press. A full inventory swaps the held item. Consumables and
thrown weapons stack; ammunition stops at its cap and leaves the rest on the
ground. An eliminated player drops everything on a ring around where they fell,
and the simulation now emits an "eliminated" event when health reaches 0.
Item definitions are ItemDef resources built by ItemCatalog from the tables in
Tuning (WEAPONS, ITEMS and the new AMMO), so a new item is a data change only.
Closes#19
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pieces build up health, take damage from the boathook and the tide, and
collapse when nothing connects them to the ground.
- Build-up: a piece starts at 10% of its material's health and gains
the rest evenly over build_seconds. Damage taken while building stays.
- Damage: Simulation.damage_piece, and boathook swings now hit pieces
nearer than any prop for HARVEST_DAMAGE, with no material back.
- Tide: once a second, pieces with their base under the sea lose
TIDE_STRUCTURE_DPS; breakwaters wear per metre of head and fail past
BREAKWATER_MAX_HEAD.
- Integrity: grounded means touching terrain or a fixed solid (not a
prop). On removal, a breadth-first search from the former neighbours
stops at the first grounded piece, so only structures that really
lost support are walked in full; loose components collapse together.
Simulation.ground_changed rechecks grounding after terrain changes.
- Wall skirts now reach at most one level (2 m), so upper walls aren't
grounded through a skirt; terrain checks merge boxes sharing a bottom.
- 12 tests: build-up per material, damage during building, material
strength, fresh pieces breaking, cascades, a second support, boathook
bringing down a wall and its floor, tide wear and breakwater failure,
tide-triggered collapse, terrain-triggered collapse, fixed solids as
ground, and a 564-piece fort (one removal 57 us, worst search 416 us,
full cascade of 479 pieces 4.7 ms).
Closes#17
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Server-authoritative grid building with wall, floor, ramp, roof and
breakwater pieces in driftwood, stone and salvage iron, plus a client
placement ghost.
- StructureSet: pieces in grid slots (floor, two wall edges, cell
volume), their collision boxes in SimGround, and touching-neighbour
links kept up to date for B3. Ramps are stairs of 0.4 m steps; walls
over lower ground get a skirt down to the terrain; roofs are a low
stepped pyramid. Pieces are part of the state hash.
- Building: target() snaps look and position to a slot, and check()
validates any slot as if a hostile client chose it: state, range,
occupancy, trapping a player, cost and support. Fire in build mode
places at most 10 pieces a second; players in a low step are lifted.
- Levels are half a cell (2 m) apart, so ground pieces sit within a
metre of the builder's feet instead of being half buried.
- Client: StructureView draws pieces from their boxes in plank, course
or panel strips; ramps draw as a sloped deck. BuildGhost shows sea
green or rust red from the same target() and check().
- Tests: 15 sim tests (targeting, every rejection, overlap, support,
stairs climbable, skirts, determinism, 24 builders at 10 pieces a
second within the tick budget) and 5 client tests (ghost states,
ghost agrees with the server, view sync, mesh orientation).
- Capture scenarios build_fort and build_fort_side.
Closes#16
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Boathook swings harvest props. The client only presses fire with the
boathook selected; the server casts the swing from its own copy of the
player's eye and look, so range and swing rate are enforced by
construction. Each hit damages the prop and gives its material
(driftwood, stone or salvage iron), capped per material.
- Materials: material codes and add/spend helpers; carried stock lives
on SimEntity.materials and is part of the state hash.
- Harvest: swing interval from the boathook's fire rate, reach from its
range plus slack, nearest prop along the ray, blocked by terrain or
other solids. Emits harvest and prop_destroyed events.
- Simulation: per-tick events list, a shared action cooldown, and fire
with selection 0 outside build mode swings.
- Tuning: HARVEST_DAMAGE, HARVEST_REACH_SLACK, HARVEST_AIM_SLACK.
- 12 tests: yields per kind, rate limit, reach, blocking, nearest prop,
caps, destruction clearing collision, state gating and determinism on
a real island.
Closes#15
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Simulation.start_drop() plans a seeded straight route across the island at
BARGE_ALTITUDE, through a point near the middle pulled onto land, and puts
every player aboard. Riders move with the barge; jump leaps off with some of
its speed. Freefall steers and tops out at FREEFALL_MAX_SPEED; jump opens
the wing-sail, which also opens by itself WING_AUTO_DEPLOY_HEIGHT above the
ground or water. Gliding sinks slowly and steers at GLIDE_SPEED, and the
sail folds just above the ground or sea so landing does no damage. Anyone
aboard at the end of the route is thrown off. Drop state is hashed.
Every server match now starts with the drop. Bots leap at a time fixed by
their player ID. The carrier's name and look are open in #72.
Closes#14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The simulation has a global sea level (Simulation.sea_level, changed with
set_sea_level and read every tick, so the tide can move it mid-match).
Walkers wade more slowly in water over WADE_DEPTH; in water SWIM_DEPTH deep
they swim: floating head-out, sprint-swimming, diving with crouch, kicking
out with jump, and standing again in the shallows. Falling into deep water
does no fall damage. Water tracks breath, stamina and drowning in whole
ticks: swimming spends stamina, an exhausted swimmer slips under, and with
no breath left the tide phase's drown damage lands once a second. All of
it, plus the sea level, is in the state hash.
WaterView draws the sea surface at the simulation's level with a
procedural shader: depth-tinted colour, foam at the waterline, ripples.
Closes#13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PropSet places about 3,000 pines, scrub, boulders, wrecks and crates per
island from the seed, by elevation band with grove noise, clear of points
of interest. Each prop is one collision box in SimGround with health from
Tuning.PROP_KINDS; destroying it removes the box at once
(SimGround.remove_solid). Prop health is part of the state hash.
PropView draws them as one MultiMesh per kind per 128 m square (about 150
instanced draws), with per-kind visibility ranges, procedural flat-shaded
meshes fitted to the collision boxes, and cheap sync of felled props.
Closes#12
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PoiSet.generate(island) places 10 to 16 points of interest per island from
the seed's "poi" stream: hilltop shrines, lighthouses, docks, salt works,
quarries and fishing hamlets, at least 85 m apart. Each kind has a siting
rule (height band, flatness, coast or summit) that loosens step by step
until its minimum is placed. Piers are sited so their deck clears the
ground all the way out to water 1.5 m deep.
Poi assembles each from modular parts in a local frame turned in quarter
turns, so every solid stays an axis-aligned box: walls with a door and
lintel, plinths, steps down to the ground, roofs, a stair to a loft. Each
POI carries loot spawn markers, exposed through PoiSet.loot_markers(),
and walking routes from open ground into its interiors.
- Simulation adds every POI solid to its ground and never spawns players
inside one.
- SimGround indexes solids in 8 m cells, so collision queries only test
nearby boxes. Smoke p95 tick is 0.47 ms with about 300 solids.
- Movement tests the body where it will stand after stepping up, so
stairs with treads narrower than the body can be climbed. The
traversal test found the lighthouse stair impassable without it.
- PoiView draws parts as one MultiMesh per look, in the seafaring
palette. Capture scenarios poi_<kind> frame each kind.
- Summit stone is darker so it no longer reads as snow.
Tests: 30 seeds get every kind within its limits, 10 to 16 in total,
spaced and sited; placement is deterministic; loot markers stand on
floors and are not inside solids; a player walks every route of every
POI on 4 seeds through doors, up steps and the lighthouse stair; stairs
with 0.45 m treads are climbed and a step doesn't carry the body into a
wall; the solid index matches a full scan on 500 queries.
Closes#11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TerrainView draws the island as 16 x 16 chunks of 64 m, each at one of
four detail levels (2, 4, 8 and 16 m spacing) chosen by distance to the
camera. TerrainChunkBuilder builds chunk geometry on WorkerThreadPool
threads; the main thread only uploads finished meshes, within a 2 ms
per-frame budget, nearest chunks first.
- Seams: every chunk hangs skirts deeper than twice the most any level
strays from the full-resolution edge, so neighbours at any two levels
meet without a crack. Normals come from the full-resolution heightfield
at every level, and back faces light like the ground above them.
- Splat material: a procedural shader blends sand, marsh, grass and rock
with weights from the island's bands, averaged over 4 m so borders
blend. Steep ground turns to rock and summits weather pale.
- Collision stays SimGround's heightfield, with no renderer involved.
- Capture scenarios terrain, terrain_lod (tinted by level) and
terrain_cracks (magenta sky). tools/crack_check.gd counts sky pixels
seen through the ground; make terrain-capture requires cracks in a
skirtless control and none in the real terrain.
Tests: chunk vertices sit on the heightfield; skirts cover every pairing
of levels on sampled shared edges; detail falls with distance; flying
across the island at 30 m/s for 2,037 frames streams 661 chunk rebuilds
with the worst main-thread frame at 0.8 to 1.4 ms (headless, CPU only);
24 players over 900 ticks on two generated islands never sink into the
ground, and a player sprints up towards a summit unharmed.
make terrain-capture: control 437 crack pixels, terrain 0.
Closes#10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Island.generate(seed) builds a 513 x 513 heightfield (2 m spacing, the whole
1,024 m world) from the match seed's "worldgen" stream: a warped coastline,
a coastal shelf and interior dome, two to four summits joined by ridges,
rolling and rocky detail, and flattened marsh in wet lowland. Land is scaled
so the tallest summit lands between ISLAND_PEAK_MIN and ISLAND_PEAK_MAX,
under the last tide. Each sample gets an elevation band (sea, beach, marsh,
forest, highland, summit) for terrain materials.
- Simulation generates the island unless a test supplies its own ground,
and spawns players on dry land until the drop arrives.
- The headless server logs world_hash in its start line.
- Island.heightmap_hash() is SHA-256 over millimetre heights and bands.
- tools/island_map.gd draws a top-down map with tide contours.
- New island constants in tuning.gd; GDD gains an island section.
Tests: a 100-seed sweep checks generation time (slowest 617 ms against
5 s), land area, at least two distinct high points, walkable land, bands,
and that no more than 3% of dry land is cut off at sea levels 0 and 8 m
(worst seen 0.87%). A separate server process given only the seed must
log the same heightmap hash.
Closes#9
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Simulation (src/sim/):
- SimGround holds the terrain heightfield (bilinear heights, normals)
and axis-aligned box solids, with support, body-overlap, point and
ray queries. The island generator and building will fill it.
- Movement steps a player per tick: walk, sprint (forward only),
crouch (lower body, slower, no jump), jump with exact constant-gravity
integration, air control, step-up onto ledges up to STEP_HEIGHT,
ground snapping on downhill walks, slopes over MAX_SLOPE_DEGREES that
block walking and jumping uphill and make players slide (speed capped),
ceiling bumps, sliding along walls, and fall damage from impact speed.
- Gravity now applies on ticks with no command. on_ground and crouching
are part of the state hash. New movement numbers are in Tuning.
- Fixed the strafe direction: right is forward x up in Godot's frame,
(-cos yaw, 0, sin yaw). Documented the look convention.
Client (src/client/):
- CameraRig places an over-the-shoulder camera with an eased
aim-down-sights blend (closer, narrower FOV), casting against the same
SimGround: pivot to shoulder, shoulder back, then a straight line from
the pivot, with a final clearance pull-in so the near plane never
enters geometry.
- InputSettings: mouse sensitivity, aim sensitivity scale and invert-Y,
clamped and saved to user://settings.cfg. PlayerCamera applies both.
Tests: 46 new across movement, ground queries, camera and settings,
including a 24,480-view scripted camera sweep through five arenas (wall,
corridor, low roof, corner, steep bank) that checks the eye and every
near-plane corner stay out of geometry with a clear line to the pivot.
The hash test now flips a high stick bit, because a 1/127 nudge to an
airborne player moves them less than the hash's millimetre.
Capture scenarios camera, camera_wall and camera_aim.
Closes#8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/capture.sh <scene-or-scenario> <out.png> renders the real client
in a throwaway tidewall-capture-* Docker container (debian:13, Xvfb,
Mesa software rendering), with no network, no host display, GPU or
audio, and removes the container afterwards. The tidewall-capture image
rebuilds only when its recipe changes.
Forward+ through Lavapipe is the default, matching the game;
CAPTURE_RENDERER=compatibility uses OpenGL through llvmpipe. The script
fails if Godot silently falls back to another renderer, and fails on a
blank frame, judged by ImageStats (luminance variance and colour count).
make capture-test renders the shore test scene with both renderers and
proves an empty scene is rejected. ImageStats has unit tests in
make check. CLAUDE.md now requires a capture for visual issues, and
requires that it be opened and looked at.
Closes#7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`tools/godot.sh -- --server` runs a headless dedicated server with
--seed, --port, --players, --bots, --ticks, --unthrottled and
--log-every. ServerLoop drives the simulation and times every tick
without a scene tree, so tests run it directly. A placeholder WanderBot
gives smoke runs realistic load until the v0.4 bots land.
Logs are JSON lines that all carry the seed. An ErrorCounter logger
makes any engine or script error exit 1; a bad command line exits 2.
`make smoke` (now part of `make check`) runs 1,000 ticks with 24 bots,
prints min/mean/p50/p95/p99/max tick time against the 12 ms budget,
reruns to confirm the state hash reproduces, and proves a deliberate
script error and a bad config both exit non-zero.
Closes#6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the fixed-tick Simulation, the EntityRegistry with never-reused IDs, SimRng's named
seeded streams, and the 14-byte PlayerCommand used by humans, bots and the network.
state_hash is a SHA-256 over a canonical encoding of the state. Movement is a flat
placeholder until the v0.2 character controller. Tests replay a 24-player command log
over 10,000 ticks and scan src/sim for unseeded randomness and presentation code.
Closes#5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Godot generates a .uid file beside each script so references survive renames. They belong in version control.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docs/ARCHITECTURE.md covering the tick rate, simulation and presentation split,
command stream, entity IDs, snapshot format, seeded RNG rules, module map and
performance budgets. A test scans src/sim for presentation dependencies and unseeded
randomness, so the separation is enforced.
Closes#3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add docs/GDD.md and docs/ORIGINALITY.md, with every gameplay number held in the single
tuning table, src/sim/tuning.gd. The GDD refers to numbers by constant name so it can't
drift from the game.
Closes#2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add an in-repo test runner that discovers test/**/test_*.gd and runs under --headless.
It uses Godot's Logger API, so engine and script errors during a test fail that test.
make test runs the suite, and make test-selfcheck runs deliberately failing fixtures
to prove each kind of failure is detected.
Closes#4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the Godot 4.7.2 project, src/ module layout, LFS rules, licences, CLAUDE.md
and the devlog. tools/godot.sh runs the repo-local engine, headless by default, and
keeps engine data inside the repo. The engine version and SHA-512 sums are recorded
in tools/. make check verifies the engine, checks binaries and parses every script.
Closes#1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>