Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
August 22, 2018
arrowPress Releases
  • Editor-In-Chief:
    Kris Graft
  • Editor:
    Alex Wawro
  • Contributors:
    Chris Kerr
    Alissa McAloon
    Emma Kidwell
    Bryant Francis
    Katherine Cross
  • Advertising:
    Libby Kruse






If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

Mazes' hidden beauty

by Laurent Victorino on 12/02/14 02:07:00 pm   Featured Blogs

9 comments Share on Twitter    RSS

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

As a game programmer I work on very cool things every day. Sometimes it’s all about optimization and technical stuff, some other times it’s about user interfaces. But there is something that appeared mysterious, although basic, to me, that I didn’t know until last week: Maze Generators.

I always saw maze generators as a topic you could approach when you study programming or game programming, even if it wasn’t the case for me… In the back of my head I always thought every game programmer had already programmed a maze generator… every game programmer except me.
But I always liked mazes. Not only for the challenge they propose but more for the intrinsic beauty they offer. It’s (often) all about geometric shapes following a complex path, so complex that it’s confusing for the eye. Parallel and geometric but confusing, the maze paradox.

Last week-end I decided it would be cool for my programming culture to make my own personal maze generator and learn how this beauty works from the inside.

I won’t talk too much about algorithm because it’s pretty easy and you can find good literature everywhere on the Internet. But there is something that blew my mind when I started working on my own generator. The only real important thing to realize, the only one that is not necessarily obvious when you have never worked on maze before is: mazes are graphs.

They are often displayed as a grid, but their very nature is more about graphs. Every cell is a node which is connected (or not) to other nodes. In a classical 2D maze a node can be connected to up to four other nodes (west, north, east, south), but in the real world the sky is the limit.

So I quickly managed to create my first fully random maze. And it was aMAZEing (sorry for that)! But for debug purposes I needed to know the “walk distance” (the number of steps you need to take from the maze entry to reach a specific node) of every nodes. It’s a simple increment, nothing too hard to implement: every time you enter an unvisited node, you increment the walk distance (don’t forget to decrement when you go back to try other paths). But displaying hundreds of walk distances on screen for debug wasn’t very usable, that’s why I converted the walk distance into color. As the minimum walk distance will always be 0, you just have to store the maximum walk distance, and you’ll have everything you need to make a linear interpolation between two colors.

And… the magic happened (my mind exploded).

This is what I call the hidden beauty of mazes. We always see mazes displayed as black and white, surely because it’s easier to read and play, but adding colors can change everything. From a simple game to art.

After that I made a couple of tests on bigger mazes.

And then I stopped rendering walls. I like to think this is the art of chaos (as everything, including colors, is random).

I’ve tried coloring different shapes of mazes, but the flat one is, to me, the best way to visualize the color.

Finally, after all this beauty, I remembered that mazes are graphs.

With that in mind I wondered what would be possible to do using an external texture to generate the initial graph.

This is how I discovered mazes hidden beauty: the walk distance. I hope it gives you game ideas :)


Related Jobs

Unknown Worlds Entertainment, Inc.
Unknown Worlds Entertainment, Inc. — San Francisco, California, United States
[08.21.18]

Visual FX Artist
Unknown Worlds Entertainment, Inc.
Unknown Worlds Entertainment, Inc. — San Francisco, California, United States
[08.21.18]

Graphics programmer - shader expert
Blockade Games
Blockade Games — Austin, Texas, United States
[08.21.18]

Lead Game Server Engineer
Roblox
Roblox — San Mateo, California, United States
[08.21.18]

Senior Engineering Director - Game Engine





Loading Comments

loader image