Sign in to follow this  
Huy Luu

BricksBreaker-style level design Question

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:

 

https://play.google.com/store/apps/details?id=com.wegoi.brickfree&hl=en

 

,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 this post


Link to post
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 this post


Link to post
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 !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this