Skip to content

feat(fp): get in and drive cars - #10

Merged
KunalSiyag merged 2 commits into
mainfrom
fp/drive
Oct 20, 2026
Merged

KunalSiyag merged 2 commits into
mainfrom
fp/drive

Conversation

@KunalSiyag

Copy link
Copy Markdown
Owner

Summary

You can now get into a car and drive it, GTA style. Press F (gamepad Y) next to a stopped or parked car and the hero gets in and sits in the driver's seat.

  • Taking a car: traffic swaps it for a player-role car of the same model, which the AI no longer steps. If the car belonged to a resident, that resident's trip ends.
  • Handling (scripts/fp/drive/drive_model.gd): an arcade bicycle model.
    • Top speed 30 m/s (108 km/h), with braking and reverse (W/S or the triggers).
    • Steering (A/D) that tightens less at speed.
    • Grip by surface: grass holds the car well under its asphalt top speed.
    • A handbrake slide on Space.
  • Camera and HUD:
    • A chase camera that sweeps for collisions, and that you can orbit with the mouse or right stick.
    • A driver view on V.
    • The field of view widens with speed.
    • A speedometer chip with km/h and the gear (R/N/D) at the bottom centre, plus the F key chip ("Get in the car" / "Get out").
  • Collision: the car moves through CollisionWorld in substeps and bounces off buildings and props (crash()).
  • Traffic: AI cars and walkers yield to player cars, which they treat as oriented boxes, and stop behind them. A car you leave behind stays as an obstacle and is removed once it is out of range and out of sight.
  • Getting out: F again lets you out on the driver's side, or the other side, behind or in front, wherever there is room. You must be under 8.5 m/s; otherwise a toast says "Slow down to get out" or "No room to get out here". Interact prompts are off while you drive.
  • Wiring:
    • Feature drive in scripts/fp/drive/, behind the drive flag.
    • GameBus.drive_changed signal.
    • Input actions vehicle_enter, drive_throttle and drive_brake; only the [input] section of project.godot changed.
    • FpPlayer.ride().
    • Traffic API: enter_target, claim_car, drive_car, leave_car, driven_id and seat_offset.
    • The pause menu lists the F key.

Area

  • sim
  • ai
  • fp
  • world
  • assets
  • tooling / CI

Testing

  • tools/gate.sh quick passes
  • tools/gate.sh full passes (gameplay or rendering changes)
  • pre-commit run --all-files passes (on the changed files)
  • Added or updated a test in tools/tests/
  • Checked in game (describe below, screenshots welcome)

New fp_drive_test:

  • Model checks:
    • 3 s of full throttle reaches 40-90 km/h.
    • The car holds its top speed.
    • Braking stops it.
    • Reverse works.
    • Steering goes the right way.
    • Grass slows the car.
    • The handbrake makes it slide.
  • Getting in by a stopped car: the car turns into a player car of the same model, and the bus emits drive_changed.
  • The hero's hips sit within 5 cm of the seat, and the hero is in the sit pose.
  • Driving down a straight road: traffic sees the car's speed and the speedometer reads km/h.
  • Lane traffic stops behind the player's car.
  • Getting out is refused at speed and works once the car slows; the speedometer then goes away.
  • A crash into a wall.
  • Key and gamepad bindings, and teardown.

fp_core_test now counts 11 registered features.

I checked it in windowed captures at 1280x720. I got into a parked car (the chip showed "Get in the car"), saw the hero seated through the rear glass, drove at 34-48 km/h in the chase view, and checked the turn, the driver view and getting out at the door. The captures turned up two bugs, both fixed in this PR:

  • The speedometer stayed on screen after getting out.
  • The speedometer overlapped the district name in the bottom-right corner, so it moved to the bottom centre.

Known asset limitation: in driver view, some v2 car models show a flat white inner door panel on the left. The driver camera sits a little toward the middle of the car so the panel covers less of the view.

Checklist

  • Conventional Commit title (feat(fp): ..., fix(sim): ...)
  • No secrets, API keys or raw prompts in code or logs
  • New gameplay behind a flag in data/feature_flags.json, or not needed (drive)
  • Docs updated (README, AGENTS.md, docs/) if behaviour or commands changed (ARCHITECTURE input actions and the driving row, README and PLAYING keys, API docs regenerated)
  • No new files over 5 MB, or explained here

F (gamepad Y) by a stopped or parked car takes it over: traffic swaps it
for a player-role car of the same model that the AI no longer steps, and
its resident's trip ends. An arcade bicycle model drives it (throttle,
brake and reverse, speed-scaled steering, grip by surface, handbrake
slide), with a sweep-checked chase camera, a driver view on V, a
speedometer and gear chip, and crashes that bounce off collision boxes.
The hero sits in the driver's seat.

AI cars and walkers yield to player cars as oriented boxes. F again gets
out beside the door when slow and there is room; a car left behind is
removed once it is out of range and out of sight. Behind the "drive"
feature flag, with fp_drive_test.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Automated review

No new findings on the 27 changed files (gdlint, complexity, TODO policy, dead code).

Run python3 tools/checks/run_all.py locally for the full set of checks.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@KunalSiyag
KunalSiyag merged commit a3484e2 into main Oct 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant