ShitboxInfinity/tools/gen_textures.sh
m3ultra 0c13c82eac Pursuit, drag and derby modes; crash-damage paint; junction fixes
Three new modes, all our own code:
- Pursuit (Simpsons Hit & Run's meter): smashing in cruise fills heat, at full
  the police hunt you. Open 250 m for 6 s to escape, get pinned 4 s to be busted.
  Heat decays, so picking a fight is a choice not a timer.
- Drag (NFSU2's): the gearbox IS the event. The builder finds each level's
  longest genuinely straight run of wide road (442-628 m across the five OSM
  levels) and drops DragStart/DragEnd, so no level needs hand-authored coords.
- Derby: five opponents in the carpark, last one running. Reuses the pursuit AI,
  each hunting a different car so it's a brawl not a mob.

Crash damage now shows: total control-point travel drives paint dulling,
roughness and a scratch layer, so scuffs and crumple can never disagree.

Junction generator fixes, all found by measurement rather than inspection:
- streams[:6] truncated after street A's ways, so junctions where A yielded 3+
  usable ways shipped with ZERO cross traffic. Interleaved before capping;
  every event now has 2-4 crossing streams.
- RADIUS 170 -> 95 spread the convoy over a 340 m window, so you threaded the
  intersection through a 20 m gap. Margaret x Edward was unwinnable: 27 convoy
  cars alive, zero collisions, $0.
- Launch points now walk the street to exactly SPAWN_DIST and pick the busiest
  shared node, and _clear_spawn() unblocks a buried start. Albert x Adelaide
  went from $0 (drove 1 m into a building) to $91k.
- build_all_junctions.sh records the street pairs, which existed nowhere before.

Fixes from an adversarial review (23 confirmed findings), the worst being:
- Derby could only ever be LOST: wrecked opponents un-wrecked 2.2 s later via
  Car._recover, so "last one running" was unreachable and the kill bounty could
  be farmed to the boost cap off one revived car. They now hold their wreck.
- Drag reported WON to a beaten player: the AI's lookahead wrapped on a 2-point
  path, U-turning before the line so its distance-to-finish grew again.
- The scratch layer used BLEND_MODE_MIX, whose mask defaults to white -- it
  replaced the paint entirely rather than scuffing it. Now MUL.
- Drag on a level with no strip left the car at the origin, half-buried, unable
  to end. Cop spawns used an unflattened basis. Stale "WANTED" HUD text.

Test harness: smoke covers all seven modes, and failures now exit instead of
hanging -- a failed assert in a headless SceneTree halts the script but leaves
the tree spinning, which cost 53 minutes of wall clock to notice.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-28 23:07:41 +10:00

70 lines
11 KiB
Bash
Executable File

#!/bin/bash
# Regenerate the level texture set via Cloudflare FLUX (see flux_texture.sh).
# Usage: gen_textures.sh [name ...] (no args = every texture below)
#
# Cloudflare's safety classifier throws occasional false positives on innocuous
# masonry prompts ("kerb stone" tripped it once), so each texture carries a
# reworded fallback prompt and we retry with that before giving up.
set -uo pipefail
cd "$(dirname "$0")/.."
OUT=assets/textures
mkdir -p "$OUT"
# name|size|prompt|fallback prompt|target mean luma (0 = as generated)
SPECS=$(cat <<'EOF'
pavers|512|seamless tiling top down texture of a pedestrian mall floor paved in grey and buff granite blocks laid in a herringbone pattern, fine stone grain, flat overcast lighting, no shadows, no objects|overhead repeating pattern of pale grey granite paving blocks in herringbone layout, even light|165
asphalt|512|seamless tiling top down texture of worn dark grey asphalt road surface, fine aggregate, subtle tyre polishing, flat even lighting, no markings, no shadows|repeating overhead texture of grey bitumen pavement, fine gravel aggregate, even light|0
footpath|512|seamless tiling top down texture of a clean city concrete footpath, a dense regular grid of small square pale grey slabs, at least ten slabs across the image, very fine light grey joint lines, low contrast, subtle and uniform, no cracks, no dark seams, flat even lighting, no shadows|overhead repeating grid of many small pale grey concrete paving squares with faint thin joints, low contrast, even light|160
concrete_ground|512|seamless tiling top down texture of a medium grey concrete surface, fine even sandy aggregate grain, uniform and subtle, light patchy staining, no cracks, no large marks, flat even lighting, no shadows|overhead repeating fine grained mid grey concrete surface, uniform subtle speckle, no cracks, even light|150
facade_glass|768|seamless tiling texture of a modern office tower curtain wall, regular grid of desaturated slate grey blue reflective glazing panels with slim dark bronze mullions, panels vary slightly in tone as they reflect an overcast sky, muted and understated, not saturated, flat frontal view, even lighting|repeating grid of muted grey blue office window panels with thin dark frames, subtle tonal variation, desaturated, frontal view|0
facade_concrete|768|seamless tiling texture of a 1970s concrete office building facade, horizontal window bands with deep precast concrete spandrels, pale grey, flat frontal view, even lighting|repeating pattern of grey precast concrete building front with horizontal rows of windows, frontal view|150
facade_brick|768|seamless tiling texture of a red brick commercial building facade with regular rectangular sash windows and pale rendered sills, flat frontal view, even lighting|repeating pattern of red brick wall with evenly spaced windows, frontal view, even light|0
facade_heritage|768|seamless tiling texture of an ornate Australian Federation era painted render facade, arched upper windows, moulded cornices and pilasters, cream and sage green paint, flat frontal view, even lighting|repeating pattern of ornate old painted plaster building front with arched windows and decorative mouldings, cream colour, frontal view|170
shopfront|768|seamless tiling texture, daylight photograph of a row of retail shop windows, medium grey green tinted glass panes in slim dark aluminium frames, bright daytime scene, clearly lit, mid tone not dark, flat frontal view, no floor no sky|repeating grid of grey green shop window glass panels with thin metal frames, bright daylight, mid grey tone, frontal view|0
sandstone|768|seamless tiling texture of a warm honey brown sandstone building facade, regular rows of tall arched windows with dark glazing and carved stone surrounds, ashlar block courses between them, weathered and soot stained, flat frontal view, even lighting|repeating pattern of tan sandstone building front with rows of arched windows and stone block courses, frontal view, even light|175
awning_green|512|seamless tiling texture of taut dark bottle green canvas awning fabric, muted and desaturated, subtle woven weave, flat even lighting|repeating muted dark green heavy canvas cloth texture, woven weave, even light|0
awning_grey|512|seamless tiling texture of taut charcoal grey canvas awning fabric, subtle woven weave, flat even lighting|repeating dark grey heavy canvas cloth texture, woven weave, even light|0
awning_cream|512|seamless tiling texture of taut sand beige canvas awning fabric, mid tone tan colour not white, weathered and slightly dirty, visible woven weave, flat even lighting|repeating tan beige heavy canvas cloth texture with visible weave, dirty, even light|175
planter|512|seamless tiling texture of weathered rust orange corten steel plate, mottled oxide patina, flat even lighting, no shadows|repeating rusty orange brown oxidised steel sheet texture, mottled, even light|0
roof_deck|512|seamless tiling top down texture of a commercial building rooftop, dark weathered grey ribbed metal decking with seams, rust streaks and dirt, mid to dark grey not white, flat even lighting, no shadows|repeating overhead dirty dark grey corrugated metal roof sheeting with rust marks, even light|0
bark|512|seamless tiling texture of grey brown fig tree bark, smooth with shallow vertical furrows, flat even lighting, no shadows|repeating grey brown tree trunk bark surface texture, even light|0
foliage|512|seamless tiling texture of a dense mass of glossy dark green fig leaves seen from outside the canopy, overlapping leaves, flat even lighting|repeating pattern of dense dark green broad leaves overlapping, even light|0
grass|512|seamless tiling top down texture of mown subtropical lawn, dense green blades, slight colour variation, flat even lighting, no shadows|repeating overhead green cut grass lawn texture, even light|0
water|512|seamless tiling top down texture of murky brown green river water, gentle ripples, flat even lighting, no reflections of objects|repeating overhead calm muddy river surface with small ripples, even light|0
rock|512|seamless tiling texture of a rough volcanic cliff face, grey brown fractured rock with vertical jointing, flat even lighting|repeating rough grey brown broken rock cliff surface texture, even light|0
steel|512|seamless tiling texture of painted structural steel plate, medium battleship grey, rows of rivets, rust bleed and weathering streaks, darker not pale, flat even lighting|repeating mid grey painted steel bridge plate with rivets and rust streaks, even light|0
panel_white|512|seamless tiling texture of a light warm grey painted aluminium architectural panel, subtle brushed finish, faint panel joint lines, light grey not white, flat even lighting|repeating smooth light grey painted metal sheet texture with faint seams, even light|195
asphalt_red|512|seamless tiling top down texture of a dark brick red painted asphalt bus lane surface, worn with grey patches showing through, fine aggregate, flat even lighting, no markings, no shadows|repeating overhead dark red bitumen road surface, worn, even light|0
foliage_jacaranda|512|seamless tiling texture of a dense mass of light purple lilac jacaranda blossom clusters covering a tree canopy, soft violet flowers, flat even lighting|repeating pattern of dense lilac purple tree blossom flowers, even light|0
bougainvillea|512|seamless tiling texture of a dense mass of vivid magenta pink bougainvillea flowers and green leaves covering a trellis, flat even lighting|repeating dense hot pink flowering vine texture with some green leaves, even light|0
weatherboard|768|seamless tiling texture of a traditional Australian Queenslander house exterior, horizontal cream painted timber weatherboard cladding with sash windows, slightly weathered paint, flat frontal view, even lighting|repeating pattern of pale painted horizontal wooden plank house wall with windows, frontal view, even light|180
corrugated_iron|512|seamless tiling texture of weathered galvanised corrugated iron roofing, vertical ribs, zinc grey with light rust patina, flat even lighting, no shadows|repeating grey corrugated metal roof sheets with vertical ridges and slight rust, even light|0
facade_deco|768|seamless tiling texture of a 1930s art deco sandstone and cream masonry building facade, tall narrow windows with decorative vertical piers and stepped mouldings, flat frontal view, even lighting|repeating pattern of cream art deco building front with vertical window bays and stepped stone details, frontal view, even light|175
facade_glass2|768|seamless tiling texture of a modern apartment tower facade, grid of floor to ceiling glass balconies with white frames and occasional teal glass panels, flat frontal view, even lighting|repeating grid of apartment building glass balconies with white frames, some teal panels, frontal view|0
signage_strip|768|seamless tiling texture, a long horizontal row of colourful fictional retail shop fascia signs in different colours and invented gibberish brand lettering, australian strip mall style, each sign a different colour block, flat frontal view, even lighting|repeating strip of varied colourful shop sign panels with made up unreadable lettering, frontal view, even light|0
billboard_ad|768|single large fictional advertising billboard poster, bold colourful retro soft drink advertisement with invented gibberish brand name lettering and a sunburst, flat frontal view, even lighting|colourful fictional poster advertisement with made up unreadable brand lettering, bold shapes, flat view|0
billboard_ad2|768|single large fictional advertising billboard poster, 1980s Australian beer advertisement style, bold blue and gold blocks with invented gibberish brand lettering, flat frontal view, even lighting|fictional poster ad with blue and gold blocks and made up unreadable lettering, flat frontal view|0
billboard_ad3|768|single large fictional advertising billboard poster, bright red and cream used car yard sale advertisement with invented gibberish lettering and starburst price tags, flat frontal view, even lighting|fictional red and cream sale poster with made up unreadable lettering and starbursts, flat frontal view|0
scratches|512|seamless tiling texture of scratched and scuffed dull grey car paint, fine directional scratches, small dents and primer showing through in patches, mid grey, flat even lighting|repeating scuffed scratched grey painted metal panel surface with worn patches, even light|150
EOF
)
want=("$@")
ok=0; fail=0
while IFS='|' read -r name size prompt alt luma; do
[ -z "$name" ] && continue
if [ ${#want[@]} -gt 0 ]; then
hit=0
for w in "${want[@]}"; do [ "$w" = "$name" ] && hit=1; done
[ $hit -eq 1 ] || continue
fi
if ./tools/flux_texture.sh "$prompt" "$OUT/$name.jpg" "$size" "$luma" >/dev/null 2>&1; then
echo "ok $name"; ok=$((ok+1))
elif ./tools/flux_texture.sh "$alt" "$OUT/$name.jpg" "$size" "$luma" >/dev/null 2>&1; then
echo "ok(alt) $name"; ok=$((ok+1))
else
echo "FAILED $name"; fail=$((fail+1))
fi
done <<< "$SPECS"
echo "textures: $ok ok, $fail failed"