fix(client): address PR #78 review comments

- Widen world_seed entropy from u32 to full u64 by combining two randi()
  calls (Hoshe warning #1)
- Persist world_seed to save directory and restore on resume_game() so
  loaded sessions maintain D-010 deterministic replay (Tyre warning #2)
- Constrain EntanglementConfig intrigue range based on flat value so
  mundane_ratio stays within D-029 spec [45,55]% (both reviewers)
- Remove dead VIS_PERIPHERAL constant and _grow_bounds() method
- Update test_client_p1 peripheral test for forward-only simplification
- Fix misleading exp_fade shader comment (filter_nearest = hard step)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 22:11:17 +01:00
co-authored by Claude Opus 4.6
parent b89c4d5c9d
commit 50aba3adf6
5 changed files with 47 additions and 52 deletions
-30
View File
@@ -8,7 +8,6 @@ extends Node
# Used by fog shader to distinguish visual treatment per tile.
# Test assertions reference these: assert_that(byte).is_equal(FogState.VIS_FORWARD)
const VIS_HIDDEN: int = 0 # Not in LOS — fully fogged
const VIS_PERIPHERAL: int = 180 # In LOS, peripheral sector — light fog dimming
const VIS_FORWARD: int = 255 # In LOS, forward sector — clear vision
const EXP_UNEXPLORED: int = 0 # Never seen — total darkness
@@ -139,8 +138,6 @@ func update_from_state() -> void:
func _grow_bounds_from_positions(positions: Dictionary) -> Rect2i:
## Compute bounds from visible_positions (Dictionary[Vector2i, bool]).
## Equivalent to _grow_bounds() but reads from the always-populated
## positions dict instead of the legacy visible_tiles Array.
var min_x := 999999
var min_y := 999999
var max_x := -999999
@@ -158,30 +155,3 @@ func _grow_bounds_from_positions(positions: Dictionary) -> Rect2i:
return map_bounds.merge(tile_bounds)
func _grow_bounds(tiles: Array) -> Rect2i:
## Compute bounds that include all currently visible tiles, merged with
## existing bounds so the texture only grows — never shrinks. Explored
## tiles always stay within bounds and render as deep fog, not black.
var min_x := 999999
var min_y := 999999
var max_x := -999999
var max_y := -999999
for tile in tiles:
if not tile is Dictionary or not tile.has("x") or not tile.has("y"):
continue
min_x = mini(min_x, int(tile.x))
min_y = mini(min_y, int(tile.y))
max_x = maxi(max_x, int(tile.x))
max_y = maxi(max_y, int(tile.y))
# Guard: all tiles invalid (no x/y) — sentinels would produce negative Rect2i
if min_x > max_x:
return map_bounds
# Margin for fog gradient bleed at edges.
# The Gaussian blur in fog.gdshader samples at 2-texel intervals across a 7x7 kernel,
# reaching ±6 tiles from the fragment position. Margin must be >= 8 to avoid
# clamping artifacts at texture boundaries.
var tile_bounds := Rect2i(min_x - 8, min_y - 8, max_x - min_x + 17, max_y - min_y + 17)
# Merge with existing bounds — grow only
if map_bounds.size.x <= 1 and map_bounds.size.y <= 1:
return tile_bounds
return map_bounds.merge(tile_bounds)