I was researching different puzzle ideas and came across a game called Warframe that requires the player to hack a console to progress further into the level.

The player has to spin around the hexagons (randomly generated, and get more difficult later on) to link up the connections to other hexagon neighbors. It's simple for the player to do, but also quite fun from my research.

How can I create something similar to this?

Edit: To be more specific; I would like to know how to generate a puzzle like below and how to check for successful connections. The graphics, animations, and player input I can handle. I suppose it's more about the algorithms to create the puzzle and then check the conditions.

I couldn't figure out good search terms to find something similar. So even if someone can point me in the right direction, that would be helpful.

I will be doing this in Unity / C#.

enter image description here

Example of doing a puzzle.

enter image description here

  • \$\begingroup\$ Hi JacketPotatoeFan, can you tell us a bit more about what you're looking for? It's not clear whether you're stuck on how to render/animate the hexagons, how to handle & react to user input, how to implement & manipulate the puzzle state, how to check success conditions,, how generate new puzzles, or how to design similar mechanics... or something else entirely. As you can see there's a lot that goes into a puzzle like this, so we'll need your help narrowing down which step in the process you need help tackling first. (You can always ask another question for the next step, and the next...) \$\endgroup\$
    – DMGregory
    Apr 30, 2018 at 23:45
  • \$\begingroup\$ Typical approach here is to generate a solved puzzle, then mix it up, in this case, randomly rotating each hexagon. \$\endgroup\$
    – House
    May 1, 2018 at 4:07
  • \$\begingroup\$ @DMGregory Thanks for tip. Have edited my question to be a little more specific on what I am after. Hopefully that is better. \$\endgroup\$ May 1, 2018 at 8:18
  • \$\begingroup\$ @MichaelHouse How do you decide on what tiles to remove and checking successful connections? \$\endgroup\$ May 1, 2018 at 8:18
  • \$\begingroup\$ @JacketPotatoeFan It's an algorithm specific to your puzzle. \$\endgroup\$
    – House
    May 1, 2018 at 15:51

1 Answer 1


One common strategy that's used to generate puzzles like this is to start from a solved state, then work backwards to scramble it. So...

  1. Create your initial arrangement of hexes, initially all blank. This could be pulled from a list of pre-set arrangements, or you could place hexes one at a time so that they touch at least one other hex.

    List all the places where two hexes share an edge.

  2. Select and remove a shared edge from your list at random, and mark the hex on each side with a line pointing to that edge.

    Repeat until you have as many connections as you want. (There's probably a sweet spot in ratio to the number of hexes in the puzzle, where the number of connections per tile is high enough to provide some choices, but not so high that everything connects to everything else)

  3. Pick a hex at random and rotate it ±60° randomly.

    Repeat n times, based on how scrambled you want the puzzle to be.

    Verify that the puzzle hasn't accidentally been scrambled back into a solved state before terminating. If so, do a few more rotations.

This method:

  • guarantees the puzzle is solvable

  • guarantees the solution is reachable in n valid moves or fewer (since you used only n reversible moves to scramble it from a solved state)

  • has tunable parameters to control the difficulty:

    • number of tiles
    • density of connections
    • scramble count n

Arriving at work now but I can give some implementation notes later. The main idea being store each hex as an array of 6 bools representing connections, and an integer offset you can use to rotate your lookups into that array, modulo/barrel-shift style.

  • \$\begingroup\$ Would love some implementation notes if you have time later. If not, no worries, what you have provided will help me. Thanks. \$\endgroup\$ May 1, 2018 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .