Skip to content

Add Danger Ores - Voronoi map#1568

Merged
grilledham merged 4 commits into
Refactorio:developfrom
lex:danger-ore-voronoi-pr
Jul 6, 2026
Merged

Add Danger Ores - Voronoi map#1568
grilledham merged 4 commits into
Refactorio:developfrom
lex:danger-ore-voronoi-pr

Conversation

@lex

@lex lex commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Danger Ores – Voronoi

Danger Ores – Voronoi

A new Danger Ores preset where the ore field is partitioned into irregular Voronoi cells. Each cell is one main ore (iron / copper / coal / stone) with the others sprinkled in at low ratio — no two touching cells share a main ore, so every cell border is a colour change. Every map seed lays the cells out differently.

How it works

  • modules/voronoi_layout.lua — pure-Lua layout engine (no Factorio deps, standalone test file). Places jittered-grid seeds on a toroidal super-tile (seeded from the map), runs Lloyd relaxation for even cells, assigns each tile to its nearest seed (smooth, tile-resolution boundaries), then 4-colours the cell-adjacency graph (DSATUR, lowest-first so stone stays scarce). Guarantees: full coverage, clean borders, deterministic from the map seed (nothing persisted).
  • modules/main_ores_voronoi.lua — builder; CELL_SIZE, SEED_SPACING, RELAXATION knobs.
  • config/voronoi_ores.lua, presets/danger_ore_voronoi.lua, scenario_templates/danger-ore-voronoi/.

Everything else (spawn, terraforming, water, enemies, build-on-ore rules) inherits the Danger Ores defaults.

Play it

return require 'map_gen.maps.danger_ores.presets.danger_ore_voronoi'

Testing

  • Unit tests (lua map_gen/maps/danger_ores/modules/voronoi_layout.test.lua): full coverage, deterministic relaxation, clean borders (incl. torus wrap), determinism, 25-seed success at production size, stone-is-rarest.
  • Played in-game (Factorio 2.0 / Space Age).

🤖 Generated with Claude Code

lex and others added 2 commits July 5, 2026 21:54
A new Danger Ores variation whose ore field is partitioned into irregular Voronoi cells.
Each cell is flooded with one main ore ([item=iron-ore] [item=copper-ore] [item=coal]
[item=stone]) plus the usual minor mix; no two touching cells share a main ore, and every
map seed produces a fresh arrangement.

Layout engine (modules/voronoi_layout.lua, pure Lua / unit-tested): places jittered-grid
seed points on a toroidal super-tile (seeded from the map), runs Lloyd relaxation for even
cells, assigns each tile to its nearest seed (smooth, tile-resolution boundaries), then
4-colours the cell-adjacency graph with DSATUR so adjacent cells never share an ore. The
layout rebuilds deterministically from the map seed, so nothing is persisted. Stone is kept
scarce by using the 4th colour only when forced. Includes builder, preset, 4-ore config,
scenario template, and a map preview.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
So players can vote for the map (matches the review on the Tetrominoes PR).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lex

lex commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Registered Voronoi in map_poll.lua too so it's votable (per the note on #1567).

@grilledham grilledham merged commit 7f66152 into Refactorio:develop Jul 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants