Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Cool game, the music suits the interesting vibe it gives. The random generated levels and many different paths kept me exploring and I like it that every time you play a level it isnt the same thing. I'm interested on how you made the levels to generate randomly. It is a pretty challenging game too. The game is just 2MB? Super cool. The dash and bomb is pretty useful in scary situations. I have not managed to reach the Boss fight but I'm gonna try harder ;)

(+2)

thank you

I read about the level gen in Dereks Yu's book on the developmnet of spelunky.

You create a grid, let’s say 4x4, and each cell represent a room.

Then you assign a random cell in the top and bottom row to be the start and exit room.

now randomly move left,right or down from the start-room iterating until you reach the exit-room and that will be your straight path from start to exit. you’ll end up with something like this:

[0] [2] [1] [S]

[0] [3] [1] [2]

[0] [0] [0] [3]

[E] [1] [1] [3]

The numbers represent different types of rooms. For instance, 1 would be a room with openings to the right and left side, 2 an opening at the bottom, 0 can be any type of room and so on.

Loop through the grid and for each type of room you draw from a pool of premade layouts which is just arrays of numbers like this:

[ 1,1,1,1,1,1,1,1,1,1,

1,0,0,0,0,0,0,0,0,1,

0,0,0,0,0,0,0,0,0,0,

0,0,0,0,0,2,0,0,0,0,

0,0,0,0,1,1,0,0,0,0,

0,0,0,0,1,1,0,0,0,0,

1,0,0,1,1,1,1,0,0,1,

1,1,1,1,1,1,1,1,1,1]

1 is a wall tile, 0 is void, 2 is en enemy etc.

Loop through the array as a grid with array_index = x_cell + y_cell*room_width.

Then draw to x,y position with

x = (x_cell_room_grid*room_width+x_cell_room_lay_ut)*tile_size

y = (y_cell_room_grid*room_height+y_cell_room_layout)*tile_size

hopefully that made any sense and im not just making it sound more complicated than it is.

this is awesome! Im kinda bad at math but i'll try to make sense out of this and try it out myself. Thank you very much for sharing this!!