Back to Faultline
SOURCE / PINNED RELEASE

Made of little things.

Faultline

Release
da1ffaa5624c…
Author-recorded commit
60f5f03189db…
License
LICENSE
Author’s source reference
nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-6932b12c78c

Archive hash verified: 5a2e0492417ec4e7…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

README.md
# Faultline

A first-person arena shooter for the soyLI napplet host. Open Operations, choose an arena and loadout, then enter practice or host a room. Rooms default to free entry through the room browser, including during a running match. A playing host can start alone or with up to seven guests in team deathmatch (the default) or free-for-all. Teams have distinct colors, shared scores and friendly-fire protection. The first team or individual to reach 12 eliminations wins. At five minutes the highest score wins and ties share first place.

Choosing **Settings → Play as → Nostr profile** shares your selected shell identity with the room. **Done** remembers that choice for the current account. When profile metadata is unavailable, players see the shortened public key.

Guests interpolate remote players on a forward-only timeline and reconcile their own position against the host. Compatible hosts accept redundant inputs over the transient channel. Older hosts receive inputs over the reliable channel. The host processes one command per player per tick, keeping at most nine queued commands. Hit checks use up to 250 ms of authoritative pose history.

## Public rooms

Choose **Free to join** to appear in Faultline’s room browser, or **Room code only** to share a code privately. The code grants entry to anyone who has it. Players enter the current round without a ready-up step. Advertising an open room outside the game is a separate choice. Hosts can check **Show this lobby in Playing now across shells** when creating a room. Compatible shells display the game, arena, mode and occupied seats. Opening a room link shows a confirmation in Faultline. Hosts can still share a room code with players using the in-game browser. When a host leaves or its lease expires the public listing disappears.

**Dedicated host** opens a live bird’s-eye view and starts the round clock immediately, even with zero players. The overhead camera renders the live 3D arena, players, projectiles and explosions. Roofs are hidden and name labels follow each player. Use **Players** for scores and ping, or **Server** for the room code and stop control. The hosting browser has no avatar and takes one of eight transport connections, leaving seven player slots. The shared shell directory includes that server connection in its count. Keep the window open and awake. Browsers can throttle timers in the background or suspend a sleeping tab.

Multiplayer starts on the host’s selected map. Five seconds after each round ends, the same room advances through Quarry Yard, Relay Works, North Annex and Alder Ridge, then wraps around. Connected players move together and late joiners enter the active map. A playing host can choose **Return to lobby** during the interval to hold the next start. Solo practice stays on its selected arena.

The lobby and the in-game **Players** list show guest-to-host round-trip times measured over the reliable gameplay channel. Hold **Tab** during play, or tap **Players** to toggle the scoreboard. A dash means a measurement is pending or unavailable. Host and practice bots have no network ping.

With a soyLI version that supports the room directory, run `soyli multiplayer tests/public-room.mjs` to check opt-in discovery, solo start, joining a running match by link and withdrawal with two local browser sessions. Run `soyli multiplayer tests/dedicated-room.mjs` to check the overhead view, code-only admission, measured ping and rejoining a server after it returns to zero players. Run `soyli multiplayer tests/map-rotation.mjs --timeout 295` to exercise empty and occupied map changes and late joins with an accelerated host simulation clock.

## Design brief

The player moves and aims locally, including as a guest. A fixed 60 Hz simulation owns movement, wall collision and weapon timers. The room creator owns damage, grenades, respawns and scoring. Guests reconcile predicted inputs against acknowledged host ticks and interpolate other players. The room uses a host-and-guests topology. Combat events and room changes use the reliable channel. When all peers negotiate unordered delivery with zero retransmits, a second channel carries replaceable 20 Hz snapshots. A full eight-player pose block is 320 bytes before base64 encoding. Bounded ragdolls and debris are visual effects reconstructed locally from impact events.

CVM supplies leased room membership and WebRTC carries gameplay. The shell owns consent, identity, ICE and transport. Both domains are required for multiplayer. Practice uses three bots in the same simulation. Optional config supplies look sensitivity and render scale. Optional media coordinates synthesized effects. Players start under an anonymous alias. Settings accepts a custom alias or loads the host’s Nostr profile through optional NAP-IDENTITY. Choosing the profile shares its display name and public key with the room. Alias mode sends the game alias and the shell still manages its own transport identity. Optional scoped storage remembers the identity choice, alias and crouch preference. Switching accounts leaves the room and clears the selected profile.

The scene and HUD use an app-owned industrial palette, with sun-faded concrete, rust-red containers, deep graphite steel and amber selection marks. Operations shows the selected level as an architectural miniature. North Annex uses cool glazing and muted colors to distinguish office suites. Alder Ridge pairs a pale sky with mossy trails, dark pines and stone. The first-person view uses the same geometry, with a compact health, ammunition and round HUD. Phone layouts stack the staging controls and offer a movement pad, drag look and action buttons. At less than 280 by 210 the frame asks for more space.

## Combat controls

Hold the right mouse button to aim and use the left button to fire. On napplet.soy, choose **Capture mouse** in the player when the match starts or resumes. The shell keeps the cursor hidden and supplies relative motion for unlimited turns. Escape releases it. Hosts with native pointer lock can capture directly. Elsewhere, hold the middle mouse button and drag a little left or right to keep turning in that direction. Release to stop. Leaving the cursor still at the edge of the arena holds the aim steady. Arrow keys also turn the view. Escape or P opens the match menu.

Press 1 for the primary weapon and 2 for the secondary. The second slot takes the Finch P9 pistol, Hammer H6 heavy pistol or Comet R1 rocket launcher. Use **Change loadout** in the match menu to replace either weapon. Changed weapons need a reload, and unchanged magazines retain their rounds. On touchscreens use ADS, FIRE and SWAP.

Hold Q or E to lean left or right. Lean moves the view, shot origin and upper hitboxes together, and nearby cover limits the offset. On touchscreens, hold the left or right lean control. C or the LOW button toggles crouch by default. Choose hold in **Settings**, accessible from Operations, the lobby or the pause menu. Crouching reduces spread by 32% and recoil by 28%.

Hold G or the touch FRAG button to start the 2.25-second fuse. Release to throw with the remaining time. Holding through zero detonates the frag in hand. An elimination while cooking drops the live frag. A bounce retains 43% of speed along the collision axis, and floor contact retains 76% of horizontal speed.

## Maps and tuning

North Annex is an enclosed office with four suites, connecting corridors and glazed meeting rooms. Alder Ridge is a 104-by-104-unit outdoor arena with wooded trails, hills and boulders. Both are defined in `src/battlefields.ts`. The woodland terrain mesh, floor height and ground intersections share one heightfield in `src/terrain.ts`. The two industrial arenas and shared collision rules are in `src/maps.ts`.

Use arena boxes to place buildings, openings, stairways, overhead walkways, spawn points and scenery in world units. Each solid box contributes its actual 3D bounds to collision and visibility. Decorative trim has no collision. Roof and catwalk slabs block movement and shots at their actual elevation. Bots navigate a collision-derived grid. Spawns contain a facing angle in radians. Add the arena to the exported map list to make it selectable and shared by both peers. Change the game protocol version when shipping incompatible maps, rules or wire layouts.

Weapon profiles in [src/weapons.ts](src/weapons.ts) define cadence, damage, spread, penetration budget, magazine, reload, recoil and sight magnification. Bullets lose energy crossing a body or travelling inside a penetrable solid. Map boxes select a material. Drywall, plywood and brick have increasing resistance per unit of travel, and a box can override it with `shotCost`. Unspecified solid boxes provide hard cover. Office glass breaks on shots or nearby unobstructed blasts. The host includes the broken panes in round snapshots so late joiners can move and shoot through the same openings.

[Combat tuning](src/combat-tuning.ts) groups grenade flight and bounce, rocket speed, blast radius, damage and impulse. The `feel` settings control flash length, shock ring, debris, camera kick and sound independently of damage. Hit multipliers are 1.85 for the head, 1.0 for the torso and 0.72 for the legs. Surviving a hit grants 12% more movement speed for 24 simulation ticks. The HUD tints the edge facing the damage source. Gunfire shows a muzzle flash, surface impacts and blood on nearby geometry behind a hit.

## Run and verify

Use `soyli dev` and open its printed preview URL. Use separate browser profiles to join a room as independent players. Run `pnpm verify` for game rules, guidance, types, the build and a two-player scenario. Run `pnpm test:conformance` for the reference harness. With a soyLI preview running, `node tests/mouse.mjs <preview-url>` checks mouse capture, simultaneous aiming and firing, and pause-menu equipment in a focused desktop Chromium window. Run `node tests/settings.mjs <preview-url>` to check alias persistence, the Nostr profile flow, lean and both crouch modes. Use `pnpm test:multiplayer --players 8` for a full lobby with 50 ms of one-way delay, 15 ms of jitter and 4% simulated message loss during play. The runner uses a disposable local TURN relay when coturn is on PATH and direct ICE otherwise. A fresh checkout needs `soyli setup` to regenerate its ignored public backend context. See [docs/napplet-space.md](docs/napplet-space.md) for hosted preview and cleanup.

## Controller play

Focus the player and use a standard-mapped controller. Navigate with the D-pad or left stick, select with A and go back with B. Left/right changes a selected option. Select a name or invite-code field to open the controller keyboard. Menu opens the match menu and holding View shows the roster and pings.

Move with the left stick and look with the right. Use LT to aim, RT to fire, A to jump, B to crouch, X to reload, Y to change weapon and LB to cook and throw. Click the left stick to sprint. D-pad left/right leans and up/down selects a weapon slot. Crouch follows the hold/toggle preference. After changing screens or reconnecting, release the controls before acting.

## Local verification

Run `soyli multiplayer tests/controller-match.mjs --players 2 --timeout 295` with a local TURN binary. The scenario supplies virtual standard controllers to independent browsers, enters a room, exercises combat and finishes a regulation match on an accelerated simulation clock.


The multiplayer scenarios use separate Chromium contexts and a disposable local TURN relay. The two-player office round checks that a shot removes the same window for host, guest and a rejoining player. The eight-player woodland round checks positions beyond the industrial map boundaries. Both exercise a named guest, team HUD, guest movement and aim prediction, firing, a cooked grenade, equipment changes and host departure. The room ends when its host leaves. The multiplayer harness records timings and network conditions in `.napplet-space/multiplayer/latest.json`.

The settings test checks signed-out behavior in the soyLI preview. An isolated SDK fixture exercises signed-in profile metadata and a sign-out during a pending lookup. Public networks, a live signed-in Nostr account, physical phones and independent shells remain unverified. The upstream reference harness reports signed-manifest, wire and teardown evidence separately when supplied.

Hosted layout checks used test-only iframe sizing at 200×160, 320×560, 900×600 and 1650×960. Emulated touch movement, firing, slot switching and grenade cooking passed at 390×844, 360×640 and 844×390. Practice also ran with all optional domains absent. The app-owned palette stayed stable under light and dark browser color schemes.

The cover shows an Alder Ridge practice round at 1200×750. The 960×600 clip shows a North Annex practice round with glass breaking, leaning and a grenade. Its timed inputs are in `napplet.json`.

Remote players show aim pitch with their head, hands and weapon. Crouching lowers the silhouette and bends the knees while the feet stay planted. Both use the existing match snapshots.