Computer graphics -- 2007-2008 -- info.uvt.ro/Laboratory 8

From Wikiversity
Important! These pages are somehow outdated and it is recommended to consult the newer version at Computer graphics -- 2008-2009 -- info.uvt.ro (by Marc Frâncu).

Quick links: front; laboratories agenda, 1, 2, 3, 4, 5, 6, 7, 8, evaluation, tools, repository.


Assignment[edit]

This assignment will span over the next three weeks, and it will be due on 4th may 2008.

This is the eight assignment, so please commit it to the folder assignment-08.

You will have to implement a simple maze game.

Maze
  • it is a rectangular maze, where each cell could have up to 4 walls, plus the floor and the ceiling;
  • the maze is 16 cells in length, thus 256 cells in total;
  • if a wall is missing, it means that we can travel from the current cell to the neighboring one (in the direction of the missing wall);
  • for two neighboring cells, the common wall must either exist or not for both of them;
  • if a cell does not have a neighbor on a certain direction, then there must be a wall on that direction; (the case of border cells;)
  • when generating the maze we should pay attention as any cell must be accessible from the starting position;
  • any cell must have at least one wall;
  • the walls must be textured with a brick like texture;
  • the floor must be textured with a paving like texture;
  • the ceiling could be left untextured, but with a gray color;
  • for additional information please consult: wikipedia:Maze;
Artifacts
  • inside some of the cells there are objects;
  • the objects are placed in the center of the cell;
  • if the player gets inside a cell with an artifact, this will disappear; (the artifact was collected by the player;)
  • they should be represented as randomly colored spheres;
  • about 10% of the cells should contain an artifact;
Player
  • the player should start from the cell with the position (0, 0) (one of the corners);
  • the player should be allowed to wander through the maze;
  • the camera will be positioned such that it always shows what the player sees, in the center of the cell; (like in a First Person Shooter game;)
  • the player is allowed to turn only in the 4 directions (those perpendicular on the walls);
  • the player is allowed to move in the direction it faces, only if there is no wall in front; and the movement will be to the center of the next cell;
Lights
  • there must be a dim ambiental light;
  • there must be a specular light at the position where the player is;
Commands
  • Left and right keys: turn the player;
  • Up key: allows the player to advance in the direction it is facing;

Bonus points:

  • instead of letting the user move through the maze, you could implement an algorithm that automatically determines the best path (the target being the cell (15, 15)), and moves the player on that path;
  • the camera movement could be implemented smoothly:
    • when turning, it will not turn in one step with 90 degrees, but in smaller steps until it reaches the desired direction;
    • the same for movement, when moving the camera should advance in smaller steps, until it reaches the next cell;
    • while the player is in transition -- turning or moving -- any other commands are ignored;