Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    122
  • comments
    121
  • views
    69270

Cripes 2.0: MazeGen fixes/changes

Sign in to follow this  
Twisol

305 views

So far today I've tweaked the MazeGen algorithm a bit, making it remove walls randomly and speeding it up. I still have some optimizations I'd like to try, but it's loading almost immediately now, instead of taking upwards of two seconds.

First, I added a for loop that randomly removes a random amount of walls (between 25 and 30 seems to be perfect). This didn't help much with speed, but it definitely made the maze more fun to run around. Before this change, it was really just one long corridor with the occasional small branch. Now, it's a whole sprawling complex of hallways, junctions, and dead-ends. Awesome.

I also changed how I was storing and handling CornerWalls. On a hunch, I guessed that what was really slowing the generation down was how every CornerWall stored a sprite for every kind of corner wall that could be made. I fixed this by splitting the CornerWall's fifteen sprites into fifteen Corner# entities, each with just one sprite. It sped up immediately! Good thing the other walls (HorizWall and VertWall) only need one frame.

Should I upload a demo so everyone can run around the mazes themselves? It's pretty nifty. ;)
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!