Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Founding builds made before anyone lives in the city, and runs with residents of

`godot --path .` starts in **first person** at street level. Set `GRIDFALL_VIEW=orbit` to play the orbit city builder with the full HUD described below.

- **First person:** WASD or the arrow keys walk, Shift runs, mouse to look (click to capture the pointer), `]` and `[` change time speed (1x, 2x, 4x, 8x), `T` skips to the next morning, `Esc` pauses, `F1` hides the HUD, `F5` saves, `F9` loads. `F` by a car gets in (W/S throttle and brake or reverse, A/D steer, Space handbrake, V switches chase and driver view) and `F` again gets out once it slows down.
- **First person:** WASD or the arrow keys walk, Shift runs, mouse to look (click to capture the pointer), `]` and `[` change time speed (1x, 2x, 4x, 8x), `T` skips to the next morning, `Esc` pauses, `F1` hides the HUD, `F5` saves, `F9` loads. `F` by a car gets in (W/S throttle and brake or reverse, A/D steer, Space handbrake, V switches chase and driver view) and `F` again gets out once it slows down. `B` opens the build phone: `1`-`6` pick road, homes, shops, industry, a building (mouse wheel picks which) or bulldoze, left click places on the tile ahead (roads and zones take a start and an end click), right click undoes the start. Each order is paid by the district that owns the land, as if its mayor had ordered it.

The orbit view (`GRIDFALL_VIEW=orbit`):

Expand Down
1 change: 1 addition & 0 deletions data/feature_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"audio": {"default": true, "description": "First-person feature: street sound: buses, positional emitters and ambience (slice I)."},
"overview": {"default": true, "description": "First-person feature: Tab city overview to watch construction sites."},
"drive": {"default": true, "description": "First-person feature: get into parked or stopped cars with F and drive them."},
"phone": {"default": true, "description": "First-person feature: B opens the phone Build app, which places roads, zones and buildings for the mayor who owns the land."},
"gmi_live": {"default": true, "description": "Kill switch for live GMI Cloud calls. Off: every call uses the replay cache or heuristics, as with GRIDFALL_OFFLINE=1."},
"analytics": {"default": false, "description": "Local product analytics to user://ops/analytics.jsonl (also GRIDFALL_ANALYTICS=1). Nothing is sent anywhere."},
"error_tracking": {"default": false, "description": "Write contextual error records to user://ops/errors.jsonl (also GRIDFALL_ERROR_LOG=1). In-memory error counters are always on."},
Expand Down
7 changes: 7 additions & 0 deletions docs/api/index.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 115 additions & 0 deletions docs/api/scripts.fp.phone.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/fp/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Camera ownership: A owns every camera behaviour (follow, collision, V toggle, th
- `city_sim.gd`: `var day_seconds: float = SimDefs.BASE_DAY_SECONDS`, read wherever `BASE_DAY_SECONDS` is used today.
- `city_brain.gd` and `sim_defs.gd`: `MAYORS[i]["display"]` (human name). The display name replaces the model name in prompts, `city_log`, `owner_name()` and inspector text. `model` stays for the API. The offline Gazette editorial and the inspector prompt stop saying "AI mayors".
- S0's own FP files also carry shared contracts that slices build on: `GameBus.card_action`, `CityDirectory.planned_name`, `CollisionWorld.boxes()`, `AP.load_scene()` and the GLB node-name prefixes, `FpPlayer.photo_mode`, and the `fp_kit` test context. S0 §23 (D-S0-17 to D-S0-22) lists them.
- `project.godot`: FP input actions (`move_forward`, `move_back`, `move_left`, `move_right`, `sprint`, `crouch`, `jump`, `interact`, `chat_open`, `map_toggle`, `pause_menu`, `time_faster`, `time_slower`, `time_skip`, `photo_mode`, `hud_toggle`, `quick_save`, `quick_load`) and, for D13, the camera actions `view_toggle` (V), `shoulder_swap` (Q), `zoom_in` / `zoom_out` (mouse wheel up / down) and `look_left` / `look_right` / `look_up` / `look_down` (gamepad right stick, dead zone 0.15). The existing `camera_*` actions stay. The integration overview adds `overview_toggle` (Tab, gamepad Back), `site_next` (N), `site_prev` (B), `site_go` (F) and `site_waypoint` (G). Driving adds `vehicle_enter` (F, gamepad Y; on foot it only takes the press with a car in reach, so Y still opens the map elsewhere), `drive_throttle` (right trigger) and `drive_brake` (left trigger); on the keyboard the move keys drive.
- `project.godot`: FP input actions (`move_forward`, `move_back`, `move_left`, `move_right`, `sprint`, `crouch`, `jump`, `interact`, `chat_open`, `map_toggle`, `pause_menu`, `time_faster`, `time_slower`, `time_skip`, `photo_mode`, `hud_toggle`, `quick_save`, `quick_load`) and, for D13, the camera actions `view_toggle` (V), `shoulder_swap` (Q), `zoom_in` / `zoom_out` (mouse wheel up / down) and `look_left` / `look_right` / `look_up` / `look_down` (gamepad right stick, dead zone 0.15). The existing `camera_*` actions stay. The integration overview adds `overview_toggle` (Tab, gamepad Back), `site_next` (N), `site_prev` (B), `site_go` (F) and `site_waypoint` (G). Driving adds `vehicle_enter` (F, gamepad Y; on foot it only takes the press with a car in reach, so Y still opens the map elsewhere), `drive_throttle` (right trigger) and `drive_brake` (left trigger); on the keyboard the move keys drive. The phone adds `phone_toggle` (B); while it is open it reads 1-6, the mouse buttons and the wheel itself.
- `FpMode.DEFAULT_SETTINGS` (D13): `camera_mode: "third"`, `tps_fov: 60.0`, `tps_distance_m: 3.2`, `shoulder: 1` (right; -1 left), `auto_shoulder: false`, `hero: "m"` (or `"f"`). `"fov"` stays the first-person FOV. `apply_settings(patch, persist := true)`: `persist = false` changes the settings for this run without writing `user://gridfall_fp_settings.json` (the photo tour and `fp_bench` use it).

## 5. Slices (built in parallel after S0)
Expand All @@ -117,6 +117,7 @@ Camera ownership: A owns every camera behaviour (follow, collision, V toggle, th
| **I Audio** | `scripts/fp/audio/**`, `sounds/fp/**`, `scripts/audio_director.gd` | 3D positional engines, horns and sirens, footsteps by surface (in step with the hero's stride when the avatar animates), area ambience (traffic hum, park birds, river, construction), and a UI chat blip. Assets synthesized procedurally or with the existing ACE-Step tool. |
| **Integration: city overview** | `scripts/fp/overview/**`, `tools/tests/fp_overview_test.gd` | Tab on foot: an aerial camera over the city (through `FpPlayer.set_view_override`, so `player.camera` stays the one camera) with a marker per open construction site and a site list. N / B pick sites, F walks the hero to a vantage point by the site, G sets a waypoint, Tab or Esc return. "Planner view" leaves for orbit; Tab in orbit comes back to where the hero stood (`Main._fp_saved`). |
| **Integration: driving** | `scripts/fp/drive/**`, `tools/tests/fp_drive_test.gd` | F by a car takes it over (its resident's trip ends; traffic hands over a `player`-role car of the same model that the AI no longer steps). An arcade bicycle model (`drive_model.gd`: throttle, brake, reverse, speed-scaled steering, grip by surface, handbrake slide) moves it through `TrafficFeature.drive_car`; the hero sits in the driver's seat. Chase camera (sweep-checked) or driver view on V, a speedometer and gear chip, crashes bounce off `CollisionWorld` boxes. AI cars and walkers yield to player cars as oriented boxes. F again gets out on the driver's side when slow (under 8.5 m/s) and there is room; a left car is removed once out of range and out of sight. |
| **Integration: phone** | `scripts/fp/phone/**`, `tools/tests/fp_phone_test.gd` | B opens a phone with a Build app: road, homes, shops, industry, a building from the service list, and bulldoze, on the tile ahead of the hero (the camera's pitch sets the distance, 0.6 to 6 tiles). Each order goes through `CitySim.apply_action` for the mayor who owns that tile, so it is paid from that district's treasury and follows the mayors' rules and construction sites; unclaimed land is refused. `build_rules.gd` mirrors the sim's checks for the preview: a cyan or amber ghost over the tiles, the owner, the price and why not. Roads and zones take two clicks (start or corner, then end). Put away while driving or under a menu. |

## 6. Rules for every slice

Expand Down
5 changes: 5 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ drive_brake={
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null)
]
}
phone_toggle={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":66,"key_label":0,"unicode":98,"location":0,"echo":false,"script":null)
]
}

[rendering]

Expand Down
1 change: 1 addition & 0 deletions scripts/fp/fp_features.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ const FEATURES := [
{"id": "audio", "slice": "I", "path": "res://scripts/fp/audio/audio_feature.gd"},
{"id": "overview", "slice": "integration", "path": "res://scripts/fp/overview/overview_feature.gd"},
{"id": "drive", "slice": "integration", "path": "res://scripts/fp/drive/drive_feature.gd"},
{"id": "phone", "slice": "integration", "path": "res://scripts/fp/phone/phone_feature.gd"},
]
93 changes: 93 additions & 0 deletions scripts/fp/phone/build_ghost.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
extends Node3D
## The Build app's marker in the world: on every tile the order would touch, a glowing floor slab
## and a faint column that reads from down the street, cyan when it can be placed and amber when
## not, and a ring on the first corner of a road or zone.

const D := preload("res://scripts/sim/sim_defs.gd")
const WS := preload("res://scripts/fp/world_scale.gd")
const OK_COLOR := Color(0.0, 0.88, 1.0)
const BAD_COLOR := Color(1.0, 0.71, 0.28)
const FLOOR_ALPHA := 0.45
const COLUMN_ALPHA := 0.16
const LIFT := 0.4 * WS.M
const COLUMN_H := 4.0 * WS.M
const MAX_TILES := 64

var _floor: MultiMeshInstance3D
var _column: MultiMeshInstance3D
var _floor_mat: StandardMaterial3D
var _column_mat: StandardMaterial3D
var _anchor: MeshInstance3D
var count: int = 0


func setup() -> void:
name = "BuildGhost"
_floor_mat = _material()
_column_mat = _material()
_floor = _layer(Vector3(0.94, 0.3 * WS.M, 0.94), _floor_mat)
_column = _layer(Vector3(0.9, COLUMN_H, 0.9), _column_mat)
var ring := TorusMesh.new()
ring.inner_radius = 0.36
ring.outer_radius = 0.44
ring.material = _material()
(ring.material as StandardMaterial3D).albedo_color = Color(1, 1, 1, 0.9)
_anchor = MeshInstance3D.new()
_anchor.mesh = ring
_anchor.scale = Vector3(1.0, 0.25, 1.0)
_anchor.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
_anchor.visible = false
add_child(_anchor)
visible = false


func _material() -> StandardMaterial3D:
var m := StandardMaterial3D.new()
m.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
m.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
m.cull_mode = BaseMaterial3D.CULL_DISABLED
return m


func _layer(size: Vector3, mat: StandardMaterial3D) -> MultiMeshInstance3D:
var box := BoxMesh.new()
box.size = size
box.material = mat
var mm := MultiMesh.new()
mm.transform_format = MultiMesh.TRANSFORM_3D
mm.mesh = box
mm.instance_count = MAX_TILES
mm.visible_instance_count = 0
var mi := MultiMeshInstance3D.new()
mi.multimesh = mm
mi.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
add_child(mi)
return mi


## Marks tiles (Array of Vector2i); anchor is the first corner or D.NO_TILE.
func show_tiles(tiles: Array, ok: bool, anchor: Vector2i) -> void:
visible = true
var c := OK_COLOR if ok else BAD_COLOR
_floor_mat.albedo_color = Color(c, FLOOR_ALPHA)
_column_mat.albedo_color = Color(c, COLUMN_ALPHA)
count = mini(tiles.size(), MAX_TILES)
for k in range(count):
var t: Vector2i = tiles[k]
_floor.multimesh.set_instance_transform(k, Transform3D(Basis(), Vector3(t.x, LIFT, t.y)))
_column.multimesh.set_instance_transform(
k, Transform3D(Basis(), Vector3(t.x, LIFT + COLUMN_H * 0.5, t.y))
)
_floor.multimesh.visible_instance_count = count
_column.multimesh.visible_instance_count = count
_anchor.visible = anchor != D.NO_TILE
if _anchor.visible:
_anchor.position = Vector3(anchor.x, LIFT * 2.0, anchor.y)


func clear() -> void:
visible = false
count = 0
_floor.multimesh.visible_instance_count = 0
_column.multimesh.visible_instance_count = 0
_anchor.visible = false
1 change: 1 addition & 0 deletions scripts/fp/phone/build_ghost.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://7uenhlcskon6
Loading