# Map Generation Algorithm [BOMBERMAN]

I'm looking for some wise tips concerning a specific game development : Bomberman-like.

I am currently implementing a "random map" generation for the game, but I feel like I'm not doing in the best way :

• I have a vector of Objects (fresh class having a type (like a Border, a Destructible Wall, a Bomb, a Player...) and two size_t for (x, y) coords) that I initialize when I create a map.
• I generate Borders all around my Map that will define the game area.

This is the "I don't like that" part :

• I generate some Unbreakable/Breakable Walls using random coords : if at these coords there is nothing but an empty space, I put a Wall there. So that the map is filled with a certain percentage of walls.

Do you have any ideas of how to generate a Map with Walls properly, or using a certain algorithm ? I looked for a Maze Generation Algorithm but I don't have a very good feeling with this.

Thank you for your help and have a great day !

• It all depends.. What would you like to achieve? and what is the problem with the current solution? May 9, 2015 at 10:29
• @akaltar I'd like to generate a Map with a pattern of some unbrekable walls and some breakable walls placed fairly evenly. In fact, I would like to know if there is any algorithm which can achieve that. My current solution is working but "randomly" : after walls generation, I'll have to place the players and I can't place the players within four walls, I'll have to place them fairly so that the gameplay must be equal for all the players. And I really have no idea of how to do that. How did they do in "Neo Bomberman" for example ? May 9, 2015 at 10:38

The question is, what pattern you want to achieve, and how to randomize the given pattern.

You could place fix walls in a grid shape, then fill the rest with walls, and when you place the players, clear enough space for them to start.

Then you could start randomizing things:

• Player starting position. Don't forget to check if the players aren't too close.
• Grid pattern: You could offset them by random values from a regular grid. You could generate them with blue noise.
• Walls: Perhaps use perlin noise to leave out some areas.
• Powerups: You could use blue noise again for a more fair distribution.
• Map shape: A big blob of Perlin/Bellow noise perhaps offset to produce some specific shape(multiply it by a blurred bitmaps values and you will get a "Squarish" or "Circleish" shape)

You could try doing things in reverse. Start with an empty grid and place the boundary walls on the play field. Then define a bunch of wall patterns that you can choose from. ... ie a straight section, an L shape, a C shape etc. Randomly place these on the map testing to make sure you still have a valid map. ie One that is not completely closed off by walls. Then place all the game elements on the map.