# horrorKit
Everything a first-person survival-horror game needs, as one install: a light that throws real shadows and a battery you worry about, placed lights that flicker and die on cue, scripted events and a library of scares, a tension director that paces them and drives the music, heartbeat and screen feel, monsters that hunt you by sound and by your light, notes and tapes that tell the story, and the survival loop around them (scarce weapons, doors and keycards, supplies, safe rooms, save terminals and a HUD). Every style is one field. Built for multiplayer: two players see the same doors, monsters, lights and scares, and each has their own light, dread and HUD.
Version **1.0.21** (`Horror.VERSION`). horrorKit declares every package below in its `package.yaml`, so installing it brings each one at the version listed.
## What it installs
horrorKit is the umbrella. Each horror part is also its own package you can install alone:
| package | version | what |
|---|---|---|
| **flashlightKit** (was torchKit) | 1.0.4 | 12 handheld lights (classic torch, penlight, lantern, head lamp, phone, flare, glow stick, candle, dynamo, UV, camera flash, lighter), 11 battery types, recharge and swap, failures the story triggers |
| **eerieLightsKit** (was flickerKit) | 1.0.6 | 16 placed-light behaviours (dying fluorescent, guttering candle, swinging bulb, emergency red, alarm beacon, strobe, lightning, sparking, brown-out, sodium warm-up, TV glow, neon...), short-outs, power circuits, shadow-only figures |
| **scriptedEventsKit** (was cueKit) | 1.0.4 | triggers (area, look-at, pickup, door/interact, timer, chain, dread, event) playing ordered beats; once or repeating; remembered across death; host-decided for everyone |
| **scaresKit** (was scareKit) | 1.0.4 | 26 original scares rated 1 to 5 (knock, whisper, footsteps behind, shape crossing, lights die and it's closer, vent burst, door slam, power failure, body drop, chase sting...) |
| **tensionKit** (was dreadKit) | 1.0.4 | the tension director: 6 pacing styles, 6 screen looks, 5 audio palettes, music/ambience/heartbeat/breathing, a dread readout (F3) |
| **loreKit** | 1.0.6 | notes, memos, terminals, tapes with voice and subtitles, graffiti, data pads, photos, and a journal |
| **stalkerKit** | 1.0.10 | monsters on aiKit: pursuer, shambler, lurker, light-shy, blind hunter |
| **bulkheadKit** | 1.0.3 | rooms, corridors and props for station and ship interiors, used by the showcase room |
And the published kits it stands on, each declared with the version it is built and tested against:
| package | version | used for |
|---|---|---|
| aiKit | 1.4.0 | monster brains and senses, including carried lights (a flashlight gives you away) |
| navKit | 1.5.8 | monster movement |
| interactKit | 1.6.8 | doors, locks, keycards, switches, every use prompt |
| inventoryKit | 1.0.27 | the spare-battery bag and item strip |
| saveKit | 1.3.21 | checkpoints at save terminals, the lore journal |
| weaponsKit | 1.3.3 | the revolver, coach gun and flare pistol |
| SecondWind | 1.4.8 | health, first aid, death |
| Lifeline | 1.0.4 | respawn points |
| soundstage | 2.1.3 | music driven by the tension director |
| juiceKit | 1.2.12 | camera shake, sway and tremor |
| controlsKit | 1.4.9 | rebinding, prompts and touch buttons |
Not a dependency: **stealthKit**. The HUD has a light and noise element (`HorrorHUD.showStealth`) that draws whatever source a game hands it with `HUD.setSource("stealth", fn)`; the `horrorStealthLink` package passes stealthKit's readout there (place one `horrorStealthLink.StealthReadout`; this world's Brinefall scene does). Installing horrorStealthLink brings stealthKit with it; installing horrorKit alone does not. horrorKit itself never requires stealthKit, so installing horrorKit does not bring it.
Not a dependency either: **menusKit** (horrorKit draws no menu; Brinefall's ending screen uses it and declares it).
## First example
In a scene's `build.luau`, with a first-person player already set up:
```lua
local director = entity.spawn("HorrorDirector")
director.component.add("horrorKit.HorrorDirector", {
pacing = "survivalClassic", look = "grain70s", palette = "deepSea",
hud = "classic", torch = "classic", loadout = "revolver",
})
```
Press Play: every player carries a torch (F toggles, V shakes it back to life, B swaps a battery) and a six-shot revolver with a far-too-slow reload; dread builds in the dark and drives the music, heartbeat, breathing and screen; F3 shows the dread readout.
## The one-field styles
| field | values |
|---|---|
| `pacing` | slowBurn, rollercoaster, relentless, quietDread, survivalClassic, arcade |
| `look` | clean, grain70s, vhs, coldMonitor, sickly, bleachBypass |
| `palette` | industrial, deepSea, organic, synth, classic |
| `hud` | bare, minimal, classic, scifi, vhs, diegetic |
| `torch` | any flashlightKit style |
| `loadout` | revolver, coachgun, flaregun (comma separated) |
Per object: `LightBehavior.style`, `Stalker.kind`, `Lore.style`, `Scare.scare`, `interactKit.Door.look`.
## Components
| component | what |
|---|---|
| `HorrorDirector` | one per scene: the styles above; equips each player; runs the wiring |
| `HorrorHUD` | the HUD (the director adds it from its `hud` field) |
| `SafeRoom` | a box where dread pauses and drains, scares hold and monsters break off (`extents`, `label`, `blockMonsters`) |
| `SaveTerminal` | use it to save a checkpoint (saveKit), move your respawn here and recharge your light |
| `Supply` | `kind` = ammo, firstAid, bandage, battery; `amount`; per player by default |
## The wiring (`require("~horrorKit.api")`)
Loading `horrorKit.api` hands the optional kits to the horror kits that use them (`tensionKit.links`, `scriptedEventsKit.links`, `scaresKit.links`, `loreKit.links`): aiKit, SecondWind, soundstage, juiceKit, interactKit, inventoryKit and saveKit. The horror kits never require those by name, so each of them installs on its own with nothing extra; in a horrorKit game everything is linked with no call of yours (`Horror.linkKits()` repeats it).
`Horror.setup(opts)` (the director calls it) connects, on each player's own engine:
- the torch's visibility and beam -> the monsters (stalkerKit, through aiKit's carried light); its click -> a noise they hear;
- gunshots, doors and torch clicks -> monster noises and dread stimuli;
- monster threat, sightings and attacks, low battery and low health -> dread;
- scares -> asking the director first and reporting back (pacing);
- safe rooms -> dread pause and the HUD marker.
Also: `Horror.setSafe(on)`, `Horror.isSafe()`, `Horror.message(text, seconds)`, `Horror.objective(text)`, `Horror.localBody()`, `Horror.teardown()`, and every part as `Horror.Torch`, `Horror.Dread`, `Horror.Stalkers`, `Horror.Scares`, `Horror.Cues`, `Horror.Lore`, `Horror.Weapons`, `Horror.Interact`, `Horror.Arms`, `Horror.HUD`.
**Weapons** (`horrorKit.weapons`, on weaponsKit): `revolver` (6 rounds, 4.2 s reload), `coachgun` (2 shells, 5 s reload), `flaregun` (one flare that lights and burns). `Arms.give(body, "revolver,coachgun")`, `Arms.addAmmo(body, n)`.
## HUD
Six styles, one field (`hud` on the director, or `HorrorHUD.style`): `bare`, `minimal`, `classic`, `scifi`, `vhs`, `diegetic`. Health, ammo in the gun and spare, light battery, keys and keycards, items, a damage vignette, pickup and objective lines, the safe-room marker and an optional dread hint. Per player; scales for desktop, browser, tablet and phone and keeps clear of the touch controls.
| style | look |
|---|---|
| `bare` | nothing but the damage vignette, the low-health pulse and transient lines (objective, safe room, "Out of ammo", "Battery low" arrive as messages) |
| `minimal` | tiny monospace corner text that fades to a ghost after 3.5 s without change and comes back when something changes; warnings stay lit |
| `classic` | survival-horror status panel: an ECG line whose colour, rhythm and sweep speed follow FINE / CAUTION / DANGER, battery cells, a big ammo count, key and keycard icons |
| `scifi` | helmet visor: corner brackets, scanline wash, a vitals arc, PWR cell bar, a round counter with magazine ticks, ACCESS chips |
| `vhs` | camcorder OSD: blinking REC dot, HP level meter, the torch battery as the camera battery, CNT counter and tape time, date, tracking-noise bands that thicken and redden when hurt |
| `diegetic` | a leather wrist strap with two analogue dials (LAMP charge and PULSE, needles with red zones) and a clipped paper note: the objective as a to-do, rounds as hand-drawn tally marks, spare count, key tags |
Put `HorrorHUD` on any entity (the director adds one), or drive it from code with `local HUD = require("~horrorKit.hud")`:
| call | does |
|---|---|
| `HUD.setStyle(name)` / `HUD.style()` / `HUD.styles()` | switch the look; list them with descriptions |
| `HUD.setPalette(style?, overrides?)` / `HUD.palette(style?)` | recolour a look without replacing it (style defaults to the current one; `nil` overrides restores its defaults). Keys: `font`, `color`, `bg`, `shadow`, `accent`, `size`, `upper`, `radius`, `border`; the `classic` look also reads `accent` (objective bar), `objectiveLabel`, `objectiveText`, `battery`, `batteryLow`, `batteryDead`, `batteryDim` and `batteryOrientation` (`"horizontal"` default, or `"vertical"` for upright cells filling from the bottom). `HUD.PALETTES` holds them all |
| `HUD.message(text, seconds?, { color }?)` | a transient line (up to three stack; the same line again restarts it) |
| `HUD.objective(text?)` | the current objective (nil or "" clears) |
| `HUD.setSafe(on, label?)` | the safe-room / save badge |
| `HUD.setElement(name, on)` / `HUD.setElements(t)` | health, ammo, light, keys, items, vignette, messages, objective, safe, dread, stealth |
| `HUD.setVisible(on)`, `HUD.setScale(k)` | hide for cutscenes and menus; size multiplier |
| `HUD.setTarget(body?)` | show another body's data (spectating) |
| `HUD.setSource(kind, fn?)` | replace a data source (health, ammo, light, keys, items) for a game that keeps its own; `stealth` has no source until a game sets one (`fn` returns `{ light, class, threshold, noise, reach }`) |
| `HUD.state()` | what it shows now (tests) |
Data comes through soft links, so a missing kit just leaves its element empty: SecondWind (`HK.state`), weaponsKit (the local `Weapon`'s synced `ammo`/`reserve`/`reloading`), flashlightKit (`Torch.charge`/`switchedOn`/`spares`, and its `batteryLow`/`batteryDead`/`swapped` events), interactKit (the player's keys and keycards), inventoryKit (the hotbar) and tensionKit (`get`/`band`). While it runs it hides weaponsKit's ammo panel, flashlightKit's meter, interactKit's carried strip and Lifeline's own player bar (and Lifeline's vignette), and gives them back when it stops (`hideKitHuds = false` keeps them). It samples ten times a second and rebuilds only when what it shows changes (0 rebuilds a second while nothing changes); pulses, blinks, sweeps and noise are engine-run CSS animations. On a touch screen it moves out of the lower corners (movement stick, action buttons): sideways into a left column and beside the corner buttons, upright into one column down the left.
## Showcase room
One call builds a compact, dark room that shows the whole kit working: three placed lights, flashlight pedestals (`TorchStand`), a scare on an area trigger, a note, a safe corner with a save terminal, and a monster pen (`MonsterPen` keeps the monster in). Copy it into your own world to see the kit before you build with it.
```lua
local Showcase = require("horrorKit.showcase")
function content()
-- your scene and first-person player (Camera environment = "isolated"), with the new-world
-- template's `lighting` entity deleted: its sky lights the room even through an isolated camera
Showcase.build(nil, { at = { 40, 0, 0 } })
end
```
Options: `at`, `theme`, `director`, `monster`, `navMap`, `scare`, `stands`, `labels`, `name` (see `showcase.module/README.md`). `Showcase.label(parent, name, pos, yaw, title, opts)` draws a readable world-space label.
## Kit gallery
The horrorKit world also has a walkable gallery scene (`scenes.gallery`; a console in Brinefall's dive bay opens it, a button in its hub goes back): all 12 flashlight styles on pedestals, every battery type and failure mode on buttons, all 16 placed light styles, every light state with a circuit, a Silhouette and an Apparition, five monster pens and all 26 scares in booths that replay, each with a label. From code: `layers.load("scenes.gallery")`.
## Guides
- **How to make a horror game: light a dark room, build a scare, tune the tension and add a monster that hunts the player** (`horrorKit.package/how-to-make-a-horror-game-light-a-dark-room-build-a-scare-tune-tension-add-a-monster`)
- **Build a small horror level from an empty world, step by step** (`horrorKit.package/build-a-small-horror-level-from-an-empty-world`)
Open them with the `guides` tool or the Docs panel. Each package also carries its own guide.
## Example
**Brinefall Station** (the `brinefall` package in the horrorKit world): a 10–15 minute level in a flooded deep-sea research station, built from these parts and bulkheadKit.
## 1.0.21
On saveKit 1.3.21 (from 1.3.20) and controlsKit 1.4.9 (from 1.4.7): saveKit 1.3.21 is built against controlsKit 1.4.9 and menusKit 1.4.5, which no longer need the engine's deleted zui UI library; this world now states saveKit with its package.yaml. The Hold Your Breath world's entrypoint loads its dark theme through `ui.loadTheme` instead of requiring the deleted zui theme module, so the world loads and pushes on the current engine. No horrorKit code changes.
## 1.0.20
Published by a push that timed out with a 503 before the controlsKit pin was moved: it states saveKit 1.3.21 and still states controlsKit 1.4.7, which saveKit 1.3.21 does not bring. Use 1.0.21.
## 1.0.19
horrorKit's own dependency copy of barsKit carries barsKit's Showcase component in full again (661 lines). 1.0.18 bumped the showcase packages' versions but the restore itself did not reach main in that release, so its barsKit copy still shipped the empty file 1.0.17 had (found while releasing Low Water). No other change.
## 1.0.18
On scaresKit 1.0.5 (which states scriptedEventsKit 1.0.4) and saveKit 1.3.20. No horrorKit code changes.
## 1.0.17
On stalkerKit 1.0.10: a Stalker whose kind the game defines after it woke (a joining player's engine) waits for the kind instead of failing, so a second player's creature no longer loses its brain. No horrorKit code changes.
## 1.0.16
`Horror.clearRespawn(body?)` forgets which save terminal brings a player back, so a New Game respawns them at the level start until they use a terminal again (before, the terminal from the finished game stayed their respawn). HUD palettes take `objectiveFont`, the classic objective text's font family (default `ptserif`, unchanged), so a game can match its menu type. On saveKit 1.3.20 (`Save.clearCheckpoint()`).
## 1.0.15
SaveTerminal fix to 1.0.14: it wrote and read the respawn attribute by indexing the body's attribute proxy, which is sealed, so using a terminal only warned "respawn not moved" and the picker never saw a choice. It now goes through `attribute.set` / `attribute.get`. Verified in play with two terminals.
## 1.0.14
HUD palettes: `HUD.setPalette(style?, overrides?)` and `HUD.palette(style?)` recolour a look without replacing it; the `classic` look's objective bar (`accent`), objective label and text, and its battery cells (`battery`, `batteryLow`, `batteryDead`, `batteryDim`, `batteryOrientation` = `"horizontal"` or `"vertical"`) are no longer hardcoded. Defaults unchanged. SaveTerminal now really moves your respawn: every terminal's Lifeline spawn point starts switched off, using a terminal marks it on your body (attribute `horrorKitRespawnTerminal`), and a spawn picker brings each player back at the terminal they used last (before any save, Lifeline's own choice: the level's PlayerSpawn or any SpawnPoint the game placed). Before, every terminal's point was live from play start and Lifeline picked one at random. On loreKit 1.0.6 (subtitles setting), bulkheadKit 1.0.3 (surfaces no longer black under an isolated camera, `B.collect` for batching), flashlightKit 1.0.4 (torch follows the carrier when the main camera is elsewhere), stalkerKit 1.0.9 (`drowned` body, `appearAt` cancels a retreat) and scriptedEventsKit 1.0.4 (`call` beat takes `fn`). New HUD palette test.
## 1.0.13
On eerieLightsKit 1.0.6. The guide *Build a small horror level from an empty world* now turns the first-person rig to face up the corridor (`rig.localRotation = { 0, 1, 0, 0 }`; the camera starts from the rig's own pose) and lights the corridor brightly enough to see (tubeA 18, tubeB 14, cabinBulb 8, medTube 25). Contributed in pull request #2.
## 1.0.12
On eerieLightsKit 1.0.5 and stalkerKit 1.0.8. No code changes.
## 1.0.11
On eerieLightsKit 1.0.4 and stalkerKit 1.0.7. No code changes.
## 1.0.10
README only: the table of the kits it installs lists the versions 1.0.9 brings (eerieLightsKit 1.0.3, scriptedEventsKit 1.0.3, scaresKit 1.0.4, tensionKit 1.0.4); the 1.0.9 README still showed the earlier ones. No code changes.
## 1.0.9
While the horror HUD is up it also hides saveKit's own level and XP bar (and puts it back when it stops), so no "LV 1, 30 / 100 XP" bar appears in a horror game or pushes the condition and weapon panels. On flashlightKit 1.0.3, eerieLightsKit 1.0.3, scriptedEventsKit 1.0.3, scaresKit 1.0.4, tensionKit 1.0.4, loreKit 1.0.5 and stalkerKit 1.0.6.
## 1.0.8
On SecondWind 1.4.8 and stalkerKit 1.0.5, the SecondWind stealthKit 1.0.22 brings, so adding horrorStealthLink leaves one SecondWind in the world. No code changes; hudTests 11/11.
## 1.0.7
README: the stealth readout bridge, horrorStealthLink, installs into a fresh world now (stealthKit 1.0.20), so the README no longer calls it blocked. On SecondWind 1.4.7 (the newest SecondWind release) and stalkerKit 1.0.4. No code changes.
## 1.0.6
README: the stealth readout bridge says plainly that its fresh install is blocked upstream for now.
## 1.0.5
On loreKit 1.0.4 (its reader test no longer leaves engine errors). The stealth readout bridge, horrorStealthLink 1.0.2, now brings stealthKit 1.0.17.
## 1.0.4
Brings the fixed kits from the fresh-world check: eerieLightsKit 1.0.2, scaresKit 1.0.3, tensionKit 1.0.3, stalkerKit 1.0.3 (monster surfaces), loreKit 1.0.3, bulkheadKit 1.0.2.
## 1.0.3
- Depends only on the packages its own code uses: menusKit is no longer declared; SecondWind is declared at the release its references reach.
- `horrorKit.api` links the optional kits into tensionKit 1.0.2, scriptedEventsKit 1.0.2, scaresKit 1.0.2 and loreKit 1.0.2, which no longer require them by name (so none of them drags another kit into an install).
- The stealth readout link moved out of Brinefall into the new `horrorStealthLink` package.
## 1.0.2
- Installs into an empty world again: 1.0.1 recorded stealthKit 1.0.15 as a dependency (the HUD required its readout by name), and that release does not install into a fresh world, so `zeromind installAsset` refused horrorKit 1.0.1 everywhere. The HUD's stealth element now reads only a source the game sets (`HUD.setSource("stealth", fn)`).
- Darkness: the showcase snippet and the guides now say to delete the new-world template's `lighting` entity. Its sky lit a closed room to mean 37/255 with every light and the torch off, through an isolated camera; deleted, the same room reads 0.5/255.
- Cheaper frame: HorrorDirector re-asserts the own-body hider and the single touch Menu button 10 times a second instead of every frame (each pass walked the body's descendants and read the main camera).
## Multiplayer
Shared and host-decided: doors, keycards and locks (interactKit), placed lights (eerieLightsKit), cues and scares (scriptedEventsKit), monsters (stalkerKit on aiKit). Per player: torch and battery, dread and everything it drives, HUD, journal, supplies.
## Known limits
- Monster bodies are re-proportioned, re-skinned built-in humanoids with attached parts, not sculpted creatures (mesh generation was unavailable when this was made).
- The torch toggle (F) is also controlsKit's second interact key in its fps scheme; E stays interact.
# horrorKit.Supply
A survival pickup: `kind` = ammo (spare rounds for the held horror weapon), firstAid or bandage (SecondWind heal by `amount`), or battery (flashlightKit battery of type `battery`). The player looks at it and presses interact. `perPlayer` (default) gives every player their own copy for co-op; off, the first taker gets it for everyone. Draws a small built-in model unless `model` is off. Needs nothing beside it (it adds its own Interactable).
# horrorStealthLink.StealthReadout
Hands stealthKit's light and noise readout to horrorKit's HUD when play begins, on every peer (each player reads their own light and noise). Place it once, on any entity of a scene that has horrorKit and stealthKit; the HUD draws the readout where `HorrorHUD.showStealth = true`. No fields.
# horrorKit.SafeRoom
A box (`extents`, half-size in metres around the entity) where the local player is safe: dread pauses and drains, no scare fires, the HUD shows the safe marker and `label` is shown once on entry. With `blockMonsters` on, a stalker that follows a player inside breaks off and retreats. Put it on an empty entity in the middle of the room; pair it with a SaveTerminal.
# HorrorHUD
Shows the horrorKit horror HUD to the local player of every engine. Put it on any entity of the scene (one is enough; it needs no sibling components). `style` switches the whole look with one change: `bare`, `minimal`, `classic`, `scifi`, `vhs`, `diegetic`. `showHealth`, `showAmmo`, `showLight`, `showKeys`, `showItems`, `showVignette`, `showMessages`, `showObjective`, `showSafe` and `showDread` (off by default) turn single elements off or on; `hideKitHuds` hides the kits' own HUD pieces while it runs; `scale` multiplies the automatic size.
```lua
entity.spawn("HUD").component.add(asset.resolve("horrorKit.HorrorHUD", "component"), { style = "vhs" })
```
Each player sees only their own health, ammo, light and keys. The work is done by `horrorKit.hud`; script lines, objectives and the safe badge go through it (`HUD.message`, `HUD.objective`, `HUD.setSafe`).
# horrorKit.SaveTerminal
Something to use in a safe room (terminal, typewriter, tape deck). It adds an interactKit Interactable with `label`; using it saves the checkpoint `checkpoint` through saveKit, makes this the player's respawn point (a Lifeline SpawnPoint at `respawnOffset`), recharges their light if `recharge` is on, and shows "Progress saved". Put it on the entity the player looks at.
# Stalker
Turns a character into a horror monster. Put it on a synced entity and pick its kind (pursuer, shambler, lurker, lightshy, blind); it adds an aiKit Brain running the stalker brain with that kind's preset (bringing a navKit NavAgent and SecondWind health), builds and animates the creature's body on every screen, plays its sounds, sizes its hit volume for weaponsKit, and reports what it does through stalkerKit events. Fields: kind, lairGroup, active, sounds, volume; read-only mode, detail, target, hidden, pose, action.
# horrorKit.HorrorDirector
Put one on any entity in a scene to make it a survival-horror game. Every style is a field: `pacing`, `look`, `palette` (tensionKit), `hud` (adds and drives a HorrorHUD on the same entity), `torch` (the flashlightKit style each player is given), `loadout` and `startAmmo` (horror weapons on weaponsKit), `music`, `debugDread`. Runs per player: equips the local player and calls `Horror.setup` / `Horror.tick` to wire torch, monsters, scares and dread together. Needs nothing beside it.
# BatteryPickup
Spare batteries or fuel lying in the world. Put it on any entity: it draws a small spinning pair of cells (unless `model = false`). Walking within `radius` takes it (or, with `interact = true` and interactKit installed, the interact press). The spare goes into the torch's bag, or into the inventoryKit inventory when that kit is installed. `battery` names the type, `count` how many, `respawn` seconds until it returns (0 = once). Taking is synced: it disappears for every player.
# StalkerLair
Marks a vent, crawlspace or dark hole that stalkers slip into to hide and heal and come back out of. Put it on an entity standing on the walkable floor in front of the opening, its forward (-Z) pointing in. Fields: group (only stalkers with that lairGroup use it; empty = all), kind (vent or dark), open. Draws nothing.
# LightBehavior
Drives the point `Light`, spot `Light` or `SpotLight` on its entity. `style` picks the behaviour (16: dyingFluorescent, fluorescent, candle, fireplace, swingingBulb, emergencyRed, alarmBeacon, strobe, lightning, sparking, breathing, brownout, sodiumWarmup, tvGlow, neonStutter, steady). The synced `state` (on, off, flicker, short, restore) with `stateAt` is what triggers set; `group` tags and `circuit` names address lights for `eerieLightsKit.api`. Meshes on the entity and under it get the light's colour x level in shader-data lane 2 (wear `eerieLightsKit.fixtureGlow` to glow). Options: `intensity`, `styleColor`, `sound`, `volume`, `hang` (swing cord length), `shadows` (auto / always / never), `thunderDelay`, `seed`.
# brinefall.LevelScript
Starts Brinefall Station's scripted beats. Placed once, on the `HorrorDirector` entity, by `brinefall.content`. Its `start()` runs on every peer when play begins and calls `brinefall.script.start()`, which is safe to repeat (every define, place and register replaces its own id). No fields.
# Lore
Put it on any prop the player can read: a sheet of paper, a terminal, a dictaphone, a wall. Name a catalogued entry with `id`, or write one here (`title`, `body`, `clip` for a tape). `style` switches the reader with one field (`default` keeps the entry's own). With interactKit installed it adds an `interactKit.Interactable` beside itself (`label`, `range`, `trigger` look/proximity), so the player gets the standard Read prompt on keyboard, gamepad and touch; without it, E or the pad's west button opens it within `range`. Only the player who used it reads it. Event `read{id}`.
# brinefall.content
Places what a player uses or what hunts them in Brinefall Station at build time: doors, keycard and lock, breaker lever, lore props, supplies, safe room, save terminal, monsters and vents, and the HorrorDirector. Called from the scene build with the layout anchors.
# brinefall.layout
Geometry and dressing of Brinefall Station, the horror kit demo level, built with bulkheadKit. `build(root)` makes every room and returns named anchor points (lamp spots, door spots, scare spots) the scene build uses to place lights, doors, scares and monsters.
# brinefall.script
The scripted beats of Brinefall Station on scriptedEventsKit, scaresKit and stalkerKit: five scares, the pursuer encounter, the breaker, the finale and the ending. The scene entrypoint calls `start()` in onLoad on every peer.
# bulkheadKit
Build derelict sci-fi interiors in code: research stations, ships, bunkers, submarines, labs, maintenance tunnels. One call builds a room or corridor with real doorway openings, door frames, structural ribs and ceiling beams, pipe runs, cable trays and trims; another places one of 30 procedural props. Six surface themes switch the whole look with one word. Made for horror levels (it builds the demo level of the horror kit in this world, *Brinefall Station*), and works for any interior.
Version **1.0.3** (`Build.VERSION`).
## Install
Search ZeroMind for **bulkheadKit** and install `bulkheadKit.package`, or `zero zeromind installAsset <guid>` in the shell. It needs nothing else: the surfaces it builds with ship inside it.
## First example
In a scene's `build.luau`:
```lua
local B = require("bulkheadKit.build")
function content()
local root = entity.spawn("Station")
B.useTheme("derelict") -- pale green bulkheads, grating, rusty pipes
-- a 3 m wide, 20 m long corridor with a doorway at its north end
local hall = B.room("hall", { x0 = -1.5, x1 = 1.5, z0 = 0, z1 = 20, h = 3.2,
openings = { { side = "N", at = 0, w = 1.6, h = 2.3 } } }, root)
-- a lab beyond it, in another theme
B.useTheme("clinical")
local lab = B.room("lab", { x0 = -6, x1 = 6, z0 = 20.3, z1 = 32, h = 4,
skipWalls = { S = true } }, root)
B.prop("labBench", { 0, 0, 25 }, 0, lab.root)
B.prop("tank", { -4, 0, 29 }, 0, lab.root)
B.prop("fluoro", { 0, 3.95, 25 }, 90, lab.root) -- ceiling fixture; put your Light under it
end
```
Two rooms that touch share one wall: give one of them `skipWalls` on that side and cut the doorway (`openings`) on the other.
## Rooms: `B.room(name, spec, parent?) -> { root, cuts, center, y, h }`
`spec` is the inner floor rectangle and what to put round it:
| field | meaning | default |
|---|---|---|
| `x0, x1, z0, z1` | inner floor rectangle, metres (+Z = north) | required |
| `y`, `h` | floor height and room height | 0, 3.2 |
| `wall` | wall thickness | 0.3 |
| `openings` | doorways `{ side = "N"/"S"/"E"/"W", at = centre along that wall, w, h, sill }` (a sill makes a window) | none |
| `skipWalls` | `{ N = true, ... }` sides left open (corridor ends, shared walls) | none |
| `ribs` | spacing of structural frames on the long walls and beams across the ceiling (0 = none) | 2.4 |
| `pipes`, `trays` | the pipe bundle along one long wall and the cable tray down the middle | on |
| `noFloor`, `noCeiling` | leave them out (pools, shafts, ramps, open sky) | off |
| `floor`, `walls`, `lower`, `ceiling` | a material or theme role for this room only | the theme's |
Walls have a dark lower band (`wallLower`) to 1.05 m, a skirting and a dado rail, and every doorway gets jambs and a header in the theme's `trim`. Walls and floors carry box colliders; decoration does not.
## Themes: `B.useTheme(name)`
| theme | walls | floor | for |
|---|---|---|---|
| `derelict` | chipped pale-green riveted bulkhead | rusty grating | research stations, the default |
| `hull` | dark bolted pressure hull | wet tread plate | docks, engine rooms, the deep parts of a ship |
| `clinical` | cracked white tile | studded rubber | med bays, labs, showers |
| `concrete` | damp stained concrete | grating | pump rooms, service tunnels, basements |
| `quarters` | green over wood laminate | rubber | cabins, offices, a mess |
| `industrial` | dark green over hazard stripes | tread plate | plant rooms, cargo holds |
The surfaces are generated PBR sets (colour, normal, roughness/metal) wrapped with the engine's world-space **triplanar** shader, so a 20 m wall and a 0.3 m jamb both tile at real size and nothing stretches. `B.material(roleOrName)` returns any of them for your own parts.
## Props: `B.prop(kind, pos, yaw?, parent?, opts?) -> group`
Every prop is built round its own floor point, facing -Z, and placed with `pos` and `yaw` (degrees). `B.propKinds()` lists them:
| kind | what | options |
|---|---|---|
| `locker` | row of steel lockers | `count`, `openIndex` (one door hangs open) |
| `bunk` | two-tier bunk with mattresses, blankets, ladder | |
| `desk` | steel desk, drawers, papers, lamp, mug, chair | `chair = false`, `chairYaw` |
| `chair` | swivel chair | |
| `crate`, `cases` | strapped crate; a stack of three cases | `size`, `mat` |
| `shelf` | four-shelf rack with boxes | `seed` varies the contents |
| `labBench` | steel bench, microscope, jars, tray, clipboard | |
| `console` | control desk, toggles, three CRT monitors | `screens = false` for dead screens |
| `tank` | cylindrical specimen tank with murky fluid | `height`, `fluid = false` |
| `pump` | pump housing, motor, plinth, pipes, valve wheel, gauge | |
| `gurney` | med-bay gurney with instrument trolley | |
| `gasTanks` | four chained gas cylinders | |
| `vent` | wall duct mouth whose grate is its own child entity `grate` (blow it off in a scare) | `size` |
| `fluoro` | caged double fluorescent fixture (tubes `tubeA`/`tubeB`) | `off = true` for dead tubes |
| `wallLamp` | caged bulkhead lamp | `glow` = glowRed, glowAmber, glowTube, glowCold |
| `hangingBulb` | bare bulb on a cord (`bulb`) | `cord`, `glow` |
| `valveWheel`, `hatchRing` | brass valve wheel; bolted pressure-hatch ring for a doorway | `size` |
| `divingBell`, `submersible` | hero props for a dive bay and a sub dock | |
| `bodyBag`, `papers`, `cable`, `barrel`, `table`, `puddle` | dressing | |
Lower level: `B.part`, `B.box`, `B.pipe(parent, name, a, b, radius, material?)`, `B.group`, `B.quatYaw`, `B.quatAxis`, `B.quatMul`. Rooms and props call `B.part` through the table, so wrapping it reaches everything they make.
## Batching: `B.collect(fn, body)`
Every prop part is its own Model entity by default. To batch, build inside `B.collect`: each visible part goes to `fn(part)` instead, as `{ parent, name, mesh, center, size, rot?, material, shadows, tint? }` (`center`, `size`, `rot` local to `parent`, the room or prop group entity, which is still spawned and placed). Parts with a collider still spawn an entity carrying only the BoxCollider; invisible helper parts never reach `fn`.
```lua
local parts = {}
B.collect(function(p) table.insert(parts, p) end, function()
B.prop("locker", { 1.2, 0, 6 }, -90, root)
B.prop("desk", { -1, 0, 4 }, 0, root)
end)
-- merge `parts` by material into your own meshes or one quickGeometry Group
```
## Multiplayer
Everything is plain scene content built at author time and baked into the scene, so every player loads the same station. Put moving or scripted things (doors, lights that fail) on synced entities with the kits that drive them.
## Performance
A room is ~40–120 primitive entities; a 10-room level is ~1,900. Props share a handful of materials. Fixture glows are emissive and cast no light; add real Lights only where they matter and keep shadow-casting lights few.
## Known limits
- Props are built from primitives (boxes, cylinders, tori, capsules), not sculpted meshes. They read well in the dark; up close they read as stylised.
- Ramps are a rotated box (`B.box` with a `rot`), so stairs are not modelled step by step.
- Rooms are axis-aligned rectangles.
## 1.0.1
Props use lit materials instead of tints, so nothing shows in total darkness. Fixture glow follows its light.
## 1.0.2
Ships a test suite, `bulkheadKitTests`: every theme and prop builds, unknown names are refused, doorways open, the README example builds (all dry runs, nothing lands in your scene).
## 1.0.3
Surfaces no longer render black under a camera with `environment = "isolated"`: the triplanar materials shipped `metallic: 1`, so every surface took its metalness from the packed texture at full strength and reflected nothing where there is no environment. Painted bulkheads, concrete, ceiling panels, tiles, rubber, hazard paint and wood are now `metallic: 0`; the rusty grating 0.25, the painted hull 0.3, tread plate 0.45, rusted pipe 0.2, dark steel trim 0.55 (brass stays 1). New `B.collect(fn, body)` hands visible parts to the caller for batching instead of one Model entity per part (colliders still spawn), and rooms and props call `B.part` through the table so a wrapper reaches them. The version test reads the package.yaml beside the install, so it passes under deps/ and showcase/ too. Two new tests.
# eerieLightsKit 1.0.1, flickering, dying and swinging lights for horror levels
Named **eerieLightsKit** since 1.0.1 (it was published as flickerKit in 1.0.0). Search for either name.
Placed-light behaviours. Put **LightBehavior** on any entity carrying a point `Light`, a spot `Light` or a `SpotLight` and it drives that light: a dying fluorescent tube that buzzes and stutters, a bulb that really swings on its cord so the shadows sweep the room, a red emergency light, a rotating alarm beacon, lightning through a window with thunder behind it, a sparking broken fixture, and more. Every light carries a synced **state** (`on`, `off`, `flicker`, `short`, `restore`) that triggers and scripted scares set, by name, by tag, or by power circuit. Two shadow-reveal helpers come with it: a **Silhouette** that is only ever seen as a shadow on the wall, and an **Apparition** that stands in a doorway only while a light flickers.
## Install
Search ZeroMind for **eerieLightsKit** and install it, or copy `eerieLightsKit.package` into your world. No dependencies.
## First example
```lua
local lamp = entity.spawn("Hall_Light_01")
lamp.position = vector.create(0, 2.9, 0)
lamp.component.add("Light", { kind = "point", intensity = 8, radius = 9, castsShadows = true })
-- a glowing tube that lights up with the light and goes dark with it
local tube = entity.spawn("tube", { parent = lamp })
tube.localScale = vector.create(0.12, 0.05, 1.3)
tube.component.add("Model", { model = "@builtin::meshes.cube", material = "eerieLightsKit.fixtureGlow", castsShadows = false })
lamp.component.add(asset.resolve("eerieLightsKit.LightBehavior", "component"), { style = "dyingFluorescent", group = "hall", circuit = "wingB" })
```
```lua
local Lights = require("eerieLightsKit.api")
Lights.setState("Hall_Light_01", "short") -- spark, pop, dark
Lights.setGroup("hall", "flicker") -- every light tagged hall
Lights.circuit("wingB", false) -- the power dies
Lights.circuit("wingB", true, { stagger = 0.8 }) -- comes back one light at a time
Lights.on("stateChanged", function(e) print(e.entity, e.state) end)
```
## Styles
| style | what it does | colour | sound |
|---|---|---|---|
| `dyingFluorescent` | hums at 90 %, then bursts of rapid on/off with a ballast ping | cool white | tube hum loop, ping |
| `fluorescent` | strikes on with a stutter, then steady with a faint shimmer | cool white | hum loop |
| `candle` | gutters, dips, the flame position flutters | orange |, |
| `fireplace` | slow roll plus crackle flicker, moving light | deep orange | fire loop |
| `swingingBulb` | the light and its bulb swing on a cord (`hang` m) so shadows sweep the room | warm | chain creak loop |
| `emergencyRed` | dim, steady, slow breathe | red |, |
| `alarmBeacon` | rotates about its up axis (use a spot) | red-orange | klaxon loop |
| `strobe` | hard 7 Hz strobe | white | strobe ticks |
| `lightning` | dark, then rare double flashes through a window; thunder arrives 1–4 s later | blue-white | thunder |
| `sparking` | sputtering low light with bursts, sparks fly and bounce | white | crackle + sparks |
| `breathing` | slow pulse 12–100 % | (light's own) |, |
| `brownout` | sags with the power, occasional dips | dim amber |, |
| `sodiumWarmup` | from a pink glow to full orange over ~12 s after it comes on | sodium orange | ballast buzz |
| `tvGlow` | jumpy cuts between brightness levels | blue | static hiss |
| `neonStutter` | steady, then word-by-word stutters | magenta | neon buzz |
| `steady` | just obeys the state | (light's own) |, |
`styleColor = false` keeps the light's own colour. `require("eerieLightsKit.styles").define(id, { label, level = function(t, seed, since) ... end, color?, loop?, swing?, spin?, jitter?, sparks?, thunder? })` adds your own.
## States
| state | meaning |
|---|---|
| `on` | the style runs |
| `off` | dark (hum stops) |
| `flicker` | violent flicker over the style until changed |
| `short` | surge, spark shower, pop, then dark |
| `restore` | stutters back on over 1.8 s, then behaves as `on` |
A state carries `stateAt`, a session time: a change can be scheduled (`Lights.setState(t, "off", 2)` goes dark on every screen 2 s from now) and a circuit's lights come back staggered.
## API (`require("eerieLightsKit.api")`)
Targets are an entity, an id, a name, a glob (`"Hall_*"`) or a tag (a word in the light's `group` field or the entity's `tags` attribute).
| call | does |
|---|---|
| `Lights.setState(target, state, delay?)` | returns how many lights it reached |
| `Lights.setGroup(tagOrName, state, delay?)` | the same, for groups |
| `Lights.setStyle(target, style)` | switch behaviour |
| `Lights.circuit(name, on, { stagger, delay, short, from })` | power circuits: die together, come back one by one (nearest-first from `from`: a `{ x, y, z }` point, a vector, an entity or its name) |
| `Lights.point(p)` | the world point any of those forms names (nil when it names nothing) |
| `Lights.state(target)`, `Lights.levelOf(target)`, `Lights.list()`, `Lights.styles()` | reading |
| `Lights.silhouette(target, "play" \| "stop", delay?)` | start a Silhouette walking on every screen at once |
| `Lights.setQuality("high" \| "medium" \| "low")` | shadow budget 6 / 3 / 1 lights, update range 60 / 45 / 30 m |
| `Lights.on("stateChanged", fn) -> disconnect` | `{ entity, state, previous, style }` on every peer |
Entity-level contract (no require needed): set the `LightBehavior` fields `state` / `style` on the owning peer.
## Shadow reveals
- **Silhouette**, on an empty entity between a light and a wall. Its figure (`figure`, `tall`, `crawler`, `hand`) goes on the `fk_shadowOnly` render layer, which every player's camera skips while the shadow maps still draw it: you see a shadow slide across the wall and nothing that casts it. `path = "4,0,0; 4,0,-3"` (local offsets), `speed`, `loop`, `playing` (synced, started on every peer at the same session time). `shadowOnly = false` makes it a visible black figure.
- **Apparition**, a dark figure linked to a light (`light` = name or tag). While `armed`, when that light flickers, shorts or restores it shows in the lit frames (a black shape against the light, or in the dark frames with `showIn = "dark"`) for `window` seconds, then it is gone; `once` disarms it.
## Fixtures
Meshes on the light's entity and under it get the light's colour × level written to shader-data lane 2 every time it changes. Wear `eerieLightsKit.fixtureGlow` (unlit, emissive from that lane) or any instance-colour material on the tube / bulb / sign / screen and it glows when lit and goes dark when off, per lamp.
## Multiplayer
Placed lights are world state. The entity's owner writes `state`, `stateAt`, `style`; a change asked on any other peer is sent to the owner. Every peer computes the same flicker from the light's `seed` and `multiplayer.sessionTime()`, so all players see the same stutter, short and lightning flash with nothing sent per frame. Sounds and sparks are local to each peer, played from the same moments.
## Performance
About 0.07 ms of script per near light per frame (measured), less when nothing changes (the light is written only when its level moves). Lights farther than the quality's update range from the camera update twice a second. Only the nearest N shadow-casting lights (N = 6 / 3 / 1 by quality) keep `castsShadows`, re-picked twice a second. Sounds only play for near lights: a hum / fire / alarm loop exists only while the main camera (where the player hears from) is within its 18 m earshot (removed again past ~24 m), and a one-shot (ping, pop, spark, relay) is not started at all out of its earshot and is removed the moment its clip ends. Every live spatial source costs the engine a position sync each frame, so a level full of lights keeps only the handful you can hear (Brinefall Station: 21-34 live sources down to 13-19).
## Known limits
- The shadow-only trick edits each peer's main camera `renderLayers` (adds `!fk_shadowOnly`); a camera you create yourself needs the same token.
- Swinging, spinning and flame jitter move the light's own entity in play (the authored pose is the swing anchor); don't also animate that entity.
- `fk_relay` (restore click for non-fluorescent lamps) reuses the tube ping: the generated relay click was refused by the audio service.
## 1.0.1
Renamed from flickerKit. Fixture glow follows its light (a lamp whose Light is disabled counts as off). Lights update only as often as they need to (every frame within 20 m, 20 Hz beyond, 2 Hz past the cull distance, 4 Hz once settled) with no per-frame allocations. Quality is picked from the device; high is 4 shadow-casting lamps. Fixed a crash when entity positions came back as a proxy.
## 1.0.2
A registered light whose id is no entity (the test suite's stand-ins, or a light despawned while registered) no longer writes an engine error on every lookup; it is skipped quietly.
## 1.0.3
Leaving play is quiet: a light's cleanup removes its sound loop and sparks by id, only when they still exist, instead of reaching for entities the scene teardown already removed (that logged an error on every stop).
## 1.0.4
A light plays without errors before anyone listens: its sounds only look up where the listener stands when the listener names an entity that exists, so a scene with no player or camera yet (the first README example on its own) no longer logs "no entity with an empty id" every few seconds. Leaving play stays quiet.
## 1.0.5
A light plays and buzzes with no errors when nobody is listening yet. Its sounds now judge earshot from the main camera and never ask the audio system for its listener: that report snapshots the whole mix, and while no listener exists it names an empty one the engine logs about ("no entity with an empty id" every 2 to 4 s; 1.0.4 guarded the wrong step). With no camera at all a sound simply plays unculled. Leaving play stays quiet.
## 1.0.6
`Lights.circuit(name, true, { from = ... })` no longer crashes on a starting point given as `{ x, y, z }` (it read `from.x` only, so a list of three numbers, an entity name or an id stopped the restore, and a power-restored cue that called it never finished). `from` now takes a `{ x, y, z }` list, `{ x =, y =, z = }`, a vector, an entity, or an entity's name or id; a name that names nothing falls back to name order. New `Lights.point(p)` answers the world point any of those forms names. Contributed in pull request #2; the entity case and the test for every form were added on review.
# horrorStealthLink
Shows stealthKit's light and noise readout in horrorKit's HUD. horrorKit does not depend on stealthKit (installing horrorKit never brings it along) and stealthKit does not know horrorKit; this small package is the one place the two meet, so only a world that wants the readout installs both.
## Use it
1. Install `stealthKit` (asset `12189fd4-4c5f-419e-9260-c3b1638db7d4`) first.
2. Install `horrorStealthLink` (it brings horrorKit).
3. Place the component once, anywhere in the scene, and switch the HUD element on:
```lua
local e = entity.spawn("StealthLink")
e.component.add("horrorStealthLink.StealthReadout", {})
-- on the entity that carries the HUD:
hudEntity.component.add("horrorKit.HorrorHUD", { style = "classic", showStealth = true })
```
The readout then shows "In shadow" / "Exposed" and "Walking 5 m" / "Running 11 m" for the local player, in every HUD look but `bare`. Each player sees their own.
## What it contains
| asset | what |
|---|---|
| `StealthReadout` component | calls `link.install()` on every peer when play begins |
| `link` module | `install()` sets `HUD.setSource("stealth", sample)`; `sample()` reads stealthKit's readout |
Without this package, horrorKit's `showStealth` draws nothing (no source), so a world can leave it on.
## 1.0.2
Brings stealthKit 1.0.17. With 1.0.16 the install was refused in a fresh world: stealthKit 1.0.16 recorded interactKit at versions ZeroMind does not hold, which clashed with the released interactKit 1.6.8 that horrorKit brings. Fixed upstream in stealthKit's world (pull request #3, released as 1.0.17).
## 1.0.3
Brings stealthKit 1.0.18, the first release built on the published interactKit 1.6.8. 1.0.2 brought stealthKit 1.0.17, which still recorded interactKit versions ZeroMind does not hold (its world ran an unpublished copy), so the install was still refused. Fixed in stealthKit's world (pull request #4).
## 1.0.4
README: the known limit above. On horrorKit 1.0.6.
## 1.0.5
Brings stealthKit 1.0.19, whose release records the published interactKit 1.6.8 (stealthKit pull request #6, issue #5), so a fresh install no longer meets interactKit versions nobody published.
## 1.0.6
Installs into a brand new empty world: brings stealthKit 1.0.20, whose releases record only published interactKit versions (stealthKit pull requests #6 and #7, issue #5). On horrorKit 1.0.7. The "Known limit" section is gone.
## 1.0.7
Brings stealthKit 1.0.21, the first stealthKit release whose world really runs the published interactKit 1.6.8 (stealthKit pull request #8); 1.0.20 still recorded the 1.6.7 HUD for `~interactKit.hud`, the last reference a fresh install could not find.
## 1.0.8
Brings stealthKit 1.0.22, released from a stealthKit world on the current engine library (stealthKit pull request #9), so every reference it carries names a published version and a brand new empty world installs this package. On horrorKit 1.0.8.
## 1.0.9
Brings stealthKit 1.0.23, whose release commits the reference records the current engine library gives it (stealthKit pull request #10); 1.0.22 still named an unpublished interactKit version.
## 1.0.10
Published from Hold Your Breath on the current engine library. 1.0.9 was published while this world was still on an old library (9cba27a), and that re-recorded stealthKit's interactKit references at a version no release holds, so a brand new world refused it. No code changes.
## 1.0.11
README: in a brand new world, install stealthKit first and horrorStealthLink after it. That order is checked (both install clean, the readout and `HorrorHUD { showStealth = true }` add, hudTests 11/11). Installing horrorStealthLink alone into an empty world is still refused: 11 stealthKit sites name interactKit's world with no commit pinned, so they cannot resolve in a world that has none yet. Earlier notes here that call it installable on its own are wrong. No code changes.
## 1.0.12
On horrorKit 1.0.9. No code changes; install stealthKit first, as above.
## 1.0.13
On horrorKit 1.0.10. No code changes; install stealthKit first, as above.
## 1.0.14
On horrorKit 1.0.11. No code changes; install stealthKit first, as above.
## 1.0.15
On horrorKit 1.0.12. No code changes; install stealthKit first, as above.
## 1.0.16
On horrorKit 1.0.13. No code changes; install stealthKit first, as above.
## 1.0.17
On horrorKit 1.0.18. No code changes; install stealthKit first, as above.
## 1.0.19
On horrorKit 1.0.20, which states controlsKit 1.4.7; use 1.0.20. No code changes; install stealthKit first, as above.
## 1.0.20
On horrorKit 1.0.21 (saveKit 1.3.21). No code changes; install stealthKit first, as above.
# stalkerKit 1.0.2
Horror monsters that hunt the player. Put a `Stalker` on a character, pick a **kind** with one field, and it listens, follows your torch light, stalks you out of sight, hunts where it heard you, searches where it lost you, chases, attacks, and slips back into a vent when it is hurt or caught in your light too long, to come back later. Five kinds ship (pursuer, shambler, lurker, light-shy, blind hunter); each is plain data a designer tunes without code.
stalkerKit is built on **aiKit** (brains, senses, memory), **navKit** (movement) and **SecondWind** (health and damage). That means **weaponsKit** weapons hurt the monsters with no extra wiring, and every aiKit character hears the same noises.
## Install
Install `stalkerKit.package` from ZeroMind (search "stalkerKit" or "monster that hunts the player by sound and light"). It needs aiKit 1.4.0 or later in the world (aiKit brings navKit, SecondWind, Lifeline and MatchFlow); 1.4.0 is the release that adds carried lights (`AI.setCarriedLight`), which is how a torch gives the player away.
## First example
In code that runs in play on the host, once the level's colliders exist, with a navKit map baked over the floor (`require("~navKit.api").bake({ kind = "grid" })`, a frame or more after the walls are spawned; see Known limits):
```lua
local Stalkers = require("stalkerKit.api")
-- a vent the pursuer can slip into (stand it on the floor in front of the opening)
Stalkers.addLair({ -56, 0, -404 })
Stalkers.addLair({ -4, 0, -456 })
-- the hunter and a drowned diver
local pursuer = Stalkers.spawn("pursuer", { -25, 0, -412 })
local diver = Stalkers.spawn("shambler", { -20, 0, -430 })
-- your game hands over its own: here a stand-in player body, its camera's forward and a shot
local playerBody = entity.spawn("playerBody"); playerBody.position = vector.create(-25, 0, -420)
local cameraForward = vector.create(0, 0, -1)
local shooterBody, shotPosition = playerBody, vector.create(-25, 1.5, -420)
-- weapon fire, doors and torch clicks give the player away
Stalkers.hearNoise(shotPosition, "gunshot", shooterBody)
-- a torch kit says how visible a player is (0 dark .. 1 torch on) and where the beam points
Stalkers.setPlayerLight(playerBody, 1, cameraForward)
-- a tension director reads how close the danger is
local danger = Stalkers.threatFor(playerBody) -- 0..1
Stalkers.on("noticed", function(e) print(e.entity.name, "is after", e.target.name) end)
```
Or place it by hand: a synced entity with `stalkerKit.Stalker { kind = "pursuer" }` (it adds the aiKit `Brain` itself), and `stalkerKit.StalkerLair` on the entities in front of your vents.
## Kinds
| kind | look | senses | what it does | dies? |
|---|---|---|---|---|
| `pursuer` | tall, gaunt, too-long limbs and claws, pale wet skin, barnacle crusts, an eyeless elongated skull with a slit of needle teeth | sees only lit things (beyond 4.5 m), 24 m, 140°; hears 1.7× as far; notices a torch beam in its face from 16 m and a lit torch inside its cone from 36 m | the main hunter: hears shots, running, doors, torch clicks and thrown things; stalks out of sight at 8-14 m for up to 9 s, commits when you come close, shine your torch on it or it has watched long enough; chases, attacks (28 dmg); hunts and searches the last-known spot; after 5 s lit, 22% health lost in 6 s or 22 s of chasing it screeches and runs to the nearest vent, crawls in, heals for 16-30 s and crawls out of the vent nearest a player | no: at 20% health it retreats and heals |
| `shambler` | a drowned diver: bloated, in a rotting canvas suit, cracked brass helmet with a swollen face behind the porthole, lead boots, kelp | 9 m sight, poor hearing (0.8×), remembers for 40 s | slow (0.85 / 1.55 m/s), relentless (gives up after 12 s unseen), grabs and bites (34 dmg, slow), 360 HP, shrugs off small hits | yes |
| `lurker` | a darker, crouched pursuer thick with barnacles | 16 m, all round | waits motionless where you put it; moves only while no player is looking at it (freezes in your view); lunges from 3 m with a hiss; after a short chase melts back into a lair or the dark | yes |
| `lightshy` | pale pink skin with glowing blue spots on its skull | 18 m, notices beams | circles at 5-9 m at the edge of your light; a beam or strong light on it for 1.2 s makes it recoil to the nearest dark; strikes the moment you stand in darkness | yes |
| `blind` | grey-green, eyeless, a huge barnacle-crowned skull | hearing only, 2.2× (a walking footstep from 11 m) | goes where it heard; walk slowly (silent), throw something, or stand still | yes |
### Body styles (`stalker.body`, one field)
Every kind's look is its `stalker.body` knob, so any kind can wear any body: `pursuer`, `shambler`, `lurker`, `lightshy`, `blind`, and `drowned`.
`drowned` (new in 1.0.9): a tall (2.55 m), gaunt, long-limbed, hunched figure draped in river weed and dripping silt. Dark olive-brown silt skin that stays matte under a torch (roughness 0.88, metallic 0, almost no clearcoat), a dark elongated skull, long dark claws, no barnacles and nothing that glows. About 40 strands of weed hang from the head, shoulders, elbows, hands, back, hips and thighs; each hangs from gravity whatever the pose, bends in two segments and sways in `Body.update` (more while it moves), and a pool of 10 silt drops falls from the strand tips and is reused (parked while the body is hidden). Use it on any kind:
```lua
Stalkers.tuneKind("pursuer", { stalker = { body = "drowned" } }) -- every pursuer
Stalkers.defineKind("riverman", { base = "pursuer", stalker = { body = "drowned", sounds = "shambler" } })
```
Every kind is an aiKit preset (`stalker.<kind>`) plus a `stalker` table of knobs. Change them for the whole game:
```lua
local Stalkers = require("stalkerKit.api")
Stalkers.tuneKind("pursuer", { stalker = { stalkTime = 15, hideTime = { 40, 60 } }, preset = { move = { run = 5.6 } } })
Stalkers.defineKind("hound", { base = "pursuer", label = "Hound", preset = { move = { run = 7 } }, stalker = { stalk = false } })
```
### Knobs (`stalker` table)
| knob | pursuer | meaning |
|---|---|---|
| `drawnToLight` | 1 | 0..1: a lit torch inside its eyes' cone is a lead out to 36 m × this |
| `lightShy` | 0 | light level where it stands that it cannot bear (0 = never) |
| `litTolerance` | 5 | seconds in a beam / strong light before it breaks off (0 = never) |
| `attackOnlyInDark` | false | will not close in while the prey stands in light |
| `stalk`, `stalkRange`, `stalkTime`, `commitRange` | true, {8,14}, 9, 5 | keep its distance out of sight before committing |
| `huntRun` | true | runs to loud leads (gunshot, door, shout) |
| `chaseTimeout` | 22 | seconds of chase before it slips away (0 = never) |
| `searchTime`, `vanishAfterSearch` | 14, 0.5 | how long it searches; the chance it then slips into a lair |
| `retreats`, `hurtRetreat` | true, 0.22 | breaks off after losing this share of health within 6 s |
| `dies`, `floor` | false, 0.2 | false: never drops under `floor` health; retreats and heals instead |
| `hideTime`, `returnNear` | {16,30}, true | seconds in the lair; come out of the lair nearest a player |
| `lurk`, `freezeWhenWatched`, `springRange` | false, false, 3 | ambusher behaviour |
| `flinch`, `staggerAt` | 0.3, 30 | seconds a hit stops it; damage in one hit that staggers it twice as long |
| `grab` | false | slow grab-and-bite attack |
| `breathEvery`, `screechOnNotice` | {4,7}, true | feel |
| `body`, `sounds` | pursuer | which body and sound set it uses |
## API (`local Stalkers = require("stalkerKit.api")`)
| call | what it does |
|---|---|
| `Stalkers.spawn(kind, at, opts?) -> entity` | Spawn a synced stalker (`opts`: name, yaw, lairGroup, route, active). |
| `Stalkers.addLair(at, opts?) -> entity` | A vent / dark hole at a position, or on an entity (`opts`: group, kind = "vent" or "dark", yaw). |
| `Stalkers.sendTo(e, pos, { run })` | Send it to look at a spot. |
| `Stalkers.retreat(e)` | Break off now and slip into a lair. |
| `Stalkers.appearAt(e, pos, { face })` | It crawls out at a spot, then hunts toward the nearest player. Cancels a retreat still under way and releases a `holdHidden`. Orders sent in the same moment are all seen, in order; the last that changes what it does wins. |
| `Stalkers.holdHidden(e, on)` | Keep it in its lair until released. |
| `Stalkers.setKind(e, kind)`, `Stalkers.setActive(e, on)` | Switch kind; switch its brain off/on. |
| `Stalkers.hearNoise(pos, loudness, source?, kind?)` | A noise: metres or a name (`gunshot` 35, `slam` 22, `throw` 16, `door` 14, `run` 11, `impact` 10, `click`/`torch` 6, `footstep` 5). `source` = who gives themselves away. Goes through aiKit's noise bus. |
| `Stalkers.setPlayerLight(player, level, beamDir?, { range, cone })` | A torch kit reports a player's light (0..1) and beam; call it on the player's own peer. |
| `Stalkers.playerLight(player)` | The light as the monsters know it. |
| `Stalkers.threatFor(player) -> 0..1` | Danger for a tension director: nearest stalkers, what they do, whether they are after this player. Every peer. |
| `Stalkers.list()`, `Stalkers.info(e)`, `Stalkers.nearest(pos, { visible })` | What is out there. |
| `Stalkers.kindNames()`, `kind(name)`, `defineKind`, `tuneKind` | The kinds as data. |
| `Stalkers.on(event, fn) -> connection` | Events (below); call the connection or `:Disconnect()` to stop. |
## Events
| event | payload | fires on |
|---|---|---|
| `state` | `entity, state, from, detail`, state is `idle`, `stalk`, `hunt`, `search`, `chase`, `retreat` or `attack`; `detail` is the brain's own state (lurk, creep, recoil, vent, hidden, appear...) | every peer |
| `noticed` | `entity, target` | every peer |
| `lost` | `entity, target` | every peer |
| `attacked` | `entity, target, kind` (attack, grab) | every peer |
| `hurt` | `entity, amount, by` | the peer running it |
| `retreated` | `entity, lair` | the peer running it |
| `appeared` | `entity` | the peer running it |
| `died` | `entity, by` | the peer running it |
| `noise` | `position, radius, kind, source` | the peer that called hearNoise |
| `*` | `{ event, data }` | all of the above |
## Fighting them
Their health is SecondWind's, so weaponsKit's hitscan, projectiles and melee hit them (weaponsKit hits collider-less characters as a capsule; the Stalker sizes it to the creature: 2.3 m for the pursuer, 0.5 m wide for the shambler). A hit flinches them; one of 30+ damage staggers. The pursuer cannot be killed by default (`dies = false`): it screeches and retreats to heal, so ammo buys time, not safety. The shambler dies after about 360 damage. **Ammo is the level's job**: keep it scarce (a handful of rounds per encounter) so running, hiding in the dark and turning the torch off stay the better answer.
## Multiplayer
The host (or the entity's owner) runs the brains through aiKit; every peer builds the same body from the synced `kind` and animates it from the synced pose and one-shot counter, and plays the sounds locally, so nothing but a few fields crosses the network. Any player can be hunted. Torch reports go from each player's peer to the host through aiKit's carried-light channel. Scripted orders (`sendTo`, `retreat`, `appearAt`, `holdHidden`) work from any peer.
## Performance
Each stalker is one aiKit brain (senses 10×/s, thinks 15×/s) plus a skinned body with ~60-110 small parts and an AnimGraph ticked in script. A pursuer is roughly one aiKit character plus one animated body; two or three on screen are fine on a tablet. Parts cast no shadows where they are small. Lower `AI.config.senseRate` / `thinkRate` for weaker devices.
## Known limits
- **Nothing reports your torch to the monsters unless something calls `setPlayerLight`.** horrorKit does it for flashlightKit's torch; with flashlightKit alone, call `Stalkers.setPlayerLight(body, Torch.visibility(nil))` on the player's own peer a few times a second.
- **Switching the torch off does not shake a pursuer that already has you.** Measured in an empty world, twice: standing still in the dark with no lead, it never found the player (idle at 18 to 21 m for 20 s); with the torch on it noticed at about 14 m, stalked and caught the player within about 10 s; switching the torch off then (during the chase, or after sending it to a lair) did not lose it: it went to where it last knew the player and, since it sees an unlit player inside `darkRange` (4.5 m), found them and kept attacking. Put distance, a door or a hiding place between you before you go dark.
- **Bodies are a re-proportioned stock rig.** Mesh generation was out of quota when this was built, so every creature is the engine's rigged humanoid stretched, re-skinned and dressed with procedural parts. A generated or imported rigged creature can replace it in `stalkerKit.body` (`Body.STYLES`).
- **A hidden stalker keeps its hit volume at its lair.** Shots into an empty vent can still hit it.
- **Lurker "watched" check uses where each player faces** (the torch report's beam when there is one, else the avatar's turn), not the exact camera.
- **Bake the navKit map after the level's colliders exist**: a grid map baked in the same frame the walls were spawned has no walkable cells and every stalker stands still ("unreachable").
- **Vents are entry points, not paths**: a stalker vanishes into one and comes out of another; it does not crawl through ducts.
## Tests
`tools.use("tests", "run", { suite = "stalkerKit" })` (edit mode): kinds and presets, the API, hearNoise reaching aiKit's bus, events, threatFor, and a play test where a pursuer hears a gunshot and goes to it.
## Version history
- **1.0.0**: First release: five kinds, the stalker brain, the Stalker and StalkerLair components, bodies, generated animations and sounds, the api with noise, light, threat and scripting hooks, a guide and a test suite.
## 1.0.2
README only: how to bake the navKit map in the first example; that the torch reaches the monsters only through `setPlayerLight` (horrorKit or your own code); what a pursuer does when you go dark mid-chase.
## 1.0.1
Bodies use lit materials, so a monster in a dark room is invisible until a light finds it. Overhead health bars are off by default (`healthBar` field). `setActive` reliably wakes and stills a monster. Declares aiKit 1.4.0 and its other dependencies with versions.
## 1.0.10
A Stalker whose kind the game defines after it woke now waits for that kind instead of failing. A joining player's engine receives the creature before the game's start code defines its own kinds, and the Stalker used to hand aiKit the unknown preset at once, which threw ("aiKit.addBrain: unknown preset 'stalker.<kind>'") and disabled the component for good on that player's side. Now its brain and body are built as soon as the kind exists (`Kinds.has(kind)` is new). New test: "waits for a kind defined after it woke". Found in Low Water's co-op.
## 1.0.9 (`stalker.body = "drowned"`): tall, gaunt, long-limbed and hunched, draped in swaying river weed, dripping silt, matte dark silt skin, nothing glows. `appearAt` now always cancels a retreat in progress: orders queue until the brain next thinks instead of the later one overwriting the earlier, a non-retreat order clears the retreat and frees the lair it was heading for, and `appearAt` releases a `holdHidden` (a game no longer needs to switch the brain off and on to bring it out). New test "appearAt cancels a retreat in progress".
## 1.0.8
Correction to 1.0.7: its wait for the sky light does not prevent the occasional 6 "camera texture not found" errors during the in-play test, so it is removed. Those errors come from the engine, not this kit: switching into play makes the sky light build six internal capture cameras, the test runner's leftover sweep removes them when the test ends, and the sky light later draws through the removed cameras (reported to ZeroMind). The tests pass either way; a plain install and play logs none. No changes outside the tests and README.
## 1.0.7
The tests leave no camera errors: the play test restarts the sky light, and each test now ends only once the sky light has finished its capture, so the runner's cleanup never removes capture cameras with a picture still queued. No changes outside the tests.
## 1.0.6
The tests remove everything each test (and the monsters it spawned) left behind and wait for previews a fresh install is drawing, so a passing run leaves no errors. The second README example requires the API itself and runs on its own. No changes outside the tests and README.
## 1.0.5
Declares SecondWind 1.4.8, the version stealthKit 1.0.22 brings, so a world with both kits runs one SecondWind. No code changes; stalkerKitTests 7/7 on 1.4.8.
## 1.0.4
Declares SecondWind 1.4.7, the newest SecondWind release, which is what an install beside stealthKit 1.0.20 places (it stated 1.4.8). No code changes; stalkerKitTests 7/7 on 1.4.7.
## 1.0.3
Bodies keep their surfaces again on the current engine: each part's roughness, clearcoat and glow (the pursuer's eyes and spots, the diver's porthole) went to `Model:setMaterialProperties`, which now writes the shared material and failed on the kit's runtime materials (hundreds of warnings, flat parts). Parts and skins now get materials of their own with those values, made once per look; no shared material is ever repainted. README: the first example defines the player body, camera forward and shot it uses.
# flashlightKit 1.0.4, flashlights, lanterns, flares and batteries for horror games
Named **flashlightKit** since 1.0.1 (it was published as torchKit in 1.0.0). Search for either name.
A handheld light for first-person horror, survival and exploration games. Put one component on the player and they get a real shadow-casting light that lags and sways with the view, a held model with a glowing lens, a click, and a battery that runs down, browns out, stutters and dies. Twelve styles are switched by one field, from the classic torch to a swinging oil lantern, a red road flare you can throw, a glow stick, a guttering candle, a hand-crank dynamo torch, a UV black light that shows hidden writing, and a camera flash.
## Install
Search ZeroMind for **flashlightKit** and install it. Its `package.yaml` declares interactKit 1.6.8 and inventoryKit 1.0.27, so the install brings them and the kits under them (in an empty world: interactKit, inventoryKit, controlsKit, juiceKit, saveKit, menusKit, pickupsKit, SecondWind, Lifeline, MatchFlow) into `/source/deps/`. The torch works without using them: the battery bag and use prompts are the only parts that read them.
## First example
Put the component on the body of your player prototype (every player who joins gets their own torch):
```lua
-- In a game this goes on your player prototype's body (in the scene's build). To try it anywhere,
-- here is a stand-in body to carry it:
local body = entity.spawn("torchCarrier")
body.position = vector.create(0, 1.6, 0)
body.component.add(asset.resolve("flashlightKit.Torch", "component"), { style = "classic", spares = 2 })
```
Press **F** (gamepad d-pad up, or the on-screen **Torch** button on a phone) to switch it on. **V** shakes it (fixes a loose contact, cranks a dynamo while held, throws a flare or glow stick). **B** swaps in a spare battery. A small battery meter sits bottom-left.
Story code:
```lua
local Torch = require("flashlightKit.api")
Torch.on("batteryLow", function(e) print("low", e.charge) end)
Torch.flicker(nil, 2.5, 0.8) -- this peer's player: a hard 2.5 s flicker
Torch.fail(nil, "brownout") -- fades out until restored
task.delay(4, function() Torch.restore(nil) end)
```
## Styles
| style | light | colour | cone / range | battery | runs low by | extras |
|---|---|---|---|---|---|---|
| `classic` | shadowed spot + faint wide spill | warm white | 24° half, 26 m | `alkaline` (10 min) | brown-out fade with dips | held torch, glowing lens |
| `penlight` | narrow spot | white | 12° half, 14 m | `aaa` (7 min) | loose contact (shake to fix) | thin pen model; random contact faults |
| `lantern` | omni point | orange | 9 m | `oil` (15 min) | sputter | swings on its bail as you turn and walk |
| `headlamp` | spot on the head, no lag | cool LED | 30° half, 20 m | `pack` rechargeable (12 min) | steps down to low mode, then cuts out | no held model, hands free |
| `phone` | wide weak spot | cold blue-white | 46° half, 11 m | `phone` (8 min) | sudden death at 0 % | phone model with lit screen |
| `flare` | omni point | red | 14 m | `flare` (2.5 min burn) | sputters out | hissing loop; **V** throws it (keeps burning where it lands) |
| `glowstick` | omni point | green | 6 m | `chemical` (30 min) | never dies, dims to 30 % | **V** throws it |
| `candle` | tiny omni | orange | 6 m | `wax` (20 min) | gutters | blown out when you run; **F** relights |
| `dynamo` | spot | warm | 26° half, 20 m | `dynamo` (50 s per full crank) | brown-out | hold **V** to crank (ratchet sound) |
| `uv` | spot | violet | 22° half, 12 m | `alkaline` (7 min) | loose contact | reveals `UVReveal` surfaces in its cone |
| `cameraFlash` | blinding spot for 0.16 s | daylight | 48° half, 24 m | `flashcell` (40 flashes) |, | **F** fires; 2.2 s recharge; `flash` event |
| `lighter` | tiny omni | orange | 5 m | `butane` (5 min) | gutters | blown out when you sprint |
`require("flashlightKit.styles").define(id, fields, base)` adds your own; any field left out comes from the base.
## Batteries
`alkaline`, `aaa`, `pack` (rechargeable), `oil`, `flare`, `dynamo` (rechargeable by cranking), `phone` (rechargeable), `chemical`, `wax`, `flashcell`, `butane`. Each has a discharge curve (alkaline sags gradually, Li-ion holds then drops off a cliff, oil and flares hold then sputter, phones die suddenly) and a `lowAt` threshold where the style's low-battery behaviour starts. Charge only drains while the light is on.
- **Spares**: the Torch's `bag` (synced table, `{ alkaline = 2 }`). `Torch.give(player, type, n)`, `Torch.swap(player)`, `Torch.spares(player)`.
- **BatteryPickup** component: batteries lying in the world (walk over, or `interact = true` with interactKit). With inventoryKit installed they go into the inventory as items (`torch_battery_aa`, `torch_battery_pack`, ...) and a swap takes from there.
- **ChargingStation** component: rechargeable types charge while the player stands within `radius`. `powered = false` cuts it (power outage).
## API (`require("flashlightKit.api")`)
`player` is nil (this peer's player), a player record, an entity, or an entity id. Every call works from any peer: the owner applies it and every peer sees the result.
| call | does |
|---|---|
| `Torch.flicker(player, seconds?, severity?)` | timed flicker, severity 0..1 |
| `Torch.fail(player, mode, seconds?)` | `brownout`, `contact` (until shaken), `sudden`, `sputter`, `flicker`, `stepdown`, `gutter`; nil seconds = until restored |
| `Torch.restore(player)` | clears failures and flicker |
| `Torch.setCharge(player, 0..1)` / `Torch.charge(player)` | battery |
| `Torch.isOn(player)` | giving light now; `Torch.switchedOn` = switch position |
| `Torch.lightOf(player)` | the Light entity on this peer |
| `Torch.set(player, on)` / `Torch.toggle(player)` / `Torch.setStyle(player, id)` | switching |
| `Torch.give` / `Torch.swap` / `Torch.spares` | spares |
| `Torch.visibility(player)` | 0..1 how visible the torch makes the player (style-weighted), feed it to monster sight |
| `Torch.lights(player, point)` | 0..1 how strongly the beam reaches a world point (cone + range) |
| `Torch.beams()` | every lit torch: position, forward, range, angle, level, visibility |
| `Torch.setQuality("high" \| "medium" \| "low")` | how many other players' torches cast shadows |
| `require("flashlightKit.hud").setEnabled(false)` | hide the built-in meter (draw your own from `Torch.charge` / `spares`) |
| `require("flashlightKit.audio").override(name, clip)` | swap any sound |
## Events (`Torch.on(name, fn) -> disconnect`)
`toggled{player,on}`, `batteryLow{player,charge}`, `batteryDead{player}`, `swapped{player,battery}`, `failed{player,mode}` (the names horrorKit wires), plus `flash{player}` and `charged{player,charge}`. They fire on the peer that owns the torch.
## Components
- **Torch**, the light (fields above plus `startOn`, `spares`, `drainScale`, `controls`, `meter`, `autoSwap`, `randomFaults`, `shadows`, `npc` for torches carried by NPCs or test dummies).
- **BatteryPickup**, **ChargingStation**, **UVReveal** (hidden writing), **ThrownLight** (spawned by a throw).
- Controls: `flashlightKit.torch` input map (group `torch`): `torchToggle` F / d-pad up / touch, `torchShake` V / d-pad down / touch, `torchSwap` B / d-pad left / touch.
## Multiplayer
Every player has their own torch. The owner writes `on`, `style`, `charge`, `fault`, flicker and aim `pitch` (synced, pitch only when it moves 2°); every peer draws every torch from those fields and the shared session clock, so flicker and brown-out look identical everywhere and nothing streams per frame. Battery is per player and owner-authoritative; story calls made on another peer are sent to the owner. Thrown flares are synced entities.
## Performance
About 0.04 ms of script per torch per frame (four torches measured at 0.17 ms). Light parameters are written only when they change. The owner's own torch always casts shadows; other players' torches cast shadows only when near (22 m) and within the quality budget. Held models are a handful of primitives with shadows off.
## Known limits
- **F** is also controlsKit's fps-scheme secondary interact key; interactKit's E is unaffected. Rebind `torchToggle` in `torch.inputMap` if your game uses F.
- Held models are built from primitives (no mesh assets), so they read as stylised props up close.
- **Darkness needs no sky in the scene.** A sky entity (the new-world template's `lighting` scene setup included) lights interiors even through a camera with `environment = "isolated"`, and it keeps doing so with its sun and ambient at 0: measured in an empty world, a closed room with every light and the torch off read mean 37/255 with the template's lighting left in, and 0.5/255 with it deleted. For an interior, delete the template's `lighting` entity and keep a near-black ambient `Light` of your own (switch it off with `intensity = 0`).
- flashlightKit alone does not tell monsters about your light. horrorKit wires it; without horrorKit, report it yourself on the player's own peer, for example `Stalkers.setPlayerLight(body, Torch.visibility(nil))` with stalkerKit, a few times a second.
- Two-peer play was verified through the remote drawing path (NPC torches use it), not with a second live player.
## 1.0.4
The held light follows the player's view only while the main camera is with the carrier. The rig placed the torch at whatever `camera.main()` names, so a game whose main camera was some other view (a title or establishing camera left as main, a camera rig whose Camera sits elsewhere) got a torch that reported on at full power while lighting a spot far from the player. Now, when the main camera is more than `Rig.EYE_REACH` (2.5 m) from the carrier's eye, the torch is held at the carrier's own eye (body + 1.6 m, turned by the body's yaw and the synced pitch) and one warning names the distance. New test covers both cases. Also measured for this release: in a closed bulkheadKit room under an `isolated` camera, the classic torch at intensity 41 lights the floor ahead and its own held model never shadows it (the model casts no shadows).
## 1.0.3
The first README example now makes its own stand-in body to carry the torch, so it runs as pasted into a world with only flashlightKit installed (it used a `body` it never set up). No code changes.
## 1.0.2
README only: the install brings interactKit and inventoryKit (it said it had no dependencies); darkness needs the template's sky deleted (it said a sky of the scene's own was enough); how to tell monsters about the light without horrorKit.
## 1.0.1
Renamed from torchKit. A battery pickup takes and gives exactly once per press, across reloads and play sessions. The held model, lens and battery use lit materials, so nothing glows when the light is off. Quality (shadow count) is picked from the device on its own (`setQuality(\"auto\")`). Declares its dependencies with versions.
# Brinefall Station
A short, original survival-horror level built entirely from installable parts: the horror kit (`horrorKit` and the packages it installs) and `bulkheadKit` for the station itself. It is both a level to play and a worked example to read.
1986, a research habitat 480 m down on the lip of a trench, silent for nine days. You are a contract diver sent down in the station's own diving bell. Something in the ducts has learned the station's sounds, and it follows light.
## What it contains
| module | what |
|---|---|
| `brinefall.layout` | the station's 11 rooms and their dressing (bulkheadKit), returning named anchors |
| `brinefall.content` | doors, the red keycard and its lock, the breaker lever, lore props, scarce supplies, the med-bay safe room and save terminal, the two monsters and their vents, the HorrorDirector |
| `brinefall.story` | the eight lore entries (notes, memos, terminals, tapes) |
| `brinefall.script` | the scripted beats: five scares, the pursuer encounter, the breaker, the finale and the ending |
| `brinefall.playtest` | plays the level start to end with real input and reports when each of the 12 cues fired, how often, every scare and monster state (`require("brinefall.playtest").run()` in play) |
`DESIGN.md` has the route, the beats and the story.
## Use it
The scene build calls `Layout.build(root)` and then `Content.build(anchors)`; `brinefall.LevelScript` (placed on the HorrorDirector) and the scene entrypoint's `onLoad` call `require("brinefall.script").start()`. Everything a player shares (doors, monsters, scripted events, lights) is synced or host-decided, so two players see the same station.
## 1.0.17
On horrorKit 1.0.21 (saveKit 1.3.21). No code changes.
## 1.0.16
On horrorKit 1.0.20, which states controlsKit 1.4.7; use 1.0.17. No code changes.
## 1.0.14
On horrorKit 1.0.18 and bulkheadKit 1.0.3. No code changes.
## 1.0.13
On horrorKit 1.0.13. No code changes.
## 1.0.12
On horrorKit 1.0.12. No code changes.
## 1.0.11
On horrorKit 1.0.11. No code changes.
## 1.0.10
On horrorKit 1.0.10. No code changes.
## 1.0.9
On horrorKit 1.0.9: no saveKit XP bar over the level, quiet when play stops.
## 1.0.8
On horrorKit 1.0.8.
## 1.0.7
On horrorKit 1.0.7.
## 1.0.6
- Every scare fires once at its moment: the knock and the shape crossing are essential now, like the lights-closer, body drop and dock slam. In one playthrough the tension director's pacing vetoed both as the player walked through, and a walk-through trigger does not come back, so they were lost for that run.
- New `brinefall.playtest`, the playthrough driver the 2026-11-23 runs used.
- On horrorKit 1.0.6.
## 1.0.5
On horrorKit 1.0.5.
## 1.0.4
On horrorKit 1.0.4 and bulkheadKit 1.0.2.
## 1.0.3
- No longer depends on stealthKit. The HUD keeps its light and noise element on (`showStealth`); it draws when the world places `horrorStealthLink.StealthReadout`, which this world's scene does, and draws nothing otherwise. Declares menusKit (the ending screen) and horrorKit 1.0.3.
## 1.0.2
- `start()` now waits for play to settle when the entrypoint calls it during the edit to play flip (engine.mode still "edit"); before, a fresh engine defined no cue at all and no beat fired.
- The scene entrypoint hook is `onLoad` (this engine has no `onLoadDefault`). `brinefall.LevelScript` (new component on HorrorDirector) starts the beats on the edit to play flip. The start guard is a time stamp, not a flag kept in module state.
- Moon-pool blockers are 3 m tall (a jump cleared the 1.4 m ones into the shaft). lightsCloser is essential (the pacing gate could drop it for good). The gallery console loads the gallery from a system task (a load started by the scene it unloads stalled half-way).
# loreKit
Version **1.0.6**.
Notes, documents and audio logs that tell your game's story. Put a **Lore** component on a prop and the player can read it: a full-screen **reader** opens in one of **seven styles**, switched by one field. Everything found goes into the player's **journal** with unread markers, saved per player through saveKit. Reading pauses nothing (the world keeps running for everyone), it closes with **Esc**, the pad's **B**, or a big **tap** target, and it is sized for phones and tablets. Ships nine original example entries, two generated voice logs and two generated photos.
## Install
Install `loreKit` from ZeroMind. It needs nothing else and installing it brings no other kit. It works with these when the game links them (`require("~loreKit.links").link("interactKit.api", require("~interactKit.api"))`; `require("~horrorKit.api")` links all three):
| Kit | Used for |
|---|---|
| interactKit | the standard Read prompt on a Lore prop (E / pad X-west / touch button, look-at or proximity) |
| saveKit | saving each player's journal (`Save.set("loreKit", ...)`) |
| soundstage | ducking music and ambience under a tape |
## First example
```lua
local Lore = require("~loreKit.api")
Lore.define({ id = "first_note", style = "note", title = "A torn page", body = "Don't run. It hears the grating." })
-- on a prop, in the editor: add loreKit.Lore, set id = "first_note" (or write title/body there)
-- or from code, on any prop (here a new one):
local prop = entity.spawn("tornPage")
prop.component.add("loreKit.Lore", { id = "first_note" })
Lore.on("read", function(e) if e.first then print("found", e.id) end end)
```
In play, walk up to the prop and press E. Press **J** (or the pad's View/Select, or tap the badge) for the journal.
## Reader styles (`style` = one field)
| Style | What the player sees and hears |
|---|---|
| `note` | handwritten italic on stained, creased paper, slightly askew; paper rustle |
| `memo` | typed office memo: letterhead, FROM / DATE / SUBJ, typewriter face, CONFIDENTIAL stamp |
| `terminal` | CRT terminal; green phosphor text types itself out with a blinking cursor (`variant = "amber"` for amber); beep and keys |
| `tape` | dictaphone deck with spinning reels, timer and progress; plays the entry's `clip` with tape hiss and timed subtitles (from `subtitles`, or made from the body's sentences); music ducks under it |
| `graffiti` | big rough red letters scrawled on a grimy wall |
| `datapad` | sci-fi tablet: bezel, glowing header bar, clean type |
| `photo` | pinned instant photo (`image`) with a handwritten `caption` |
`Lore.open(id, { style = "terminal" })` shows any entry in another style.
## Entries
`{ id, style, title, body, author?, date?, clip?, subtitles? = { { at, text } }, image?, caption?, variant? }`. `clip` is a soundClip ref (or a loreKit clip name), `image` a texture reference (or a loreKit image name).
Examples (original, a half-flooded deep-sea research station): `ring_c_note` (note), `curfew_memo` (memo), `sonar_terminal` (terminal), `tape_varga_14` and `tape_reyne_02` (tape, generated voices), `scrawl_light` (graffiti), `pad_manifest` (datapad), `crew_photo` and `camera_still` (photo, generated images).
## The Lore component
Fields: `id`, `style` (`default` or one of the seven), `title`, `body`, `clip`, `label` ("Read"), `range` (2.2 m), `trigger` (`look` / `proximity`). With interactKit it adds an Interactable beside itself; without it, E or the pad's west button opens it within range. Event `read{id}`. Only the player who used it reads it.
## API (`require("~loreKit.api")`)
| Call | Does |
|---|---|
| `define(entry)`, `get(id)`, `ids()` | the catalogue |
| `open(id, opts?)` | open the reader (finds + marks read + fires `read`). `opts.style`, `opts.source` |
| `close()`, `current()` | close the reader or journal; the open id |
| `find(id)` | add to the journal without opening (true the first time) |
| `markRead(id)`, `isFound(id)`, `isRead(id)` | journal state |
| `journal()`, `unread()` | `{ { id, title, style, read } }` oldest first; unread count |
| `openJournal()`, `toggleJournal()`, `resetJournal()` | the journal screen; a new game |
| `setSubtitles(on)`, `subtitles()` | this player's tape subtitles on or off (default on), for a settings menu; saved in their saveKit profile (`loreKit.settings`) when saveKit is linked; an open tape redraws at once. `open(id, { subtitles = false })` overrides it for one open |
| `STYLES`, `STYLE_INFO`, `VERSION` | |
## Events
| Event | Payload |
|---|---|
| `read` | `{ id, style, title, first, source }` |
| `found` | `{ id, title }` |
| `opened` / `closed` | `{ id }` / `{ id, seconds }` |
| `journal` | `{ open }` (or `{ loaded = true }` after saveKit loads it) |
| `settings` | `{ subtitles }` (and `loaded = true` when a saved choice was applied) |
## Input
| | Keyboard / mouse | Gamepad | Touch |
|---|---|---|---|
| Read | E (interactKit prompt) | X / west | Interact button |
| Close | Esc, Backspace, ✕ button, click outside | B / east | tap ✕ (56 pt tall) or outside |
| Journal | J | View / Select | tap the badge |
## Multiplayer
The reader, journal and badge are local to each player: reading pauses nothing for anyone, and only the player who used a Lore prop sees it. Each player's journal is their own and is saved in their own saveKit profile. Entries defined in code exist on every engine that runs that code.
## Known limits
- Without saveKit the journal lasts the session only.
- Tape subtitles made from the body are timed by sentence length; give `subtitles` for exact timing.
- The badge and journal key are fixed per host (`LoreHost.journalKey`, default J).
## 1.0.1
Escape closes only the open reader or journal; it no longer also opens the engine menu. Declares its dependencies with versions.
## 1.0.2
Installs alone: interactKit, saveKit and soundstage are linked by the game through `loreKit.links` instead of being required by name; `require("~horrorKit.api")` links them.
## 1.0.3
README: the first example spawns the prop it adds Lore to, so it runs as written.
## 1.0.4
The reader test no longer leaves engine errors behind: it removed the reader screen in the same frame it showed it (14 "parent never materialized" errors per run). It now lets each screen settle before closing it. The reader itself is unchanged.
## 1.0.5
The tests remove everything each test left behind and wait for previews a fresh install is drawing, so a passing run leaves no errors. No changes outside the tests.
## 1.0.6
Subtitles can be turned off. `Lore.setSubtitles(false)` hides the tape reader's timed subtitles for this player (a settings menu toggle), `Lore.subtitles()` reads it, and `Lore.open(id, { subtitles = true | false })` overrides it for one open. The choice is saved per player through saveKit (key `loreKit.settings`) when it is linked, an open tape redraws at once, and the `settings` event fires. Default unchanged (on). New test covers it.