Creating a maze

Hi i’m quite new to java and was just wondering whats the best way about creating a maze???

Any help would be much appreciated.

I suppose it depends on the type of view you want of a maze? Some options are:

  1. From above
  2. Isometric
  3. 2.5 d
  4. Pure 3D rendering

And I guess what you want to do in the maze…

Some more details would be helpful :slight_smile:

Kev

Just something simple like a above view.
I suppose something like pacman.

I suggest you check out GAGE then… its a simple 2d sprite library. Handles things like accelerated graphics and map maintainance for you…

http://java.dnsalias.com/

Alternaively, you could probably implement something as simple as pacman just using java.awt.Image and java.awt.Graphics in Panels.

You’ll probably want an array of sometype to store your map, which you convert into sprites while rendering.

Were you think scrolling or not scrolling? If you were going to go for scrolling map then I’d recommend checking out GAGE even more…

Kev

PS. jbanes, I claim my “I advertised GAGE” t-shirt.

No scrolling is needed. Using the toolkits provided will be fine.
i guess my main problem was really with the actual maze array. How do you actual go about that.
I’ve seen one where the guy places 1’s and 0’s in the array to specify if there was a block there are not. But i’m sure there’s a much better why of doing that.

No, using an array of ints is essentially correct. If you look at the GAGE Map implementation, you’ll find that it works by assigning a number to each image to use as a block in the maze. You then procede to fill the map array with those numbers and voila, you have a map. Check out the GAGE2D example (in the zip file) or the Shooter example (bit more complex) to see how effective this method can be.

Oh, and just in case you’re interested in generating mazes, here’s a link for you:

http://www.astrolog.org/labyrnth/algrithm.htm

Jerason

P.S. Hey Kev, I’m afraid I’m all out of t-shirts right now. How about some toilet paper with source code on it? :wink:

thanks :slight_smile: