mirror of
https://github.com/swarm-game/swarm.git
synced 2024-09-17 18:38:44 +03:00
01a5b070e7
Towards #1415. ## Uses This capability could be used to quickly iterate on DSL world descriptions, e.g. when tuning noise parameters. ## Implementation notes * For the hard-coded ANSI terminal color names, I chose RGB triples that matched my own terminal settings. This means that a rendered PNG might not exactly match one's own terminal colors. * `Blank` terrain corresponds to a transparent pixel. * Implemented parse-time validation of `attr` references. Previously, referencing a nonexistent `attr` by an entity would fail silently at runtime. * Normalization: strings like `"rock"` now only exist once; the string is shared via toplevel variable definitions * Entities and terrain have TUI-independent color definitions from which VTY Attrs are derived, but all TUI user-interface colors are defined only as VTY Attrs. ## Demos Each pixel in the output image correponds to one world cell. To enlarge, can use [imagemagick](https://legacy.imagemagick.org/Usage/resize/#scale): stack run -- map data/scenarios/classic.yaml --seed 0 --png -w 300 -h 200 && convert output.png -scale 800% out2.png ![out2](https://github.com/swarm-game/swarm/assets/261693/51794b63-7d78-4738-b20a-8b4f4352f006) stack run -- map data/scenarios/Challenges/bridge-building.yaml --png && convert output.png -scale 800% out2.png ![image](https://github.com/swarm-game/swarm/assets/261693/b04895a2-eb61-4499-a122-ae8444f7e4fb) |
||
---|---|---|
.. | ||
Main.hs |