Algorithm Help

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
codinitup
Posts: 112
Joined: June 27th, 2012, 7:43 am

Algorithm Help

Post by codinitup » December 1st, 2012, 7:55 am

Hey guys,
I came across a problem while trying to remake a Pacman game. While I was getting ready to draw the walls I realized that every level needed to have a different grid/layout design. Does anybody know of any algorithms that will do this, or do you guys have any advice on how I can create one. I also am going to have powerups that will give the player abilities and the ghosts that will attack the pacman player, does it matter what size the sprites are for the algorithm to work? I assume that it does so that you can know the wall width or something like that, but if it does matter, most likely about 32 * 32 would be my guess for the players / ghosts. I was thinking something more along the lines of 10 - 12 * 10 - 12 for the powerups and the balls / gems to collect to complete the level.
MOOOOOO

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Algorithm Help

Post by LuX » December 1st, 2012, 10:26 am

What do you mean by an algorithm?

I think you should just make a list of walls that form the grid. Like store all corner points and combine them with lines and use these as the base for walls. I doubt anyone wants to do all the work for you.
ʕ •ᴥ•ʔ

Musi
Posts: 106
Joined: November 25th, 2012, 1:06 am

Re: Algorithm Help

Post by Musi » December 1st, 2012, 6:14 pm

I found this page that might be a solution: Link

Basically It says that for half of the screen, generate walls along the outside edges of the screen, then put a path just inside of these walls. Add a box in the middle for the ghosts. Then for every remaining cell, generate a random maze using the Depth-First algorithm. To remove dead ends check every path cell to see if it only has one neighboring cell and if so, check to see if it can be connected to another path. If it can, remove the wall between them, if it can't, change the dead end to a wall. Finally mirror this side of the screen to the other.

I've never done this before either, bit it sounds like it would work.
Musi

There are 10 types of people that understand binary.
Those that do, and those that don't.

User avatar
codinitup
Posts: 112
Joined: June 27th, 2012, 7:43 am

Re: Algorithm Help

Post by codinitup » December 1st, 2012, 8:15 pm

Well thanks for the help guys, but I decided that it would be better if I just got some sprite sheets and went from there.
MOOOOOO

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Algorithm Help

Post by chili » December 9th, 2012, 9:51 am

Procedural level generation is a topic that interests me. It's basically essential for any roguelike. Maybe someday we can cover it in the series... One day...
Chili

Post Reply