THE 3D MAZE

advertisement
THE 3D MAZE
RECURSIVE BACKTRACKING MAZE GENERATOR
By:::
Nishan Pantha(528)
Navin Ayer(526)
Pusparaj Bhattarai(532)
Objectives
1. To learn Object Oriented Programming in C++.
2. To use built-in features and functions of C++ in a simple
manner.
3. To learn about the graphical programming using OpenGL.
4. To learn file streaming (create, write, save and read files).
5. To model the real world in programing using OOP.
6. To use 3D graphics to make the program look real and user
friendly as possible.
7. To use the external library and utility…
1. Opengl (Open Graphic Library)
2. GLUT (or freeglut)
3. SOIL (Simple Opengl Image Library )
4. SDL
Introduction
1. Random Maze Generator using Recursive Backtracking
Algorithm .
2. 3D maze simulation .
3. Game is efficient i.e. runs using less memory and processing
.
Existing System
1. Inspired from the algorithm of maze solver and maze
generator.
2. There are several flash game… from which some are
Random maze generator . Till now there are no famous maze
game as far our knowledge.
Methodology
1. The game is designed by employing Object Oriented
Approach of C++ .
2. 3D graphics is done through OpenGL and freeglut(utility) .
3. Window and key events through OpenGL and freeglut .
4. Texture loading through SDL / SOIL .
Application
1. For the gaming lover and puzzle solver……
2. For any age group….since it does not contain any
violence or scary scene ….
3. For people who likes random level than the same
one.
4. 3D gaming instead of 2D gaming experience .
5 .Complex algorithm into simple programmable
code .
Lets take this maze for the description of
the algorithm i.e.
Recursive Backtracking Maze
Generator
The real maze looks like this after
intialization.
Initial position(which
is floor)
Closed(i.e
surrounded
by wall)
Closed(i.e
surrounded
by wall)
No permission to visited the surrounding wall of the whole maze (since they are not
surrounded by walls )
Closed(i.e
surrounded
by wall)
Now this place becomes the
floor i.e. the path between initial
and final for this case….
Closed(i.e
surrounded
by wall)
Lets chose
this(random)(we have
two case jump i.e down
and right)
No permission to visited the surrounding wall of the whole maze (since the wall are not
closed)
Not Closed(i.e not surrounded by wall from
left and down) and for another not
surrounded by wall from left and right
Closed(i.e
surrounded
by wall)
Afer many successive recursion let this condition arrises
No choice but to jump
there
No permission to visited the surrounding wall of the whole maze (since the wall are not
closed)
Not closed(that’s why we jump to next block to
avoid unwanted recursion since there is no
condition for visited block)such that backtracking
can be done(i.e exiting from present recursion to
back….
Again Afer many successive recursion let this condition arrises
No choice but to
backtrack to the
condition where there are
available closed block
No permission to visited the surrounding wall of the whole maze (since the wall are not
closed)
closed
Again Backtraking Occurs
to available condition
Move to available block
No permission to visited the surrounding wall of the whole maze (since the wall are not
closed)
Not closed
Now again backtracking occurs to the
previous condition until there is a
available condition…….
Again After many successive recursion let this final condition arises
No permission to visited the surrounding wall of the whole maze (since the wall are not
closed)
No available condition
so…..backtracking occurs to the initial
condition…..
Now backtracking occurs to the
initial position……After which the
maze is entirely
created….generated…….
No permission to visited the surrounding wall of the whole maze (since the wall are not
closed)
Start Game
New Maze
Maze Size Input
Gaming
Rendering
Main Menu
Instruction
High score
Credits
Exit
End Game
Problem Faced and Solution
1.
2.
3.
4.
To find the algorithm for maze generator .
To change the algorithm into real code.
To convert 2D maze(2D array) into the 3D world.
Collision Detection was the hardest part which was solved
using Axis-Aligned Cubic Collision .
5. Glut is a C library …so glut callbacks function accepts only
the void function pointers…i.e function pointers to an
instance of any class is not accepted by the callbacks.
6. This was solved by creating a bridge/transition class(Engine
class) and an anonymous namespace.
Limitation
1. Maximum size of the size is 35 .. To avoid fps drop…….
2. There is no 2D view of the maze while playing(accepts while
start).
3. There is no 3D model (or animation) in our game.
4. Older version of OpenGL(2.1) which does not support shader
implementation and many more….
Conclusion
1. Making games is fun and we got to know about various
aspects of programming.
2. We learnt about team work and work division
Download