Zer0
Citizen
Posts: 59
Joined: Sat Oct 06, 2012 9:55 am
Location: Sweden
Contact:

Sorry for double posting.

Here is three more examples of mazes.

One with octagons, one with several layers and one with 10 different maze generation algorithms.
Attachments
OctagonMaze.love
Welcome to the OCTAGON.
mutliLayer.love
Several layers
JustMazes.love
10 maze algorithms
If you can't fix it, Kill it with fire. ( Preferably before it lays eggs. )

Germanunkol
Party member
Posts: 711
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Yay for the multilayer one! That looks pretty awesome
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de

Ref
Party member
Posts: 690
Joined: Wed May 02, 2012 11:05 pm

You guys are creating some very nice wall paper but I was wondering if you had any scripts that would permit specifying a starting position (like lower left corner) and an objective position (like upper right corner or center screen) and maze grid size - something used for game scripts?

Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Yeah I was thinking the same thing
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping

Zer0
Citizen
Posts: 59
Joined: Sat Oct 06, 2012 9:55 am
Location: Sweden
Contact:

Ref wrote:You guys are creating some very nice wall paper but I was wondering if you had any scripts that would permit specifying a starting position (like lower left corner) and an objective position (like upper right corner or center screen) and maze grid size - something used for game scripts?
You could just slightly modify the recursive backtracker to have a higher chance of moving towards the finish point and have it start at the start point.
Or you could make your own recursive backtracker, it really isn't that hard.

Code: Select all

--Backtracker
path={math.random(1,width),math.random(1,height)}
map = newMap()
end

function love.update(dt)
if #path > 0 then
local x,y = path[#path][1],path[#path][2]
local t = {}
-- Add all the positions it CAN walk to from x and y
if #t > 0 then -- It can walk somewhere
local c = t[math.random(1,#t)]
merge(x,y,c.x,c.y) -- Merge the points
path[#path+1] = {c.x,c.y} -- Add the new point to the path
else
path[#path] = nil -- Remove the part in the path that could no walk anywhere
end
else
print('DONE')
end
end

function love.draw()
love.graphics.draw( -- draw the map
end
thats what the actual algorithm looks like ( if not optimised ) but should not be too hard to make.

and as I have not seen anyone store maps the way I do here is a quick explanation:

using a texture atlas / tile sheet a table storing the different quads from 1 to 15. ( using 0 most of the time )
left,up,right,down = 1,2,4,8 -- power of two's
is just quad[left] and therefore only goes left
and likewise quad[left+up+down] goes left, up and down
they can therefore be quickly added to a map where 0 is empty by doing
map[y][x] = map[y][x] + (left, up, right or down)
which is used instead of map[y][x].(left, up, right or down) = true

I use this method because:
1) its just the quad index stored in the map.
2) it take up less ram since less tables are needed.

the drawbacks are:
1) may be harder to get a hang on at first.

thats a quick summary of it, if you want a more complete explanation please tell me so.
If you can't fix it, Kill it with fire. ( Preferably before it lays eggs. )

davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

davisdude used Max Revive!
I figured I would try out making a maze to test my programming abilities.
You can check out my progress here.
It generates a 80*60 tile maze currently, but you can play around with the configurations if you want to.

It takes around 3 minutes to fully complete.
Take a peek at the source code if you want. I tried to make it pretty readable, but I have a nasty habit of not commenting my code enough.
Attachments
Maze.love
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim

Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Finally, a maze with a start and a finish
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping

davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Confession: I actually added the end with MS Paint.
I tried a 200 * 150 grid. Here are the results:

Green is the start, yellow is the end. Working on making it automatically choose an end.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim

Germanunkol
Party member
Posts: 711
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Shame on you. Not for adding the end manually, but for using ms (paint)!

I would NOT want to have to find the end in that last maze... that's crazy
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de

Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you