New Level Generator
Overview of how the new level generator is planned to work
We start with an empty map, with non overwriteable walls surrounding it (internal id -2) shown here as "#" for an easier viewing experience.
1 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
The entrance is spawned somewhere on the left side of the map. (non overwritable walls can be overwritten with doors at this stage in the level generation)
Then doorways are spawned on the other three walls. (they can also be an exit, but this only happens on the last room spawned) Their ID is -3 (denoting unassigned doors to other rooms) or an exit id. When drawing the level on the last step, anything greater than 20 is drawn as a door. When a player or AI passes through a door, they are sent to the destination room at the door's coordinates plus an offset depending on what side of the room the door spawned on.
2 # # # # # # # # D # # # # # # # E # # # # # # # # # # D # # # # # # # #
3 # # # # # # # # D # # # # # # # E . . . . . . . . . . # # # # # # # # # # D # # # # # # # #
Columns are generated down with value "0" (-1 is empty) when they meet the middle, they become "2" (comma). This prevents walls from accidentally blocking intersections.
4 # # # # # # # # D # # # # . # # . # E . . , . . . . , . . # # . # # . # # . # # # # D # # # # # # # #
the shapes "short u" "medium u" and "long u" (more shapes will be available, these are just examples, see list at the end of this doc) are applied by scanning horizontally, then if the middle wouldn't land on a comma, and depending on what direction they will place in and the coordinates of their "feet" placing. (they find the length to the nearest wall, then shorten by an "n" amount. (they also set the spots where they meet the main line as commas)
5 # # # # # # # # D # # # # . . . . . . # # . . . . . . . # E , # , , # , # , # . # # . . . # # . . . # # . . . . # # # # D # # # # # # # #
Rooms generate in spots that have no contact with a pathway, and then connect to the nearest pathway with a door. They set the floor as "4" and the walls as non overwritable walls (9 here for simplicity, but they will probably be -2 internally or something)
6 # # # # # # # # D # # # # . . . . . . # # . . . . . . . # E , # , , # , # , # . # # 9 9 . . . 9 + # # % + . . . 9 % # # % 9 . . . . 9 % # # # # D # # # # # # # #
Empty space is filled with walls.
7 # # # # # # # # D # # # # . . . # # # # . . . # # . # . . . . . # . # E , # , , # , # , # . # # 9 9 . # # . # . 9 + # # % + . # # . # . 9 % # # % 9 . # # . . . 9 % # # # # D # # # # # # # #
Overwriteable walls have a %chance to be overwritten with floor material. (this % chance determines how 'mazelike' a level will be). Outer walls will not be overwriteable. Some rows are fully overwritten with floor material. (mazelike would inversely determine the probabillity of this)
8 # # # # # # # # D # # # # . . . # . . . . . . # # . # . . . . . . . # E , # , , # , # , # . # # 9 9 . # . . # . 9 + # # % + . . . . . . 9 % # # % 9 . . # . . . 9 % # # # # D # # # # # # # #
Overwriteable walls are replaced with normal walls, and room flooring becomes either an item or more normal flooring. (or a fern)
9 # # # # # # # # D # # # # . . . # . , % . . % # # . # . . . . . . . # E , # , , # , # , # . # # # # . # . . # . # + # # . + . % . . % . # ! # # ! # . . # . . . # . # # # # D # # # # # # # #
A certain number (0-3) items are spawned randomly on the map in empty spots.
10# # # # # # # # D # # # # . . . # . , % . . ! # # . # ! . . . . . . # E , # , , # , # , # . # # # # . # . . # . # + # # . + . % . . % . # ! # # ! # . . # . . . # . # # # # D # # # # # # # #
Entities are spawned in random spots on the map. Amount and type depend on how deep the player is. Player is spawned next to the door.
This process continues for the other N levels. The last level gets an exit spawned. Once all rooms are spawned, each door is paired with a door in another room, and the door ids are changed from -3 to 20+ the destination room ID. These are all saved in the level storage matrix.
11# # # # # # # # + # # # # . . . # . r % . . ! # # . # ! . . . . . . # < @ # , , # , # , # . # # # # . # . . # . # + # # . + . % . . % . # ! # # ! # . . # . . g # . # # # # + # # # # # # # #
The first room is copied to the active matrix, and is drawn onscreen. Subsequent rooms are also copied off of the level storage matrix, with an offset depending on which room is selected.
When you go through a door, your coordinates are set near the door in the level your going to, plus an offset depending on which side of the map the door is on. The game then loads the target room to the active room's matrix, which should be quicker than procedurally generating each new room in 'realtime'.
Hopefully this was an interesting read. If you have any comments that could make generation better/more efficient don't hesitate to share them.
Appendix:
"Subshapes" list:
"U" shape (length depends on where it spawns, and some procedural elements)
. . . . . , # ,
Dead end (what direction it points and its length are procedural)
. . ,
Curved Dead end (what direction in curves in and its length are procedural)
. . . . ,
I will probably add more "subshapes" but this is just an example list.
These are examples of the same level as above with different levels of the "mazelike" attribute.
'Mazelike' level example:
# # # # # # # # D # # # # . . . # # # # . . % # # . # % % . . # . . # E , # % , # , # , # . # # # # . # # . # . # + # # , + . # # . # . # . # # ! # . # # . . . # . # # # # D # # # # # # # #
'Low Mazelike' level example:
# # # # # # # # D # # # # . , % . , , . % , . # # . . . . . . , . , . # E , # , , . , # , # . # # # # . . # . . . # + # # ! + % % # . . . # . # # ! # , . . . . % # , # # # # D # # # # # # # #
Get CalcRogue 1.4 (Rebalanced difficulty!)
CalcRogue 1.4 (Rebalanced difficulty!)
A Roguelike for your TI-84!
Status | Released |
Author | Nuclear_Diamond |
Genre | Adventure |
Tags | 2D, Procedural Generation, PROCJAM, Retro, Roguelike, secrets, ti-84 |
More posts
- ChangelogDec 20, 2021
- New Display Method? And Level Generator ImplementedDec 22, 2020
- V0.1! Better performance, Better controls!Dec 15, 2020
- Upcoming fixes/changesDec 13, 2020
Leave a comment
Log in with itch.io to leave a comment.