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.

    A grid with a green cube in the center.

    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.

    The green cube moved one sqaure to the right and there is now a red cube with 4 numers inside. The red cube is placed at the place where the green cube was in the step before this one.

    This wil repeat multiple times. A integer decides how many times it wil repeat.

    The green cube is at the top eft of the grid and there are 5 red cubes now.

    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.

    The image is the same as the one from a step before this one but the squares at the edge are yellow now.

    At the end the values of the first room get changed so its always the same.

    The green cube is also red now and the first room is pink with the words start kamer (dutch for starting room) in it.

    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.

    The rooms have walls and floors now. The walls are dark blue and the floor is light blue.
    Some floor tiles are replaced with floor traps. The floor traps are pink.
    Some walls are replaced with wall traps. The wall traps are green.
    Enemies are placed on the floor. The enemies are yellow.

    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.

    Some floor tiles are replaced with walls to prevent players from walking of the map. The walls are red.

    Below you can see a video of the rooms getting generated.

    If you found bugs or spelling mistakes please contact: website.support@kasia.games
    If you found bugs or other problems with a game server please contact: gameserver.support@kasia.games