RECORDANDRONCO/tools/jitter_wax.py
type-two e11ec402ff Terrain overhaul: 52-tile atlas from 5 generated surfaces, tone-harmonized so they read as one material family
Replaces the single flat grey tile. Adds tools/build_tiles.py (atlas builder
with edge-blending + tone matching), paint_terrain.py (surgical tile-plane
repaint: asphalt base, concrete pads, dirt blobs, groove patches near wax,
rubble clumps), jitter_wax.py, render_map.py (offline map preview), and
check_assets.py.

Also fixes the arena harness being rigged: both wax fields sat ~12 cells from
BotA and ~18 from BotB, so BotB starved for map reasons, not balance reasons.
Arena wax is now mirrored (7.1/18/18/19.8 from both starts). Seep interval
90 -> 20 after telemetry showed the slower rate still drained both economies.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 22:37:38 +10:00

24 lines
924 B
Python

#!/usr/bin/env python3
"""Jitter wax density per cell so neighbouring cells pick different sprite
frames — without it, equal-density cells draw the identical blob and the field
reads as a regular grid."""
import os, struct, glob, random
for i, m in enumerate(sorted(glob.glob(os.path.join(os.path.dirname(__file__), '..', 'mods', 'vinylgod', 'maps', '*')))):
p = os.path.join(m, 'map.bin')
if not os.path.exists(p):
continue
d = bytearray(open(p, 'rb').read())
w, h = struct.unpack_from('<HH', d, 1)
_, _, res_off = struct.unpack_from('<III', d, 5)
rng = random.Random(7000 + i)
n = 0
for x in range(w):
for y in range(h):
o = res_off + 2 * (x * h + y)
if d[o]:
d[o + 1] = max(1, min(12, d[o + 1] + rng.randint(-3, 3)))
n += 1
open(p, 'wb').write(d)
print(f'{os.path.basename(m):14s} jittered {n} wax cells')