Log inGet started
World

First-person survival horror game called…

Branchmain
Branchesmain
Commit31ce1f0625

README.md

player

The player's body in the dark, for LAST CARRIAGE: EVACUATION. Required by scenes/main.scene/entrypoint.luau, which calls start(ctx) on scene load, onPlayer(player) once the local body exists, update(dt) every frame in play, and stop() on unload.

It does not move the body itself — the avatar the scene's PlayerPrototype spawns carries the engine's CharacterController, and the CameraRig carries @builtin::controller.first_person, so walking and looking are already the engine's. This module is everything on top of that:

  • The gait. Walk, run and crouch, each with its own speed, its own footfall cadence and its own loudness from Core.NOISE. Every footfall is published twice: on aiKit's noise bus (AI.noise(pos, metres, body, kind), with Core.NOISE carried to metres by METRES_PER_LOUDNESS) and on Core's noise event. Crouching is genuinely quiet and genuinely slower; running is genuinely loud. Core.state.noiseLevel tracks what the body is making.
  • The eye. Crouch drops the camera from 1.62 m to 1.04 m; a step bob and a breath sway ride on top, both written through the camera behaviour's own offsetX/offsetY fields so they compose with the look the engine drives.
  • The torch. A narrow, hard-edged spot (13° outer, 6° inner, 11 m) held low and to the right, with a small warm wash at the hand. The cell drains over eleven minutes of play and the beam dims, misses and stutters as it goes.
  • The dust. Core.state.dust rises on the track bed and in the service tunnel, holds on the open platform and falls in the carriage and the maintenance room, at the rates in Core.DUST. The mask's filter is spent only in bad air, and at criticalAt the run ends on died.
  • The breath. In and out on a clock that quickens with exertion and with dust load, and audible in its own right.

Reading it

Player.get() returns { gait, noise, crouched, battery, eye } for the HUD, the screens or a debug overlay. Nothing else here is another slice's to call.

Notes for later passes

  • Sounds live in game/player.module/audio/ — step_walk, step_run, step_crouch, breath_in, breath_out, all hand-synthesized PCM.
  • The torch is lights only: no barrel mesh is drawn, so the beam is the whole of what the player sees of it. A held-torch model is a slot for polish.