Why did we choose for level generation?
We chose for level generation because we wanted to have a lot of different levels.
How does the level generation work?
With this level generation the values get put in 3d array. I wil explain it using a grid. The generation starts in the center of the grid.
Then it chooses a random direction and moves one square. The square it came from gets 4 random values that decide how it wil look.
This wil repeat multiple times. A integer decides how many times it wil repeat.
It cant generate a room on the sqaures at the edge of the grid. when its next to one of those sqaures it cant move to those sqaures. This is to make sure there arent any index out of range errors.
At the end the values of the first room get changed so its always the same.
Then the interior of the rooms get generated. For the generation of the rooms 4 2d arays are used on for each of the 4 values that a room has. There is an aray for walls and floors, an array for floor traps, an array for wall traps and an array for enemies. The arrays use different values to decide what needs to be placed on that square. The arrays also communicate with eachother to make sure it doesnt place two things on the same square that cant be placed on the same square. For example it makes sure it doesnt place enemies in walls.
After that each room checks the values of the rooms next to it. If those values are (0, 0, 0, 0) then its empty and the room will place a wall between the empty room and itself. If we didnt prevent the rooms from generating on the edge then we would get an index out of range error at this step.
Below you can see a video of the rooms getting generated.