Programming 2D Games

The official forum for "Programming 2D Games" the book by: Charles Kelly

It is currently Sun Sep 22, 2019 4:38 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: A maze generator
PostPosted: Thu Oct 23, 2014 9:52 pm 
Offline

Joined: Sat Oct 12, 2013 4:48 pm
Posts: 44
Anyone know how to generate a maze randomly within charles kellys engine??


Top
 Profile  
Reply with quote  
 Post subject: Re: A maze generator
PostPosted: Fri Oct 24, 2014 12:39 pm 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 553
There are many web resources that have good algorithms for maze generation. Here is one example:
http://en.wikipedia.org/wiki/Maze_generation_algorithm

Some of my students generated mazes in their games. You can check them out here:
http://www.monroeccc.edu/ckelly/Courses ... ojects.htm

Some of my students don't comment their code. I just want to make it clear that I am constantly telling them to add comments and they continue to ignore me. I guess some lessons just need to be learned the hard way. :(

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
 Post subject: Re: A maze generator
PostPosted: Mon Nov 03, 2014 6:59 pm 
Offline

Joined: Sat Oct 12, 2013 4:48 pm
Posts: 44
Lol, your students games are completely unreadable to me, I have been spending countless of time trying to study and understand them but I simply do not get it at all. Some of them still has your comments so you can tell they just rewrote some of your class without even thinking about the comments. bad!!! very bad!!!

Most code samples/examples and explanations you get from other sources or websites just confuses, I am not able to take an algorythm and translate it into c++

I am hitting a brick wall here:
I need to create simple example of procedural generation, pathfinding(any kind), data serialisation and I also have to demonstrate good memory management but I have no idea how to do that and my course tutors are completely useless!!!!


Top
 Profile  
Reply with quote  
 Post subject: Re: A maze generator
PostPosted: Sat Nov 15, 2014 9:55 am 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 553
I added a Maze generator to the Bonus section of the example programs.

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
 Post subject: Re: A maze generator
PostPosted: Mon Nov 17, 2014 7:17 pm 
Offline

Joined: Sat Oct 12, 2013 4:48 pm
Posts: 44
Thank you very very much for this!!!! This is great stuff and very well explained in the comments just what I needed.

I suppose if i were to use graphic tiles instead of the lines, the method and technique would be the same??

I thank you so much for this and I am very sorry if I ask you to much!!!


Top
 Profile  
Reply with quote  
 Post subject: Re: A maze generator
PostPosted: Tue Nov 18, 2014 1:47 pm 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 553
Each grid in my maze array contains 4 walls. The maze is formed by removing the walls from the appropriate grids. This results in many walls being drawn more than once. Not the most efficient way to render the maze but it was quick to code. I think this maze array structure makes it a little easier to apply to a game because each grid can be treated like a room with 4 walls.

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group