From 00b171103cb01027a11af323ce172827c8db2bf3 Mon Sep 17 00:00:00 2001 From: Douwe de Vries Date: Sun, 15 Nov 2026 10:38:11 +0100 Subject: [PATCH 1/2] Keep visible building lanes open and credit the MIT licence --- docs/adr/0006-buildings-on-the-navmesh.md | 4 + docs/adr/0022-traffic.md | 12 +++ game/LICENSE.txt | 21 +++++ game/export_presets.cfg | 10 +-- .../navigation/navmesh_path_service.gd | 11 +-- game/tests/maps/test_hollow_map.gd | 3 +- game/tests/test_building_gaps.gd | 84 +++++++++++++++++++ game/tests/test_building_gaps.gd.uid | 1 + game/tests/ui/test_phase9_screens.gd | 5 ++ game/ui/info_panel.gd | 3 + 10 files changed, 143 insertions(+), 11 deletions(-) create mode 100644 game/LICENSE.txt create mode 100644 game/tests/test_building_gaps.gd create mode 100644 game/tests/test_building_gaps.gd.uid diff --git a/docs/adr/0006-buildings-on-the-navmesh.md b/docs/adr/0006-buildings-on-the-navmesh.md index 5456235e..6c7ad21a 100644 --- a/docs/adr/0006-buildings-on-the-navmesh.md +++ b/docs/adr/0006-buildings-on-the-navmesh.md @@ -99,3 +99,7 @@ along the cut edges of the Muster Bay and the Lander, and walked round both. - Navigation map changes take effect on the next physics frame; a path requested in the same frame as a placement can still cross the new site. Units standing inside a new footprint are sent out of it when it is placed. + +The dynamic-obstacle margin above is superseded by the building-lane decision +in [ADR 0022](0022-traffic.md): 0.35 m around footprints, independent of the +terrain bake radius, so small units retain visible passages. diff --git a/docs/adr/0022-traffic.md b/docs/adr/0022-traffic.md index c67c73ab..b903bb2c 100644 --- a/docs/adr/0022-traffic.md +++ b/docs/adr/0022-traffic.md @@ -62,6 +62,18 @@ obstacles are removed. grid is not made; the unit then follows its path alone for half a second. 7. Flying units stay out (the `FlightSystem` keeps them apart, ADR 0016). +Building and deposit cuts use a 0.35 m seam allowance, independent of Traffic +passing room and the terrain bake's 1.75 m agent radius. The former 2.25 m +dynamic-obstacle margin closed visible lanes: two buildings 2.4 m apart could +stop a 1.6 m wide Ranger. The smaller allowance keeps that lane usable, while +footprints, cliffs and flooded ground remain blocked. This deliberately favours +responsive movement over enforcing the widest vehicle's physical clearance +around every building. Terrain navmeshes are unchanged. + +`tests/test_building_gaps.gd` reproduces the closed lane on the former margin, +then verifies a real Ranger definition crosses it with Traffic enabled and +demolition restores walkability without reopening the remaining footprints. + Formations already hand out slots so that paths do not cross (`Formation.assign`), so that part needed no change. Groups retain each unit's own speed: faster units queue behind or pass slower ones. Nearby path corners are skipped when the next leg is directly walkable; diff --git a/game/LICENSE.txt b/game/LICENSE.txt new file mode 100644 index 00000000..e395bff6 --- /dev/null +++ b/game/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 ddv1982 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/game/export_presets.cfg b/game/export_presets.cfg index 0e38649e..2048711f 100644 --- a/game/export_presets.cfg +++ b/game/export_presets.cfg @@ -7,7 +7,7 @@ advanced_options=false dedicated_server=false custom_features="" export_filter="all_resources" -include_filter="assets/fonts/OFL.txt" +include_filter="assets/fonts/OFL.txt, LICENSE.txt" exclude_filter="tests/*, addons/gut/*, presentation/showcase/*" export_path="../build/macos/Farlanding.zip" patches=PackedStringArray() @@ -64,7 +64,7 @@ advanced_options=false dedicated_server=false custom_features="" export_filter="all_resources" -include_filter="assets/fonts/OFL.txt" +include_filter="assets/fonts/OFL.txt, LICENSE.txt" exclude_filter="tests/*, addons/gut/*, presentation/showcase/*" export_path="../build/windows/Farlanding.exe" patches=PackedStringArray() @@ -113,7 +113,7 @@ advanced_options=false dedicated_server=false custom_features="" export_filter="all_resources" -include_filter="assets/fonts/OFL.txt" +include_filter="assets/fonts/OFL.txt, LICENSE.txt" exclude_filter="tests/*, addons/gut/*, presentation/showcase/*" export_path="../build/linux/Farlanding.x86_64" patches=PackedStringArray() @@ -142,7 +142,7 @@ runnable=true advanced_options=true custom_features="" export_filter="all_resources" -include_filter="assets/fonts/OFL.txt" +include_filter="assets/fonts/OFL.txt, LICENSE.txt" exclude_filter="tests/*, addons/gut/*, presentation/showcase/*" export_path="../build/web/index.html" script_export_mode=2 @@ -167,7 +167,7 @@ runnable=true advanced_options=true custom_features="web_diagnostics" export_filter="all_resources" -include_filter="addons/gut/double_templates/*.txt, assets/fonts/OFL.txt" +include_filter="addons/gut/double_templates/*.txt, assets/fonts/OFL.txt, LICENSE.txt" exclude_filter="tests/test_*, tests/check_scripts.gd, addons/gut/gut_loader_the_scene.tscn, tests/maps/*, tests/smoke/*, tests/ui/*, tests/economy/*, tests/planet/*, tests/combat/*, tests/missions/*, tests/props/*, tests/discovery/*, tests/balance/*, tests/ai/*, tests/campaign/*, tests/stealth/*, tests/save/*, presentation/showcase/*" export_path="../build/web-diagnostics/index.html" script_export_mode=2 diff --git a/game/sim/systems/navigation/navmesh_path_service.gd b/game/sim/systems/navigation/navmesh_path_service.gd index 763fc136..2ef830dc 100644 --- a/game/sim/systems/navigation/navmesh_path_service.gd +++ b/game/sim/systems/navigation/navmesh_path_service.gd @@ -4,8 +4,8 @@ extends PathService ## Units pass each other through Traffic (ADR 0022), not on the navigation server. ## ## Blocked areas (buildings, deposits) are cut out of the region's navmesh with a -## NavmeshCutter, grown by CUT_MARGIN so unit centres keep clear of walls like they -## do of cliffs; the walk grid loses the same cells (ADR 0006). +## NavmeshCutter with only a small seam margin; the walk grid loses the same cells +## (ADR 0006). Traffic passing room is advisory, never extra building clearance. ## ## On a tidal map (ADR 0014) the region holds one of several navmeshes baked for a few ## sea levels (`set_flood_stages()`): `set_water()` switches to the stage of the sea @@ -26,9 +26,10 @@ const LANE_MAX: float = 9.0 const LANE_SHARES: Array[float] = [1.0, 0.5, 0.0] ## How many leading corridor corners a unit may skip when joining. const JOIN_LOOKAHEAD: int = 4 -## Blocked areas are cut out of the navmesh grown by this much (metres): the baked -## agent radius plus room for the widest unit to pass another. -const CUT_MARGIN: float = NavmeshTools.AGENT_RADIUS + 0.5 +## Small seam allowance around dynamic obstacle footprints, metres. Do not use the +## largest unit radius here: that closes visible lanes even for small infantry. +## Terrain/cliff erosion stays in the baked mesh; Traffic handles body spacing. +const CUT_MARGIN: float = 0.35 ## Benchmark and debug counters: shared group corridors built, and group members ## that could not use the corridor and got their own query. diff --git a/game/tests/maps/test_hollow_map.gd b/game/tests/maps/test_hollow_map.gd index 5e12058b..5792a76a 100644 --- a/game/tests/maps/test_hollow_map.gd +++ b/game/tests/maps/test_hollow_map.gd @@ -208,7 +208,8 @@ static func _path_length(paths: PathService, from: Vector3, to: Vector3) -> floa var path: PackedVector3Array = paths.find_path( paths.closest_point(from), paths.closest_point(to) ) - var length: float = 0.0 + # find_path omits the snapped start; include its leg to the first corner. + var length: float = _flat(paths.closest_point(from), path[0]) if not path.is_empty() else 0.0 for i: int in range(1, path.size()): length += _flat(path[i - 1], path[i]) return length if not path.is_empty() else INF diff --git a/game/tests/test_building_gaps.gd b/game/tests/test_building_gaps.gd new file mode 100644 index 00000000..bc3e2aaa --- /dev/null +++ b/game/tests/test_building_gaps.gd @@ -0,0 +1,84 @@ +extends GutTest +## Visible building lanes remain usable with Traffic enabled. Obstacle footprints +## still block paths; optional passing room must not become an invisible wall. + +var _map: RID +var _region: NavigationRegion3D +var _paths: NavmeshPathService + + +func before_each() -> void: + _map = NavigationServer3D.map_create() + NavigationServer3D.map_set_active(_map, true) + _region = NavigationRegion3D.new() + var mesh := NavigationMesh.new() + ( + mesh + . set_vertices( + PackedVector3Array( + [ + Vector3(-20, 0, -20), + Vector3(-20, 0, 20), + Vector3(20, 0, 20), + Vector3(20, 0, -20), + ] + ) + ) + ) + mesh.add_polygon(PackedInt32Array([0, 1, 2, 3])) + _region.navigation_mesh = mesh + add_child_autofree(_region) + _region.set_navigation_map(_map) + var grid: WalkGrid = WalkGrid.from_navmesh(mesh, Rect2(-20, -20, 40, 40), 0.5) + _paths = NavmeshPathService.new(_map, grid, _region) + # Two building rows, separated by a 2.4 m lane. A Ranger is 1.6 m wide. + _paths.block_area(Rect2(-20, -4, 18.8, 8)) + _paths.block_area(Rect2(1.2, -4, 18.8, 8)) + _paths.apply_cuts() + await wait_physics_frames(2) + NavigationServer3D.map_force_update(_map) + + +func after_each() -> void: + _paths.release() + _region.set_navigation_map(RID()) + NavigationServer3D.free_rid(_map) + + +func test_ranger_walks_through_visible_building_gap_with_traffic() -> void: + var start := Vector3(0, 0, 12) + var goal := Vector3(0, 0, -12) + assert_true(_paths.is_segment_walkable(start, goal), "the visible lane stays open") + var path: PackedVector3Array = _paths.find_path(start, goal) + assert_false(path.is_empty()) + if not path.is_empty(): + assert_lt(path[path.size() - 1].distance_to(goal), 0.1, "navmesh reaches the far side") + var ranger: Unit = Unit.new() + ranger.def = load("res://data/units/concord_ranger.tres") + ranger.add_child(Locomotion.new()) + ranger.add_child(UnitOrders.new()) + add_child_autofree(ranger) + var traffic := Traffic.new() + ranger.locomotion.setup(ranger.def, start, 0.0, _paths, null, traffic, 0) + ranger.locomotion.move_to(goal) + var entered_building: bool = false + for i: int in 100: + traffic.solve() + ranger.sim_tick(0.1) + entered_building = entered_building or _paths.is_blocked(ranger.sim_position()) + assert_lt(ranger.sim_position().distance_to(goal), 0.5, "Ranger passes with traffic on") + assert_false(entered_building, "the actual buildings remain solid") + + +func test_footprints_still_block_and_demolition_restores_the_lane() -> void: + var bridge: int = _paths.block_area(Rect2(-1.2, -4, 2.4, 8)) + _paths.apply_cuts() + await wait_physics_frames(2) + NavigationServer3D.map_force_update(_map) + assert_false(_paths.is_walkable(Vector3.ZERO), "closed building footprint") + _paths.unblock_area(bridge) + _paths.apply_cuts() + await wait_physics_frames(2) + NavigationServer3D.map_force_update(_map) + assert_true(_paths.is_segment_walkable(Vector3(0, 0, 12), Vector3(0, 0, -12))) + assert_false(_paths.is_walkable(Vector3(5, 0, 0)), "remaining building stays closed") diff --git a/game/tests/test_building_gaps.gd.uid b/game/tests/test_building_gaps.gd.uid new file mode 100644 index 00000000..ae5290ae --- /dev/null +++ b/game/tests/test_building_gaps.gd.uid @@ -0,0 +1 @@ +uid://b1cbd13xhv1s4 diff --git a/game/tests/ui/test_phase9_screens.gd b/game/tests/ui/test_phase9_screens.gd index 30d441ad..decb4e1b 100644 --- a/game/tests/ui/test_phase9_screens.gd +++ b/game/tests/ui/test_phase9_screens.gd @@ -229,6 +229,11 @@ func test_how_to_play_and_credits() -> void: var credits: String = info.body_text() for part: String in ["FARLANDING", "The Farlanding project", "Godot Engine", "Blender", "GUT"]: assert_string_contains(credits, part) + assert_string_contains(credits, "FARLANDING LICENCE") + assert_string_contains(credits, "Copyright (c) 2026 ddv1982") + assert_string_contains( + credits, FileAccess.get_file_as_string("res://LICENSE.txt").strip_edges() + ) assert_string_contains(credits, "gdtoolkit") assert_string_contains(credits, "no samples") assert_string_contains(credits, "Permission is hereby granted", "Godot's licence text") diff --git a/game/ui/info_panel.gd b/game/ui/info_panel.gd index 34789974..fd5071e3 100644 --- a/game/ui/info_panel.gd +++ b/game/ui/info_panel.gd @@ -294,6 +294,9 @@ static func credits_text() -> String: GAME_NAME.to_upper(), "Design and development: The Farlanding project", "", + "FARLANDING LICENCE", + FileAccess.get_file_as_string("res://LICENSE.txt").strip_edges(), + "", "AUDIO", ( "All sound and music is synthesised by the scripts in audio_src: no samples" From ca3e9988850330f9119a1b345fd6c86edc9af9a4 Mon Sep 17 00:00:00 2001 From: Douwe de Vries Date: Sun, 15 Nov 2026 10:43:51 +0100 Subject: [PATCH 2/2] Wait for group badge layout before browser clicks --- tools/web_tests/groups.spec.cjs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/web_tests/groups.spec.cjs b/tools/web_tests/groups.spec.cjs index cafed27b..109b2a64 100644 --- a/tools/web_tests/groups.spec.cjs +++ b/tools/web_tests/groups.spec.cjs @@ -3,8 +3,18 @@ const { test, expect } = require('@playwright/test'); async function state(page) { return page.evaluate(() => window.farlanding?.diagnostics); } async function button(page, label) { - await expect.poll(async () => (await state(page))?.buttons.some(b => b.text.startsWith(label))).toBe(true); - const target = (await state(page)).buttons.find(b => b.text.startsWith(label)); + // Selection changes move the badge bar. Wait for two distinct simulation + // samples with the same coordinates before clicking its rendered position. + let previous, target; + await expect.poll(async () => { + const sample = await state(page); + target = sample?.buttons.find(b => b.text.startsWith(label)); + if (!target) return false; + const pixel = JSON.stringify(target.pixel); + const stable = previous && sample.tick !== previous.tick && pixel === previous.pixel; + if (!previous || sample.tick !== previous.tick) previous = { tick: sample.tick, pixel }; + return Boolean(stable); + }).toBe(true); await page.mouse.click(...target.pixel, { delay: 80 }); } const sorted = ids => [...ids].sort((a, b) => a - b);