-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes/improvements to map generation #210
base: dev
Are you sure you want to change the base?
Conversation
shrinkAmount was applied before the potential min/max swap, resulting in room extents being larger than intended if the swap occurred. This fix resolves some instances of room overlap but not all.
After generating the facility layout, the game tries to force a room2C (corner tile) into each zone that doesn't have one. To do this, it finds a room1 (dead end tile) and checks whether there's space to extend it one tile forward then one tile sideways, forming an L shape. But it wasn't checking the correct spots to determine whether there's space, so sometimes the L would graze by another room1. Luckily, room shapes are recalculated when rooms are created, so the room2C would end up being a room3 (T-shaped tile) and the grazed room1 would end up being a room2 (hallway tile). However, room assignment still expected the additional room2C and room1, and so those tiles' room assignments got pushed to the next available room2C and room1, meaning not only that those rooms likely ended up in the wrong zone, but also that the very last room2C assignment (usually room2ccont, the electrical center, required to beat the game) and the very last room1 assignment (usually gateaentrance, required for two endings and for the MTF to spawn) never occurred. I used a seed checker I created to check 10000 seeds before and after the fix. The fix reduced the ratio of unbeatable seeds from 5.28% to 3.72%. I hope to use this branch to reduce this ratio even further (without rewriting the whole map system).
Is the custom map size up to date? Better to make |
- Fix GetZone incorrectly using MapWidth instead of MapHeight - Make random hallway width dependent on MapWidth to fix maps remaining narrow despite a high MapWidth; the multipliers 0.6 and 0.85 were chosen as they are the only multiples of 0.05 that allow the two expressions to resolve to 10 and 15 when MapWidth is at its intended value of 18 - Split "map size" options.ini option into "map width" and "map height" options to increase customizability
98409ed Fix custom map sizes
Notice the zone sizes and amounts of checkpoint (green) rooms. Also notice how much of the width-40 map the facility actually occupies. |
PreventRoomOverlap is a function that tries to resolve a room's overlap issues by potentially swapping it with another room of the same shape. The disableoverlapcheck key makes a room exempt from PreventRoomOverlap's effects. Although the intro room, the pocket dimension, and 1499's dimension are big enough to not actually be swapped with anything, there is no reason they should even be considered for swapping by PreventRoomOverlap, so this commit gives them each the disableoverlapcheck key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you remove disableoverlapcheck
parameter for room966
?
I_Zone\Transition[0] represents the y value of checkpoint1 room tiles plus one, and I_Zone\Transition[1] represents the y value of checkpoint2 room tiles plus one. These values are used to determine which type of door to place between rooms in each zone during map generation, as well as which zone's ambient sounds or music to play during gameplay. Previously the values were hardcoded based on the vanilla map height of 18 but they are now generalized based on MapHeight.
Fix for room966
I think you should've put this Because your |
Isn't that easier to reduce lights amount? |
Not sure what you mean. Feel free to edit the room so that it has 5 lights instead of 7 if you would like to. I was just suggesting that these Edit: Jabka and I agreed to revert the changes. |
Btw, you can add "room2toilets" to forced rooms list in entrance zone. Generator creates most of maps with no toilets at all, making 100% walkthrough impossible due to "by researcher james..." achievement. |
5411cc8
to
77b00b9
Compare
8c7381b Revert "Merge pull request #3 from Jabka666/Fix-for-room966"This reverts commit 2909285, reversing changes made to f47eafd. 13a51b6 Fix/improve ranges of room-forcing codeAfter preliminary map generation, some code tries forcing more room1s, room4s, and room2Cs into each zone if necessary. The room1 code scans for empty spaces to turn into room1s, while the room4 & room2C code scan for rooms to extend in such a way to create a room4 or room2C. The ranges of the room1- and room2C-forcing code were a bit small, so some seeds didn't generate enough room1s or room2Cs even if there was space. Many important rooms (like Meanwhile, the range of the room4-forcing code was quite big, so extensions would sometimes be performed past zone boundaries or into the outer edges of the map, which (via some other factors) led to issues like SCP-895's chamber being placed deep in the Entrance Zone, or SCP-372's chamber taking the place of the start room. These changes make the ranges of the room-forcing code as large as they can be without causing issues, thus solving/mitigating the problems mentioned above. See commit for more info. Range of the room1-forcing code before and after these changes: Range of the room2C-forcing code before and after these changes: Range of the room4-forcing code before and after these changes: Example seeds before and after these changes (open for more detail):
|
After preliminary map generation, some code tries forcing more room1s, room4s, and room2Cs into each zone if necessary. The room1 code scans for empty spaces to turn into room1s, while the room4 & room2C code scan for rooms to extend in such a way to create a room4 or room2C. The ranges of the room1- and room2C-forcing code were a bit small, so some seeds didn't generate enough room1s or room2Cs even if there was space. Many important rooms (like room2ccont) are room1s or room2Cs, so this is arguably one of the biggest issues with the live game. Meanwhile, the range of the room4-forcing code was quite big, so extensions would sometimes be performed past zone boundaries or into the outer edges of the map, which (via some other factors) led to issues like SCP-895's chamber being placed deep in the Entrance Zone, or SCP-372's chamber taking the place of the start room. These changes make the ranges of the room-forcing code as large as they can be without causing issues, thus solving/mitigating the problems mentioned above. As part of these changes, - The variables controlling the ranges were renamed for clarity (since "zone" and "temp2" for a min and max was extremely cursed) and are now based on the accurate zone transition y-levels given by I_Zone\Transition - A bunch of extra conditions had to be added to handle the room-forcing code's behavior along the edges of the newly defined regions (e.g. only allowing a room1 to be forced into the bottom row of zone 1 or 2 if it is attached to from above instead of from the side or below) - The vertical scanning direction of the room2C-forcing code was reversed to decrease the likelihood that, due to the increased vertical range, the room2C containing room2ccont is forced in at the very top of the map right next to an exit gate - The local ZoneAmount was removed because ZONEAMOUNT already exists as a const and the code that used ZoneAmount was replaced - An inexplicable five-line gap in the middle of the code was reduced to a one-line gap
77b00b9
to
13a51b6
Compare
836ab8e Fix CalculateRoomExtents
shrinkAmount was applied before the potential min/max swap, resulting in room extents being larger than intended if the swap occurred. This fix resolves some instances of room overlap but not all.
6565fea Fix room2C forcing
After generating the facility layout, the game tries to force a room2C (corner tile) into each zone that doesn't have one. To do this, it finds a room1 (dead end tile) and checks whether there's space to extend it one tile forward then one tile sideways, forming an L shape. But it wasn't checking the correct spots to determine whether there's space, so sometimes the L would graze by another room1. Luckily, room shapes are recalculated when rooms are created, so the room2C would end up being a room3 (T-shaped tile) and the grazed room1 would end up being a room2 (hallway tile). However, room assignment still expected the additional room2C and room1, and so those tiles' room assignments got pushed to the next available room2C and room1, meaning not only that those rooms likely ended up in the wrong zone, but also that the very last room2C assignment (usually room2ccont, the electrical center, required to beat the game) and the very last room1 assignment (usually gateaentrance, required for two endings and for the MTF to spawn) never occurred.
I used a seed checker I created to check 10000 seeds before and after the fix. The fix reduced the ratio of unbeatable seeds from 5.28% to 3.72%. I hope to use this branch to reduce this ratio even further (without rewriting the whole map system).
Here's seed "n790" before the fix:
Notice that coffin and room2cpit, both HCZ rooms, are in EZ. Also notice that gateaentrance and room2ccont are missing. These problems were all caused by the forcing of a room2C just north of the room4 (four-way tile) in the center of the image.
Here's what that area looked like before the forcing:
The room1 north of the room4 is selected as a candidate for extension into an L shape. To determine which way the room1 could be extended, the game checks these four spots:
The southern spot is occupied, so the extension would be northward. To determine whether there's space, the game first checks these three spots:
They're empty, so to determine whether there's space to extend east after extending north, the game checks these three spots:
Some are occupied, so to determine whether there's space to instead extend west after extending north, the game checks these three spots:
They're empty, so the extension is performed, resulting in what we see in the final image.
With the fix, after the extension direction is determined, these are the spots that get checked for forward extension:
And if they're empty, these are the spots that get checked for sideways extension:
In this case, the forward extension check fails.
Here's what "n790" looks like after the fix:
Much better!