Skip to content

Add Danger Ores - Tetrominoes map#1567

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

Add Danger Ores - Tetrominoes map#1567
grilledham merged 2 commits into
Refactorio:developfrom
lex:danger-ore-tetrominoes-pr

Conversation

@lex

@lex lex commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Danger Ores – Tetrominoes

Danger Ores – Tetrominoes

A new Danger Ores preset where the ore field is a giant interlocking tetromino mosaic. Each tetromino piece is one main ore (iron / copper / coal / stone) with the others sprinkled in at low ratio — and no two touching pieces share a main ore, so every piece border is a colour change. Every map seed lays the pieces out differently.

How it works

  • modules/tetromino_layout.lua — pure-Lua layout engine (no Factorio deps, has a standalone test file). It packs a 32-cell toroidal super-tile using all seven tetrominoes: a 4×4-block base tiling (117 possible fills per block) randomised by local 4×4 "flips", then a DSATUR backtracking 4-colouring so adjacent pieces differ. Guarantees: 100% tetromino coverage, clean borders, deterministic from the map seed (rebuilds identically on load — nothing stored in global).
  • modules/main_ores_tetrominoes.lua — builder mapping each chunk to a piece/ore; CELL_SIZE controls piece scale.
  • config/tetromino_shapes.lua, config/tetromino_ores.lua, presets/danger_ore_tetrominoes.lua, scenario_templates/danger-ore-tetrominoes/.

Everything else (spawn, terraforming, water, enemies, win condition) inherits the Danger Ores defaults, like the other presets. Stone is kept scarce by using the 4th colour only when it's forced.

Play it

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

Testing

  • Unit tests (lua map_gen/maps/danger_ores/modules/tetromino_layout.test.lua): orientation generation, full coverage, every piece exactly 4 cells, clean borders (incl. torus wrap), determinism, and success across 25 seeds at production size.
  • Played in-game (Factorio 2.0 / Space Age).

🤖 Generated with Claude Code

A new Danger Ores variation whose ore field is tiled by interlocking tetrominoes.
Each piece is flooded with one main ore ([item=iron-ore] [item=copper-ore] [item=coal]
[item=stone]) plus the usual minor mix; no two touching pieces share a main ore, and
every map seed produces a fresh arrangement.

Layout engine (modules/tetromino_layout.lua, pure Lua / unit-tested): packs a toroidal
super-tile with all seven tetrominoes via a 4x4-block base tiling randomised by local
flips (brute-force exact cover is intractable), then 4-colours the pieces with DSATUR so
adjacent pieces 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, and scenario template.

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

Copy link
Copy Markdown
Collaborator

Need to add the map here too: https://github.com/Refactorio/RedMew/blob/develop/map_gen/maps/danger_ores/modules/map_poll.lua
So players can vote for the map.

Addresses review: add the map to map_poll.lua so players can vote for it.

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

lex commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Good catch, thanks! Added Tetrominoes to map_poll.lua so it shows up in the next-map vote (commit d43326d).

@grilledham grilledham left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the contribution!

@grilledham
grilledham merged commit 8c058b4 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