Level Generator Ramp Placement
Author: Logan Audrain
After the elevation settings were made for the map, the next step was to add ramps that units could climb up and down to act as access points and potential defensive positions between different elevation levels on the map. One problem I came up against when creating the code that places the ramp was that I had to find a way to rotate the ramps so that they were properly climbable. As you can see in the image above, by default, they are all facing the same direction, and because of this, most of them don't actually work as climbable tiles.
So, how did I fix this? The section of code that determines where ramps need to be placed breaks the map into what I call "platforms". Think of a tower of three blocks, where each block is smaller than the one beneath it. The part of each block that is exposed (as in not covered by another block) is considered a platform, and the algorithm knows that the middle and top blocks would need a ramp to be accessible. So if that tower exists in this game, which is made up of towers, it finds the platforms by looking at every single tile and determining if that tile is part of the platform it is currently building. If it is looking at a tile with neighbors that are not part of the current platform, then that tile is eligible to be turned into a ramp. The way I fixed the original problem is that when the tile is marked as eligible to be turned into a ramp, it saves the direction in which the neighbor it had found earlier sits. In a later section of the code, it rotates it accordingly.
We have found a very small number of cases where this system doesn't work because while the bottom of the ramp is facing a lower tile, the top of the ramp may not be facing an upper tile. That problem will have to be fixed, but because it is so infrequent, it has been written down to be solved in the future.
Get Real-Time Skeletons
Real-Time Skeletons
Status | In development |
Author | TailByte |
Genre | Strategy |
Tags | Hex Based, Indie, Medieval, rts, Singleplayer, Unreal Engine |
More posts
- Level Generation is Very Slow1 day ago
- Issues with AI 3: Return of the Electric Sheep2 days ago
- More Command things2 days ago
- Widget Component Misalignment in RTS UI2 days ago
- Issues with AI 2: Electric Boogaloo8 days ago
- UI Timer Trouble10 days ago
- Issues with AI15 days ago
- Basic Level Generator15 days ago
- Pause Menu15 days ago
Leave a comment
Log in with itch.io to leave a comment.