Skip to content

FlenderGit/python-mazecasting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MazeCasting

MazeCasting is a project to render a maze in 3D.

Start the project

To play the game, launch the main.py file. Use Z,Q,S,D to move around the maze.

Informations

To achieve this result, the program performs the following actions.

  1. Create a maze with class : I used the binary tree method to randomly break walls and generate the maze. (Methode : utils.arbreBinaire(maze:Maze)->Maze ) Link : http://weblog.jamisbuck.org/2011/2/1/maze-generation-binary-tree-algorithm

Result:

+---+---+---+---+---+  
|       |       |   |  
+---+   +---+   +   +  
|   |           |   |  
+   +---+---+   +   +  
|       |           |  
+---+   +---+---+   +  
|                   |  
+---+---+---+---+   +  
|                   |  
+---+---+---+---+---+
  1. Convert this maze to bitmap Construct bitmap using maze's data. True mean wall, and False is empty. (Methode : utils.constructBitMap(maze:Maze)->list )

Result:

[True , True , True , True , True , True , True , True , True , True , True]
[True , False, False, False, True , False, True , False, True , False, True]
[True , True , True , False, True , False, True , False, True , False, True]
[True , False, False, False, False, False, False, False, False, False, True]
[True , True , True , True , True , True , True , True , True , False, True]
[True , False, False, False, False, False, False, False, True , False, True]
[True , True , True , True , True , True , True , False, True , False, True]
[True , False, True , False, True , False, True , False, True , False, True]
[True , False, True , False, True , False, True , False, True , False, True]
[True , False, False, False, False, False, False, False, False, False, True]
[True , True , True , True , True , True , True , True , True , True , True]
  1. Add movements to player Change x,y and direction of player using inputs.

Result:

Vous êtes en  0.5 0.5 . Direction :  E
Dans quelle direction veux-tu aller ? (Z,Q,S,D)
  1. Add Raycasting Add an optimized raycasting algorithm with the DDA method and let the magic happen. (Methode : utils.print3DMaze(bitmap:list,coord:tuple,orientation:str)->None )
WWMMMMMM####uuuunnn                                                               nnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxx                                                           xxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxr                                                       rxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjj                                                 jjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjft                                             tfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/                                         /ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/                                       |\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/                                     )(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/                                   }1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------                         ?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<                     <+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                 :!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                .:!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                .:!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                .:!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                .:!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                .:!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                .:!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                .:!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<!:                 :!<+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------+<                     <+?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/--------                         ?[}1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/                                   }1)(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/                                     )(|\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/                                       |\/ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjftt/                                         /ttfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjjft                                             tfjjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxrrjj                                                 jjrrxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxxxr                                                       rxxxnnnuuuu####MMMMMMW
WWMMMMMM####uuuunnnxx                                                           xxnnnuuuu####MMMMMMW

About

MazeCasting is a project to render a maze in 3D

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages