Skip to content

Tune survival horror ​

Goal ​

Make a dark first-person escape game with battery management, stamina and a stalker. Use the horror starter, derived from FPS with combat removed.

Files you will edit ​

  • src/game.ts
  • src/level.json

Steps ​

  1. Change walkSpeed, sprintSpeed and batteryDrain in the game rules.
  2. Move the three Supply keys, battery supplies, patrol TargetPoints and exit in the level. Keep NavigationModifier footprints aligned with interior wall blocks.
  3. Keep the premade SpotLight's cameraAttached: true to follow view yaw and pitch. Toggle its enabled prop for the beam. The SDK sends pooled set-spot-light commands; the host owns the light and removes it on despawn. Light forward is local -Z.
  4. The survivor actor owns stamina({ maximum: 5, drain: 1, regen: 0.5, recoveryDelay: 1 }). Set staminaOf(actor).requested while moving. Exhaustion locks use until fully recovered. Component state is serializable. No DOM or rendering code belongs in the guest.
  5. Use AIController navigation and senses to retain only last-known positions. Sprint noise uses reportNoise; sight and hearing refresh a six-second memory. Keys unlock the premade HingedDoor; opening and crossing the threshold wins, contact loses.

Verify ​

Run npx vitest run templates/horror in the repository. In the browser start the game, look up/down with LIGHT on, exhaust sprint, collect supplies, evade the stalker and exit. Test keyboard, gamepad and the touch buttons shown in the HUD help.

See also ​