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
4 changes: 4 additions & 0 deletions docs/adr/0006-buildings-on-the-navmesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 12 additions & 0 deletions docs/adr/0022-traffic.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 21 additions & 0 deletions game/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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.
10 changes: 5 additions & 5 deletions game/export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions game/sim/systems/navigation/navmesh_path_service.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion game/tests/maps/test_hollow_map.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
84 changes: 84 additions & 0 deletions game/tests/test_building_gaps.gd
Original file line number Diff line number Diff line change
@@ -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")
1 change: 1 addition & 0 deletions game/tests/test_building_gaps.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://b1cbd13xhv1s4
5 changes: 5 additions & 0 deletions game/tests/ui/test_phase9_screens.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions game/ui/info_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 12 additions & 2 deletions tools/web_tests/groups.spec.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading