Log inGet started
Package

RaceDirector.component

Newest version

README.md

RaceDirector — one race, from the gates to the result

The component that runs ターフヴィクトリー. It owns no geometry and no screen of its own: it drives the assets around it.

RaceDirector  (one instance, on the entity "RaceDirector" in scenes/main.scene)
 ├─ RaceSim.module          the rules — the oval, pace, stamina, 根性
 ├─ Horse1 … Horse8         Horse scene-module placements — moved every frame
 ├─ RaceCam                 the one camera, moved per mode
 ├─ HorseRaceUI.module      the start screen, the HUD and the result screen
 └─ RaceAudio.module        the beds, the stings and the spoken commentary

Place it in a scene with:

  • the eight horse placements named Horse1 … Horse8,
  • an entity called RaceCam carrying a Camera (any fov, high priority) and an AudioListener,
  • HorseRaceUI and RaceAudio present as modules.

What it does

  1. start — registers the UI screen and shows the start screen. The player picks a 作戦 (plan:nige … plan:oikomi), which sets public.plan.
  2. countdown — start begins a 3.4 s countdown with the field at the gates.
  3. running — every frame: RaceSim.step(race, dt), then each horse's position and yaw from RaceSim.pose(h.dist, h.lane), the camera for the live mode, commentary from the race's events (lead, final, drain, finish), and a HUD refresh at about 8 Hz. The crowd bed rises with how tightly packed the field is.
  4. result — placings and times, the prize for the placing, the career record updated, and the horse sharpened a little for a top-three finish. again (or the next start) runs a fresh race with the same horse.

Cameras

public.cameraMode — broadcast, chase, overhead; the HUD's buttons send cam:broadcast, cam:chase, cam:overhead.

  • broadcast — a trackside camera outside the oval on the pack's own normal, tracking it, and once the leader turns into the last 200 m it cuts to a low goal-front angle looking back down the straight.
  • chase — behind and just off the player's horse, low and fast.
  • overhead — high above the pack, following it round the oval.

The camera is a single entity whose position is written each frame and whose rotation is built as a yaw-then-pitch quaternion (the engine's models face +Z), so no second camera and no camera behaviour is involved.

Fields

fieldmeaning
public.planthe player's 作戦 for the next race
public.cameraModewhich camera is live

The career (runs, wins, earnings, best time) lives in the component's own state and survives a race, not an engine restart.