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
5 changes: 5 additions & 0 deletions docs/ART_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ in exports and displayed in Credits.
landing chevron and cyan planet rim use the HUD palette. Rebuild the committed 512px
PNG with `game/assets/branding/render_icon.sh` (requires `rsvg-convert`, from librsvg).
The application icon setting supplies native icons and the Web export's browser icon.

The title keeps its main play actions in a vertical stack, with secondary actions
in a compact two-column group. Heading size and spacing adapt to shorter windows;
the supported 1152×648 layout fits at 100% and 130% UI scale without a scrollbar.
Very short windows retain an emergency scrolling fallback so actions stay reachable.
7 changes: 7 additions & 0 deletions docs/CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ It must exit 0. CI runs the same script. Engine and GUT warnings/deprecations fa
## GDScript

- Follow the official GDScript style guide; `gdformat` decides layout.
- **Every enabled GDScript warning is an error.** Editor-only warning messages are not
reliably printed by headless runtime loading; the project settings and script-check
policy make fresh compilation enforce them in CI. Addons remain excluded.
- **Static types everywhere.** Untyped declarations and unsafe access/calls/casts are errors
(set in `project.godot`). Give every variable, parameter and return a type. To use a
`Variant` (e.g. a dictionary value), assign it to a typed local first:
Expand Down Expand Up @@ -81,3 +84,7 @@ does not imply that simulation code may call its visual children.
hand-tuned mix values. `project_integrity.py` checks hashes/inventory without regenerating audio.
Recipe edits also need the deterministic `audio_src/build.py --check` command documented in
`docs/AUDIO_PROVENANCE.md`; encoder versions can affect output hashes.

- During bulk script refactors, do not save editor resources while dependencies are
temporarily invalid. After fresh compilation is clean, reload stale editor state
from disk before live tests, and inspect resource diffs for unintended resaves.
14 changes: 14 additions & 0 deletions docs/adr/0002-lint-and-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,17 @@ overrides in this checkout. Verified through the running 4.7.2 editor: inference
level 2 and directory rules are `{ "res://addons": 0 }`, matching the intended policy.
The script/resource load check and actual project settings remain the executable authority. Engine and GUT diagnostic classification is now shared
by local checks and exports; GUT warnings and deprecated APIs also fail checks.

## Editor warnings must reach CI (2026-11-15 follow-up)

A live-editor check exposed shadowing warnings despite clean headless runtime logs.
Fresh startup with all currently enabled warning categories promoted from Warn (1)
to Error (2) reproduced them. Runtime log-prefix scanning alone cannot enforce these
editor diagnostics. All enabled categories now use Error, while disabled categories
and the engine's addon exclusion stay as configured. `check_scripts.gd` refuses any
category left at Warn, or a globally disabled warning system, so later engine
upgrades cannot silently weaken this policy.

Fix local shadowing names, unused locals and static-call syntax; express intentional
integer truncation explicitly. Keep interface signal annotations narrowly scoped
and justified by their external emitters. Do not hide warnings with file-wide ignores.
16 changes: 8 additions & 8 deletions game/ai/ai_sighting.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ var _ref: WeakRef = null


## Records a fresh look at `entity` on sim tick `now`.
func update(entity: Node3D, now: int) -> void:
key = entity.get_instance_id()
_ref = weakref(entity)
position = AttackCommand.position_of(entity)
strength = AiKnowledge.strength_of(entity)
armed = Combat.is_armed(entity)
func update(target_entity: Node3D, now: int) -> void:
key = target_entity.get_instance_id()
_ref = weakref(target_entity)
position = AttackCommand.position_of(target_entity)
strength = AiKnowledge.strength_of(target_entity)
armed = Combat.is_armed(target_entity)
last_seen_tick = now
var unit: Unit = entity as Unit
var unit: Unit = target_entity as Unit
if unit != null and unit.def != null:
def_id = unit.def.id
heavy = unit.def.armour() == DamageTable.ARMOUR_HEAVY
airborne = unit.def.flies
var building: Building = entity as Building
var building: Building = target_entity as Building
if building != null:
is_building = true
footprint = building.footprint()
Expand Down
10 changes: 6 additions & 4 deletions game/ai/behaviours/attack_group.gd
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ func from_dict(data: Dictionary) -> void:
## The enemy to fire on: armed units first, then armed buildings, then anything, the
## nearest to the group's centre within each class. With `members`, enemies none of
## them can hit (flyers, for guns that do not hit air) come last.
static func pick_focus(enemies: Array[Node3D], from: Vector3, members: Array[Unit] = []) -> Node3D:
static func pick_focus(
enemies: Array[Node3D], from: Vector3, group_members: Array[Unit] = []
) -> Node3D:
var best: Node3D = null
var best_score: float = INF
for enemy: Node3D in enemies:
var rank: float = 0.0
if not members.is_empty() and AiGroup.able_to_hit(members, enemy).is_empty():
if not group_members.is_empty() and AiGroup.able_to_hit(group_members, enemy).is_empty():
rank = 3000.0
elif not Combat.is_armed(enemy):
rank = 2000.0
Expand All @@ -158,8 +160,8 @@ class GroupState:

var _group: WeakRef

func _init(group: WeakRef) -> void:
_group = group
func _init(group_ref: WeakRef) -> void:
_group = group_ref

func group() -> AttackGroup:
var value: Variant = _group.get_ref()
Expand Down
2 changes: 1 addition & 1 deletion game/ai/behaviours/patrol_behaviour.gd
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class InvestigateState:
if b.arrived_at(b.investigate_point) or now - _started > LEG_TIMEOUT:
_arrived_at = now
return &""
var looked: int = (now - _arrived_at) / 20
var looked: int = int((now - _arrived_at) / 20.0)
if looked > _turns:
_turns = looked
var around: Vector3 = Vector3.FORWARD.rotated(Vector3.UP, _turns * PI * 0.66)
Expand Down
4 changes: 2 additions & 2 deletions game/ai/behaviours/retrieve_group.gd
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class GroupState:

var _group: WeakRef

func _init(group: WeakRef) -> void:
_group = group
func _init(group_ref: WeakRef) -> void:
_group = group_ref

func group() -> RetrieveGroup:
var value: Variant = _group.get_ref()
Expand Down
11 changes: 7 additions & 4 deletions game/audio/audio_service.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
## ShutdownGuard stops all descendant players before they leave the tree.
extends Node

## Resolve the autoload's playback dependency directly, including during editor indexing.
const PlaybackPool: GDScript = preload("res://audio/one_shot_playback.gd")

const EVENTS_DIR: String = "res://data/sounds"
const DEFAULT_SCORE: String = "res://data/sounds/music/kessel_reach.tres"
const SHIP_SCORE: String = "res://data/sounds/music/meridian.tres"
## Leaving the ship, the planet's score comes in at the briefing bed's level
## and waits there for the briefing (or the mission) to set it.
const LANDING_DIP_DB: float = MissionSoundRouter.BRIEFING_DUCK_DB
const FLAT_VOICES: int = OneShotPlayback.FLAT_VOICES
const POSITIONAL_VOICES: int = OneShotPlayback.POSITIONAL_VOICES
const FLAT_VOICES: int = PlaybackPool.FLAT_VOICES
const POSITIONAL_VOICES: int = PlaybackPool.POSITIONAL_VOICES
## Zoom changes smaller than this do not touch the bus volumes.
const ZOOM_EPSILON: float = 0.01
## The music layer that surfaces as discovery sites are resolved.
Expand All @@ -36,7 +39,7 @@ const RIVAL_INTEL_TYPE: StringName = &"rival_intel"
const STING_DIP_DB: float = -6.0

var _events: Dictionary[StringName, SoundEvent] = {}
var _one_shots: OneShotPlayback
var _one_shots: PlaybackPool
var _listener: AudioListener3D
var _listener_active: bool = false
var _zoom: float = 0.5
Expand Down Expand Up @@ -83,7 +86,7 @@ var _shade: float = 0.0
func _ready() -> void:
process_mode = Node.PROCESS_MODE_ALWAYS
_register_events(EVENTS_DIR)
_one_shots = OneShotPlayback.new()
_one_shots = PlaybackPool.new()
_one_shots.name = &"OneShots"
add_child(_one_shots)
_listener = AudioListener3D.new()
Expand Down
16 changes: 8 additions & 8 deletions game/audio/base_loops.gd
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ func _apply_choice() -> void:
_assign(_chosen_owners[k], _chosen_ids[k])


func _slot_of(owner: Node3D, loop_id: StringName) -> int:
func _slot_of(loop_owner: Node3D, loop_id: StringName) -> int:
for i: int in _players.size():
if is_instance_valid(_owners[i]) and _owners[i] == owner and _loop_ids[i] == loop_id:
if is_instance_valid(_owners[i]) and _owners[i] == loop_owner and _loop_ids[i] == loop_id:
return i
return -1


func _assign(owner: Node3D, loop_id: StringName) -> void:
func _assign(loop_owner: Node3D, loop_id: StringName) -> void:
var event: SoundEvent = resolve_event.call(loop_id)
if event == null or event.streams.is_empty():
return
Expand All @@ -298,10 +298,10 @@ func _assign(owner: Node3D, loop_id: StringName) -> void:
player.bus = event.bus
player.max_distance = event.max_distance
player.volume_db = AudioMix.SILENT_DB
player.global_position = owner.global_position
player.global_position = loop_owner.global_position
# Random start point so identical loops never phase-lock.
player.play(_rng.randf() * maxf(stream.get_length() - 0.05, 0.0))
_owners[slot] = owner
_owners[slot] = loop_owner
_loop_ids[slot] = loop_id
_wanted[slot] = true
_levels[slot] = 0.0
Expand All @@ -313,7 +313,7 @@ func _update_player(i: int, delta: float) -> void:
if not alive:
_owners[i] = null
_wanted[i] = false
var owner: Node3D = _owners[i]
var loop_owner: Node3D = _owners[i]
_levels[i] = move_toward(_levels[i], 1.0 if _wanted[i] else 0.0, delta / FADE_SECONDS)
if _levels[i] <= 0.0:
if player.playing:
Expand All @@ -329,10 +329,10 @@ func _update_player(i: int, delta: float) -> void:
_low_power
and (is_hum(_loop_ids[i]) or _loop_ids[i] == PRODUCE)
and alive
and AudioEventRouter.faction_of(owner) == player_faction
and AudioEventRouter.faction_of(loop_owner) == player_faction
)
if alive:
player.global_position = owner.global_position
player.global_position = loop_owner.global_position
player.volume_db = (
base_db + (LOW_POWER_DB if dims else 0.0) + AudioMix.linear_to_db_safe(_levels[i])
)
Expand Down
2 changes: 1 addition & 1 deletion game/audio/campaign_sound_router.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var play_at: Callable = func(_id: StringName, _at: Vector3, _db: float) -> bool:
## Offers an Advisor alert kind: `func(kind: StringName) -> void`.
var offer_alert: Callable = func(_kind: StringName) -> void: pass
## Shows a campaign screen, or &"" for a landing: `func(screen: StringName) -> void`.
var show_screen: Callable = func(_screen: StringName) -> void: pass
var show_screen: Callable = func(_requested_screen: StringName) -> void: pass
## The launch was confirmed: `func() -> void`.
var launch: Callable = func() -> void: pass

Expand Down
6 changes: 3 additions & 3 deletions game/audio/eruption_cues.gd
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ static func level_db(seconds_left: float) -> float:
## arrival fade) and visibility. AudioMix.SILENT_DB when silent.
static func layer_db(layer: StringName, seconds_left: float, presence: float, seen: bool) -> float:
var p: float = progress(seconds_left)
var weight: float = cos(p * PI * 0.5) if layer == BUILD_LOW else sin(p * PI * 0.5)
if weight <= 0.0001 or presence <= 0.0:
var layer_weight: float = cos(p * PI * 0.5) if layer == BUILD_LOW else sin(p * PI * 0.5)
if layer_weight <= 0.0001 or presence <= 0.0:
return AudioMix.SILENT_DB
var db: float = AudioMix.linear_to_db_safe(weight) + level_db(seconds_left)
var db: float = AudioMix.linear_to_db_safe(layer_weight) + level_db(seconds_left)
db += AudioMix.linear_to_db_safe(presence) + (0.0 if seen else UNSEEN_DB)
return maxf(db, AudioMix.SILENT_DB)

Expand Down
10 changes: 5 additions & 5 deletions game/audio/holdout_sound.gd
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ func handle_sim_ticked(tick: int) -> StringName:
if _arrived:
return &""
_left = seconds_left(tick)
var stage: int = HoldoutCues.stage_for(_left)
var next_stage: int = HoldoutCues.stage_for(_left)
var cue: StringName = &""
if stage > _stage:
if stage == 2:
if next_stage > _stage:
if next_stage == 2:
cue = _play(HoldoutCues.MINUTE_CUE)
elif stage == 3:
elif next_stage == 3:
cue = HoldoutCues.ENGINE if _start_engine() else &""
_stage = stage
_stage = next_stage
if _stage >= 3:
_engine_db = HoldoutCues.engine_db(_left)
_engine.pitch_scale = HoldoutCues.engine_pitch(_left)
Expand Down
4 changes: 2 additions & 2 deletions game/audio/storm_sound.gd
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ func handle_storm_incoming(_seconds: float) -> StringName:
return _play(StormCues.FRONT_RUMBLE)


func handle_storm_changed(intensity: float) -> void:
cues.report(intensity)
func handle_storm_changed(storm_intensity: float) -> void:
cues.report(storm_intensity)


func handle_mission_started() -> void:
Expand Down
4 changes: 2 additions & 2 deletions game/audio/tide_sound.gd
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func handle_tide_turning(_seconds: float, rising: bool) -> StringName:
return started


func handle_tide_changed(level: float) -> void:
cues.report(level)
func handle_tide_changed(tide_level: float) -> void:
cues.report(tide_level)


func handle_mission_started() -> void:
Expand Down
20 changes: 10 additions & 10 deletions game/missions/mission.gd
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,19 @@ func enemy_factions() -> Array[int]:

## Creates and starts the objective `objective_def` describes.
func add_objective_def(objective_def: ObjectiveDef) -> Objective:
var objective: Objective = ObjectiveFactory.create(objective_def)
if objective != null:
add_objective(objective)
return objective
var new_objective: Objective = ObjectiveFactory.create(objective_def)
if new_objective != null:
add_objective(new_objective)
return new_objective


## Starts `objective` and announces it (unless hidden).
func add_objective(objective: Objective) -> void:
objectives.append(objective)
objective.start(self)
if objective.is_known:
Events.objective_added.emit(objective)
objective.evaluate()
func add_objective(new_objective: Objective) -> void:
objectives.append(new_objective)
new_objective.start(self)
if new_objective.is_known:
Events.objective_added.emit(new_objective)
new_objective.evaluate()


## The objective with `objective_id`, or null.
Expand Down
6 changes: 3 additions & 3 deletions game/missions/objective.gd
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ func factions_of(side: StringName) -> Array[int]:
static func ids_of(entities: Array) -> Array[int]:
var ids: Array[int] = []
for entity: Variant in entities:
var id: int = Order.entity_id_of(entity)
if id >= 0:
ids.append(id)
var entity_id: int = Order.entity_id_of(entity)
if entity_id >= 0:
ids.append(entity_id)
return ids


Expand Down
4 changes: 2 additions & 2 deletions game/missions/objectives/keep_alive.gd
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func from_dict(data: Dictionary) -> void:
guarded.clear()
var ids: Array = data.get("guarded", [])
for entry: Variant in ids:
var id: int = entry
var found: Node3D = mission.world.entity(id) if mission != null else null
var entity_id: int = entry
var found: Node3D = mission.world.entity(entity_id) if mission != null else null
if found != null:
guarded.append(found)
var count: int = data.get("guarded_count", guarded.size())
Expand Down
4 changes: 2 additions & 2 deletions game/missions/objectives/keep_from_enemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func _evaluate() -> void:
func to_dict() -> Dictionary:
var data: Dictionary = super()
var holders: Dictionary = {}
for id: int in _last_holder:
holders[str(id)] = _last_holder[id]
for entity_id: int in _last_holder:
holders[str(entity_id)] = _last_holder[entity_id]
data["holders"] = holders
return data

Expand Down
6 changes: 4 additions & 2 deletions game/missions/objectives/sabotage_target.gd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func from_dict(data: Dictionary) -> void:
targets.clear()
var ids: Array = data.get("targets", [])
for entry: Variant in ids:
var id: int = entry
var found: Building = mission.world.entity(id) as Building if mission != null else null
var entity_id: int = entry
var found: Building = (
mission.world.entity(entity_id) as Building if mission != null else null
)
if found != null:
targets.append(found)
8 changes: 5 additions & 3 deletions game/presentation/order_marker.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ const ATTACK_SCALE := 1.6
var _age: float = 0.0


static func spawn(parent: Node, at: Vector3, color: Color, scale: float = 1.0) -> OrderMarker:
static func spawn(
parent: Node, at: Vector3, color: Color, marker_scale: float = 1.0
) -> OrderMarker:
var marker := OrderMarker.new()
var quad := PlaneMesh.new()
quad.size = Vector2.ONE * SIZE * scale
quad.size = Vector2.ONE * SIZE * marker_scale
var material := ShaderMaterial.new()
material.shader = SHADER
marker.mesh = quad
Expand All @@ -25,7 +27,7 @@ static func spawn(parent: Node, at: Vector3, color: Color, scale: float = 1.0) -
parent.add_child(marker)
marker.global_position = at + Vector3.UP * 0.1
ShaderParameters.set_value(marker, &"marker_color", color)
ShaderParameters.set_value(marker, &"attack", scale > 1.0)
ShaderParameters.set_value(marker, &"attack", marker_scale > 1.0)
return marker


Expand Down
Loading
Loading