3D Monster Maze
This is a project I created using the Unity game engine. In this game, the player is placed inside a maze with a dinosaur. There is a door for the player to escape through, but it is locked. To unlock the door, the player must first find a key that is randomly placed in the maze at initialization. To create this project, I had to learn how to import assets, use prefabs, and write scripts for game objects using Javascript.
A difficulty I encountered in writing this game was how to make the dinosaur pursue the player, but not "cut corners" and get stuck in walls. This was done by adding invisible way points at the hallway intersections. If the dinosaur can see the player, it heads toward him. If the dinosaur loses sight of the player, it will proceed to closest way point to the player when the player was last scene.
Determining light-of-sight from the player to the dinosaur was also a problem. I used ray casting, but still had issues. It turned out that if you cast a ray from an object that has a collider attached to it, the ray will always hits the collider and stop (the ray never gets beyond the object casting it). I solved this problem by casting a ray from from the player (which does not have a collider to the dinosaur rather than the other way around). I was able figure out what was going on by using the Debug.DrawRay() function so I could see what the ray cast was actually doing.
This game is actually a remake of a game from 1981 called "3D Monster Maze" which was written for the Sinclair ZX81.
A difficulty I encountered in writing this game was how to make the dinosaur pursue the player, but not "cut corners" and get stuck in walls. This was done by adding invisible way points at the hallway intersections. If the dinosaur can see the player, it heads toward him. If the dinosaur loses sight of the player, it will proceed to closest way point to the player when the player was last scene.
Determining light-of-sight from the player to the dinosaur was also a problem. I used ray casting, but still had issues. It turned out that if you cast a ray from an object that has a collider attached to it, the ray will always hits the collider and stop (the ray never gets beyond the object casting it). I solved this problem by casting a ray from from the player (which does not have a collider to the dinosaur rather than the other way around). I was able figure out what was going on by using the Debug.DrawRay() function so I could see what the ray cast was actually doing.
This game is actually a remake of a game from 1981 called "3D Monster Maze" which was written for the Sinclair ZX81.