Lab 1c - PacMania

Due: Sunday, Dec 6th 2020, 23:59

Start Early!!!

Individual Effort:
No team participation is really encouraged in the case of the homework or the labs.
You're are not allowed to use any libraries or extra code except gl-matrix, webgl-utils.js and some helper functions in order to initialize WebGL / load shaders. Especially Three.js is not allowed! If you're not sure or want to use some library, ask the teaching assistants before.


In this lab, you should recreate aspects from the 1987 videogame “PacMania”.

While it’s certainly helpful to watch a video of this game (like, please keep in mind that the focus of this assignment is on computer graphical aspects!
The lab is separated into 4 different parts, namely foundations, graphical aspects, gaming aspects and advanced gaming aspects. Foundations have to be solved before you can move on to the other aspects!


Create a labyrinth (not too sophisticated, but also not too simple) with a ground plane and a yellow ball that can be moved around on top of that plane. [ 25% ]
  • The ball can be moved using the arrow keys on the keyboard
  • Note: no object-intersection testing with the walls necessary at this stage, the ball can be moved through walls
  • Phong shading and lighting similar to the requirements in lab 1b are expected in this lab to see the structure of the the ball and possible details of the labyrinth
    • The light should be positioned in a way so that you can clearly identify the 3D-structure of the scene
    • We leave it up to you what kind of light (point light at a certain position or directional light at infinity) you are using

Exchange the ball for an animated Pacman which has eyes and opens and closes its mouth continuously. [ 25% ]
  • The eyes can not be static, but have to move according to the opening and closing of the mouth
  • Pacman has to turn (continuously) into and face in the direction of the movement
  • No specific design inside the mouth required (like having a tongue or anything alike)


Create a shear-view. [ 10% ]
  • It should look similar to the video example, but we leave the exact angles up to you

Project a shadow of Pacman (and possibly other objects like walls) on the ground floor [ 10% ]
  • Again, make sure that the light is not coming from above, but from an angle / position where you can see interesting projections
  • Shadow has only to appear on the ground floor, not required on labyrinth walls or something alike
  • Note: the shadows in the original game are behaving very wrong - please don’t recreate this behaviour! Instead, solve this problem using solutions presented in the lectures


Continuous movement (when an arrow is pressed, Pacman runs into this direction until hitting the wall or another arrow button is pressed). [ 2.5% ]

The camera centers on Pacman (the camera moves with Pacman so he stays at the center of the screen). [ 2.5% ]

Make the walls “solid” (Pacman is not able to walk through walls anymore). [ 2.5% ]
  • This can be achieved through object intersection tests or position based tests or … there are many ways to implement this, we leave the details up to you

Put little dots to eat for Pacman on empty tiles in the labyrinth. [ 2.5% ]
  • When he moves over them, he “eats" them and they disappear
  • When all dots are eaten, the game should (at least) restart from the beginning

Make Pacman jump when hitting the spacebar. [ 5% ]
  • Doesn’t have to follow physical laws, but it should at least resemble some kind of jump behaviour
    • We recommend using a sine function to model this in a simple way, but any function that decreases its speed towards the top and increases on the way down is generally allowed and possible.
  • The spacebar must not be held the entire time of the jump (pressed once, the jump is performed until its very end)
  • If Pacman is moving and jumping at the same time, the motion has to continue (jumping is not interrupting directional movement)
  • Note: when Pacman jumps, he can not eat the dots from the the floor (they remain when Pacman jumps over them)
  • Note: In the original game, Pacman can not jump over walls, but this constraint is not required. We leave it up to you if Pacman can jump over a wall or stops mid air when trying to do so.

Create at least two enemy ghosts. [ 15% ]
  • They should be modelled after the ghosts from the game, but at least they should have have a round head, a torso and some kind of eyes
  • They can wander the labyrinth randomly, they don’t have to seek or follow Pacman
    • Movement has to be continuous though, meaning that the ghost moves straight until hitting a wall
  • They do have to interact with Pacman
    • On interaction with Pacman, the game should at least freeze for a couple seconds (to signal the end of the game) and then restart from the beginning

Additional / more fun stuff

More game-like additions. [ 5% ]
  • Any addition, that adds to a more advanced game-like experience (counting points, having lives, music and sound-FX, …) will be awarded with up to 15%
  • If you have any ideas and you are unsure about it, please ask us beforehand

Create a special state for enemies [ 10% ]-
  • When Pacman eats a 'big ball', the ghosts change into a state in which Pacman can eat them.
  • This state is only temporary, after the certain timelapse they have to go back to their original state in which they are dangerous to pacman.
  • While in this special state, the ghosts have interact with Pacman in a different way
    • On interaction with Pacman, the ghosts have at the very least to disappear from the screen ('getting eaten') and respawn a couple seconds later.