The Game: I will not go over the game description at this moment, but the goal is to build groups of colors out of a board. For example the game shows a multiplication 5x7 then the goal is to make 5 groups of 7 by coloring the circles.
The Challenge:
The board in the back needs to be randomly generated. so that it can dynamically create levels for players to play without already knowing the answer.
Road Block #1:
I need to make sure to come up with a good way to remove circles, I could run into trouble if I randomly remove them....
Solution #1:
Instead of randomly removing blocks I will do a labyrinth solve approach..
Think of what you do to quickly solve a labyrinth. You start from the end and go backwards towards the start
With this line of thought, I want to create a complete path, that uses as many circles as the multiplication (5*7) = 35. Once I have that I will remove any of the items that are not being used
Problem #2:
For the creation of the path I used A* algorithm, the only issue with this was that the computer was having a meltdown trying to figure out all the possible paths. My algorithm would stop when a path of length 35 was found. The only issue was that the computer exit out of the game before reaching that. it would crash after creating 4 million different paths.
Solution # 2:
This one was a brain teaser. I knew that I was doing the right algorithm, but it was just too expensive, I couldn't cut corners because my path had no directions, no rules, the goal was to get a path that covered 35 blocks. But for every path I was getting around 3 new paths, here is just a small chart to demonstrate how chaotic this is:
As you can see, just 16 blocks in, I would have over 4 million paths! There is no way I could get to 35
In order to mitigate with this one, you will be surprised but my solution was extremely weird. I just decided that I would only allow for 20 paths to be created, that way after 700 paths I would already reach a solution. 700 paths are created in almost no time.
Problem #3:
Solutions where working but I guessed the solutions where just boring, I was getting big blocks all the time
As you can see, this is boring.... not quite what I had in mind with the design sketches.
Solution # 3:
In order to solve this one I was able to come up with a nice solution, instead of building a path of the exact length (5*7)=35 I decided to create an extra one for each group = 5 groups of 8 = 40. then I would remove every 8th circle...
Check out the resulting file, click on the screen to just randomly create new paths....
No comments:
Post a Comment