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.
Algorithm Help
Re: Algorithm Help
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.
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.
ʕ •ᴥ•ʔ
Re: Algorithm Help
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.
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.
There are 10 types of people that understand binary.
Those that do, and those that don't.
Re: Algorithm Help
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
Re: Algorithm Help
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