Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The process evolved and I have eventually settled with something like this:

*Step 1: Level Generation*

Let's say I decide to generate 3-ball levels at 4x4 grid

I do `generate_all_boards(width: 4, height: 4,max_obstacles: 6)` and it will spit out all unique boards 4x4 with at most 6 tiles occupied by an obstacle with regards to all possible isoporphisms (rotations and mirrors)

    4 4
    ....
    ....
    ....
    ....
    4 4
    X...
    ....
    ....
    ....
    4 4
    .X..
    ....
    ....
    ....
    4 4
    ....
    .X..
    ....
    ....

  (...)

  4 4
  XX.X
  ...X
  ....
  .X.X


Now on each board I decide the starting position (usually 3 balls in a row in a corner and some other choices if not possible)

  4 4
  ABC.
  ....
  ....
  ....
  4 4
  X...
  ....
  ....
  ABC.

  4 4
  XX.X
  A..X
  B...
  CX.X


Then for each level I start generating with BFS all possible positions reachable from this state. I have several complex heuristics to decide which of those positions makes the most interesting level.

After trying a LOT of heuristics I have made two main conclusions:

- on board there is very often one main trick and any of the interesting final positions have solution based on the same trick and trying to make more levels from one geometry is in all cases I tried a logic duplication.

- the maximum movecount is good enough of a metric

so I take the maximum movecount position, whith some other tie-breakers I don't remember.

e.g.

  FINAL POSITION: score: 
  Movecount: 13 
  A B C .
  a . c .
  . . . b
  . . . .
Rinse and repeat and I have aproximately 40k levels in the current database.

* Step 2 : Level Curation*

I have created a version of the game with all those 40k levels split by groups of geometry, number of balls and number of obstacles, and a button "random level in current group". And I started playing those random levels over and over and over. I added a small button "Rate this level" so that whenever I got a level I thought was interesting or some new motive has appeared I rated it as "Super".

In the end all the "Super" levels made it into final game.



Very insightful, thanks for sharing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: