Problem:
I’m having trouble generating the dungeon grid in my Roblox game. I was testing the maximum size the grid could handle and increased the dimensions from 300x300 to 300x600. Everything seemed to generate correctly - nodes and rooms were placed where they should be according to my grid function. However, I noticed that the rooms and nodes weren’t lining up perfectly.
Grid Discrepancy:
The grid uses a unit size of 12, and ideally, everything (rooms, hallways, etc.) should be positioned in multiples of 12. When I checked the Z-axis positions of the nodes, I found decimals instead of whole numbers, which was unexpected since everything should have been divisible by 12. The X-axis positions seemed to be calculated correctly with no remainders.
Confusing Behavior:
This was puzzling because even though the nodes were spaced out by 12 units and stayed within the grid boundaries, and all the variables and calculations seemed correct, there was a misalignment issue. I initially thought the maximum dungeon size might be 600x600, but increasing the Z-axis size above 600 (to 612) resolved the alignment problem.
Further Testing and Observations:
I continued testing by increasing the Z-axis size in increments of 12. The alignment worked perfectly until I reached 696 units. Increasing it again to 708 fixed the issue. This same behavior occurred on the X-axis too when I changed it to 600 or 696 units. It’s important to note that I only tested up to these values, and there could be other problematic sizes. Sizes like 300 and 396 on both axes worked without any alignment issues.
In Summary:
I’m encountering a strange issue where the dungeon grid elements aren’t lining up correctly at specific dimensions that seem to be multiples of 12 plus some additional value. I’ve been unable to identify a clear pattern so far.
Video for for context
Video