Coding a level generator in GameMaker #1 – basics + problems

How the Level-Generator works

A Level’s got a 1280×960 pixel scale. The creation code will fill the level with 32×32 sized solid blocks (walls).

After the level is full of solid blocks, a dungeon digger object will be placed into the middle of the level. The DungeonDigger now will go 100 – 200 times in a random direction. If there is a collision with a solid wall block, the wall will be deleted by the DungeonDigger (wall has been digged). Every 5 – 10 frames the DungeonDigger will change its direction, so the level becom more interresting… There will be a 10% chance that the DungeonDigger will double its size to create a bigger room for 10 – 30 frames. Now the levels structure has been finished. But now I will setup textures for the wall objects.

The Idea of placing textures to a wall

If a wall has a left neighbor, a right neighbor and a neighbor on top but no neighbor at the bottom, the wall will have a special texture… If a block has no neighbors it will have another texture…. and so on.

The problem of knowing the neighborhood

How will my wall block know if there are any neighbors? I’m using the GameMakerStudio as engine. I tried to check if there is a collision with place_free() and place_empty()… This will not work very well, cause there is no collision… The wall blocks are placed tight to each other, but they are not colliding… I have to find another way to check if there are a neighborhood…

Anyone out there to help me out?

Leave a Reply

Your email address will not be published. Required fields are marked *