Skip to content

Galaxy generation: forge world and craftworld spawn boxes may still be scaled to the pre-2023 room size #1413

Description

@Karlious

The extra Mechanicus forge worlds and the Eldar craftworld spawn from a hardcoded coordinate box that looks like it was sized for the old 2400x1800 room. Since the room was doubled in 4f50533d2 (Nov 2023), that box now only covers the top-left corner of the map, so those features cluster there.

Checked against origin/main @ 2e8815277. If the clustering is intended, please close this.

The code

objects/obj_controller/Alarm_1.gml:275 — extra Mechanicus forge worlds:

xx = floor(random(1152 + 640)) + 64;   //  64 .. 1856
yy = floor(random(748 + 480)) + 64;    //  64 .. 1292

objects/obj_controller/Alarm_1.gml:299 — Eldar craftworld, further narrowed by a xx < 1690 && yy > 780 guard on line 303:

xx = floor(random(1152 + 600)) + 104;  // 104 .. 1856
yy = floor(random(748 + 440)) + 104;   // 104 .. 1292

Why it looks accidental

The constants date from 2023-06-20 (74c6a5f4d). The room was enlarged five months later, on 2023-11-26 (4f50533d2, "Larger room size, and UI tweaks"):

-    "Width": 2400,      +    "Width": 4800,
-    "Height": 1800,     +    "Height": 3600,

Against the room they were written for, the box was a sensible "most of the map, inset from the edges". Against the current room it is a corner:

Spawn box In 2400x1800 In 4800x3600
Forge worlds ~51% of the map ~13%
Craftworld (after the guard) ~19% ~4.7%

room_width and room_height are already in scope and used on line 301, which is part of why the hardcoded values look like an oversight rather than a deliberate sub-region.

Suggested fix, if unintended

// line 275-276
xx = floor(random(room_width  - 128)) + 64;
yy = floor(random(room_height - 128)) + 64;

// line 299-300
xx = floor(random(room_width  - 208)) + 104;
yy = floor(random(room_height - 208)) + 104;

The craftworld's xx < 1690 && yy > 780 guard has the same scale problem, but I don't know what it was protecting against so I've left it alone rather than guess.

Notes

  • Not resolution-dependent — room_width / room_height are never assigned anywhere, and generation doesn't read display or window size.
  • Not built or tested; reporting rather than opening a PR since I wanted to confirm intent first. Happy to submit a tested fix if you'd like one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions