Jump to content


Photo

Generate and solve a labyrinth of any size


  • Please log in to reply
7 replies to this topic

#1 Davve

Davve

    GMC Member

  • GMC Member
  • 4091 posts
  • Version:GM:Studio

Posted 05 April 2011 - 11:37 PM

I got bored and decided to see how compact I could make a maze generation and solving script, and here's the result. smile.gif It generates a labyrinth of any size (not everything at once, it's more fun this way). Once generated, you can also place down a goal anywhere and the game will find it (eventually). Feel free do mess around with the code but do not claim it as your own if you decide to make anything out of this.

Download

Controls:
 

  • R to generate a new maze
  • S to set the seed of the maze generator, the same seed results with the exact same maze.
  • Left click to place the goal
  • Space to start/stop solving


WMAIc.png

DIcXl.png


Edited by Davve, 18 October 2015 - 02:15 PM.

  • 2

#2 OldSkoolGamer

OldSkoolGamer

    GMC Member

  • GMC Member
  • 128 posts
  • Version:GM:Studio

Posted 06 April 2011 - 12:55 AM

Looks good & does what it says. Only a few changes to make this "usable" as you said, all in all very well done and compact.
  • 0

#3 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 06 April 2011 - 02:19 AM

I would suggest longer dead ends...
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#4 Davve

Davve

    GMC Member

  • GMC Member
  • 4091 posts
  • Version:GM:Studio

Posted 06 April 2011 - 05:41 PM

Updated!

  • The generation is more random, it no longer sticks to the edges (leading to longer dead-ends like icuurd wanted) :D
  • You can now place down a goal and the game will walk through the maze and find it. It also displays the time it took to reach it.
  • More comments in the code.
  • More color schemes.

  • 0

#5 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 06 April 2011 - 06:04 PM

Now THAT is a MAZE ing
  • 1

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#6 OldSkoolGamer

OldSkoolGamer

    GMC Member

  • GMC Member
  • 128 posts
  • Version:GM:Studio

Posted 08 April 2011 - 01:54 AM

This reminds me of Maze Craze on the Atari2600 or the built-in Maze game on the Sega Master System (yes, I'm old). Anyways, loving it.
  • 0

#7 whoisit

whoisit

    Always Learning

  • New Member
  • 242 posts
  • Version:GM8

Posted 09 April 2011 - 02:58 PM

Nice one Davve, not sure yet how I would use it but it's always there for when something comes to mind.
  • 0
Need to share your GM creations with others?
Want some help and need to upload some code or an image?
then try Dropbox a 2GB account is free! Click Here


Need more help? why not visit the Master Game Community

#8 Davve

Davve

    GMC Member

  • GMC Member
  • 4091 posts
  • Version:GM:Studio

Posted 09 April 2011 - 04:55 PM

Quick update!

  • The solving AI now works towards the bottom-right corner because the goal is usually placed there.
  • You can now set the seed of the labyrinth generating by pressing S. The same seed results with the exact same labyrinth (and the same colors, woo!)
  • The generating and solving is now 2 times as fast, you can change this to anything you want, such as 100 times as fast. :)

Edited by Davve, 09 April 2011 - 04:55 PM.

  • 0