ARCHON'S LIFE  -  source (v2.1)
================================

One portable C99 engine (src/aw_engine.c + the aw_*.inc files: art, text, art2, extra, friends) draws a small pixel
framebuffer; thin front-ends scale it up:

  src/win_main.c     Windows .scr (Win32 + GDI, settings window, registry)
  src/mac_saver.c    macOS .saver (ScreenSaverView built with the Objective-C runtime via dlsym)
  src/aw_weather.c   optional live temperature (background thread, tiny JSON parsing)
  src/aw_net_win.c   HTTPS GET through WinHTTP
  src/aw_net_mac.c   HTTPS GET through the libcurl that ships with macOS (dlopen)
  src/aw_net_stub.c  Linux test double (reads fake responses from $AW_FAKE_NET)
  src/wasm_glue.c    WebAssembly glue for the live demo on the website

Build everything (Windows .scr + universal macOS .saver) from Linux/macOS/WSL:
    pip install ziglang pillow
    ./build_all.sh                       -> dist/

Native Mac build without zig:
    clang -O2 -bundle -arch arm64 -arch x86_64 -mmacosx-version-min=10.13 -fvisibility=hidden \
          -Isrc src/mac_saver.c src/aw_engine.c src/aw_weather.c src/aw_net_mac.c -lm -o ArchonsLife

Website demo (WebAssembly build of the same engine):
    zig cc -target wasm32-wasi -O2 -s -Isrc -mexec-model=reactor src/aw_engine.c src/wasm_glue.c -lm -Wl,--no-entry \
        -Wl,--export=aw_create -Wl,--export=aw_destroy -Wl,--export=aw_resize -Wl,--export=aw_step -Wl,--export=aw_render \
        -Wl,--export=aw_width -Wl,--export=aw_height -Wl,--export=aw_set_prefs -Wl,--export=aw_set_weather -Wl,--export=aw_debug_warp \
        -Wl,--export=aw_debug_set_time -Wl,--export=aw_debug_force_mode -Wl,--export=aw_debug_force_guest -Wl,--export=aw_debug_mode \
        -Wl,--export=aw_debug_stage -Wl,--export=aw_debug_season -Wl,--export=aw_debug_veh -Wl,--export=aw_debug_bg -Wl,--export=aw_debug_boat -Wl,--export=aw_debug_carrier -Wl,--export=aw_rgba -o archon.wasm

(The engine #includes aw_art.inc, aw_art2.inc, aw_text.inc, aw_extra.inc, aw_friends.inc, aw_bg.inc, aw_road.inc and aw_boats.inc from src/ - keep them next to aw_engine.c.)

Tests (Linux):
    cc -O1 -g -fsanitize=address,undefined -Isrc tests/stress.c src/aw_engine.c -o stress -lm && ./stress
    cc -O2 -Isrc tests/natural.c src/aw_engine.c -o natural -lm && ./natural
    cc -O2 -Isrc tests/fishland.c -o fishland -lm && ./fishland     (sea life only ever in water; includes the engine directly)
    cc -O1 -fsanitize=address,undefined -Isrc tests/weather_test.c src/aw_weather.c src/aw_net_stub.c -o wtest -lm -lpthread && ./wtest
    cc -O1 -Isrc src/harness.c src/aw_engine.c -o harness -lm && ./harness 342 192 60 1 2 frames   (writes PPM frames)

Engine API: src/aw_engine.h. Everything about a world is a pure function of its seed and the
elapsed time, so a given seed always plays out the same way.
