The purpose of this project is to create a pac-man game but with a 3D environment. All of the basic rules of pac man will apply, but the game will be in 3-dimensions. The characters and objects in the world will be composed of 3D objects such as spheres, cubes and cylinders. The player will be able to move their pac man character around in the world in the same fashion as the original Toru Iwatani classic game. PacMan is a Japaneese game and was originally developed in Japan. The name came from the Japaneese words "paku-paku" which means "eat-eat". When the game was originally introduced to the USA it became a quick success, and an instant classic.
The Goals of this project are as follows: Create a nice looking translation of the original pac-man game, from 2-D to 3-D. As described above, the characters, world, and objects in the world will be constructed from 3D objects. The user will be able to control and interact with these objects. The enemies or ghosts, in this game will be controlled by an implementation of the BFS shortest path finding algorithm. The ghosts will find the shortest, and most scary path to the players current position. The ghosts will also run away from the player when the player consumes a 'power pellet. This renders the ghosts a cowardly blue color indicating they are vulnerable to be eaten by the player. Depending on how accurately this artificial intelligence for the enemies works, the enemies will eithe be dummed down using a less effective algorithm, or an algorithm better than BFS will be implemented. Other goals of this project will be extras such as particle system fireworks when the player wins the game, and nice overall animation of the world and the characters interacting therin.
Movement: -The player moves with the up, down, left, right arrows. -Backspace stops the player from moving. -Spacebar jumps.
Difficulty: - Page Up and Page Dwon increase/decrease the difficulty respectively. The difficulty of the game is based on the distance of the player from each ghost. By doing thins, the ghosts will be able to attack the player using the BFS shortest path algorithm, based on their idvidual distances.
Camera: - Home and End zoom in and out on the player respectively. - The '-' and '=' keys move the camera further and closer to the player. - The delete key toggles between first person and third person views of the action. Once in first person view, the player can switch between watching from the ghosts point os view or the player. To watch from a ghost, press the number keys: 1 - # of ghosts, and you will get a unique view of the game. Press 0 to get back to the players view.
The Details:
As mentioned above, this program implements the BFS shortest path algorithm for each ghost to track down the player. They way this part of the program works is once the world objects are placed, construct a graph that corresponds to where the walls are/ are not loacted in the world; then each time the player crosses a new vertex (Ie whole number grid location) update the end point of the BFS algoritm for each ghost, then re-calculate a new shortest path to the player. The player has the option to turn this algorithm off by leaving the difficulty at the default 0. This will also significantly decrease the amount of calculations per frame since new BFS trees wont have to dynamically be created at nearly every instant for every character. The way the ghost take advantage of this pathfinding algorithm is that each ghost maintains a linked list of nodes to travers to get to the player. Once the player is a certain distance away, the ghosts will follow this path to the player. If the ghosts are out of range, then they wander around until the player is within range. The BFS algorithm is also turned off whenever the player eates a 'power pellet'. This is a larger than normal pellet object in the map which once run into by the player, renders the ghosts vulnerable to the player. In this state the ghots flash blue and white to signify that they can be eaten. Once eaten the ghosts bodies are not drawn (only their eyes wander around to represent their location), and they continue wandering the map as normal, but can neither harm nor be harmed by the player. After a few seconds, the ghosts are revived and continue theyre motion. Most of the characters are rendered using simple quadric objects, but since the player has to be allowed to open and close his mouth, the pac-man character is hand constructed using polar coordinates to place all of the triangles on his body. Also to get the lighting to look correct, every triangle has a new normal vector calculated ever time it's drawn. Having objects in the world is nice, but How do the characters interact? I apply collision detection between the players, the ghosts, the food pellets on the ground, and the walls of the world. The game is smart enough to detect when a food pellet should be eaten, a player should be hurt, the player should eat a ghost, or a character can not move through a wall. Since the player is allowed to jump, and it might be possible for them to jump over a wall, and out of the world, the position of the character is constantly checked to ensure they are inside the map at all times. Other details such as the bobbing motion of the power pellets, the dirrection that each player is facing, and the eating motion of the main character are all nice additions to the animation of the scene. The texture mapping of the sky, floor, and players' menu also add to the overall quality of the scene. To keep all of this runing smoothly, The animation is based on the clock time. The clock time keeps track of things such as time between frames, time that player last ate a power pellet, time that each ghost was eaten, and speed at which the animation should be rendered.
The Screen Shots:
The Timeline:
first: Set up the world that the game will reside in. This includes setting up boundaries, and object placement operations. second: Set up object models. This phase will be to create and tweak the players' character, the enemies model designs, and other objects that will be implemented in the game. third: Set up the player interface. Once all of the above are created, then its time to work on how the player will interact with the world. Things such as controlls, and current states of the objects will be implemented. This includes checking if things are 'alive' or not. depending on the state of objects in the world, they will either be drawn differently, or not drawn at all. Fourth: Implement the BFS algorithm for the ghosts. Once the world, controlls, and objects are created, it is time to give life to the animated enemies. This algorithm will determine the paths taken of the different ghosts towards their goal: the player! Fifth: Implement different view points. The user will be able to toggle between different viewing locations. ie: The view from a ghost, the view from the player, or the view from above the maze.