# BricksBreaker-style level design Question

This topic is 1423 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys,

I just want to drop by and ask a really simple question here. For a Bricks Breaker-style game, such as this one:

,the game automatically generates new levels everytime the player enters a new session. However, I wonder what methods/techniques did the designer use to assemble blocks so that when it is needed, a new level can be generated with both logic (Bricks count) and aesthetic (Block Shape, Symmetry).

If you have any ideas on this problem, please share your knowledge. That will really help me in a lot of ways. Thank you very much in advance !

##### Share on other sites

For this kind of thing, my method of doing it is to use a recursive random generator function.  So you'd have a function like generateRandom(x,y,w,h), where the parameters describe a rectangle.  generateRandom calls a random one of a few dozen generate functions with the same parameters, that do something to that rectangle, then call generateRandom again on one or more subrectangles of it.

For example, generateBorder(x,y,w,h) would fill in all the perimeter blocks, then call generateRandom(x+1,y+1,w-2,h-2) -- that is, draw a border and start again on the space inside that border.  generateVerticalSplit might fill a line down the middle and the call generateRandom twice, once for each of the regions delimited.  For vertical symmetry, you could have generateMirroredVerticalSplit, which only calls generateRandom for the left region, then mirrors it in the other region.

If you're comfortable with a functional style of programming, this is fun to do as a library of function combinators.

Edited by valrus

##### Share on other sites

Hello valrus,

I'm really thankful for your reply. Even though it might have a lot of stuff on the technical side, fortunately your explanation was simple enough for me to understand. I'm trying to implement the ruleset based on what you've guided here, and will tell you later if there's any problems occurred. So far so good, thank you very much friend !

1. 1
Rutin
23
2. 2
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 15
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631757
• Total Posts
3002150
×