Gamelogic
  • Home
  • Blog
  • Tools
    • Grids 2 (for Unity)
      • Features
      • Documentation
    • Grids 1 (Legacy, for Unity)
      • 30 games in 30 days
      • Features
      • Tutorials, Documentation, and FAQ
      • Games made with Grids for Unity
      • Examples
      • What is new?
      • Grid Prototypes and Previews
      • Buy
    • Extensions
    • Colors
      • Features
      • Documentation and tutorials
      • Buy
    • Words
      • Features
      • Documentation
      • Buy
    • Abstract Strategy
      • Features
      • Documentation and tutorials
      • Examples
      • Buy
    • Match
      • Features
    • Grids (for GameMaker)
      • 30 games in 30 days
      • Features
      • Documentation
      • Buy
  • Buy
  • Articles
  • Support
    • Knowledge Base
    • Email Support
  • About
    • Meet our team

Blog

Day 2 Game 2: 30 games in 30 days using Grids

CLICK HERE TO PLAY GAME 2


This is what Grids did for us today. What can Grids do for you?

Game 2 is a maze traversal puzzle game; as in all maze games, you have to find your way to the goal. There are cells where you can decide which direction to take, but most cells take you in a pre-chosen direction when you land on them. (There is one glitch with the game: occasionally you get trapped in a section of the maze with no escape. This is fairly rare though).

This game uses several algorithms.

First, we generate a maze on the hex grid using Prim’s algorithm, similar to the maze generated with this example. From the maze, we select a start and goal nodes. Then, we use A* Star to find the path between the goal and start node. (We would normally not be interested in the shortest path, but there is only one path, so any path will do.) Now we assign directions to all nodes on the path to ensure the player can reach the goal node.

Next, we select random directions for all cells, except cells that are blue in the coloring below. The blue cells are made into decision nodes. We turn all decision nodes around the goal node into direction nodes pointing towards the goal.

Finally, we do a pass on the grid to ensure there are no loops that can trap the player. For each node, we simply follow the arrows until we reach either a point outside the grid, a decision node, or a node already visited during this path-following iteration. In the latter case, we have a loop; we eliminate it by making the last node a decision node.

ph_color2_4

 


Click here to check out all 30 games 


Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Related

  1. Day 3 Game 3: 30 games in 30 days using Grids  Game 3 is a version of the famous game Ludo....
  2. Day 1 Game 1: 30 games in 30 days using Grids  Game 1 is a riff on Lights Out (a game...
  3. Day 11 Game 11: 30 games in 3 days using Grids  In Game 11, you have to reach the center of...
  4. Day 4 Game 4: 30 games in 30 days using Grids  The aim of Game 4 is to move your player...
  • Permalink
  • Posted: 2 November 2013
  • Tags: hex grid, hexagonal grid, Prims maze generation algorithm, Unity Library, Unity Plugin, unity puzzle game
  • Author: Gamelogic
Recent Posts
  • Tool Documentation Overhaul
  • What is new in Grids Pro 2.3.5
  • What is new in Grids Pro 2.3.2
  • What is new in Abstract Strategy 2.1.1
  • What is new in Words 2.0.2
Categories
  • 30 Games in 30 Days
  • AbstractStrategy
  • Aside
  • Colors
  • Example
  • Extensions
  • General
  • Grids
  • Grids 2
  • Previews
  • Programming
  • Social Media
  • Uncategorized
  • Words
Follow us on Twitter
My Tweets
Meta
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
  • Home
  • Features
  • Blog
  • About
  • 14 Eglin Road, Sunninghill, Johannesburg, South Africa
  • support@gamelogic.co.za
Stay Connected
  • Facebook
  • Google
  • Linkedin
  • Rss
  • Twitter
  • Gamelogic © 2013