CSC455: Homework 3


In this homework you will use a fundamental game AI concept: state machines.

There is a guard, who stands at the corner of a rectangular building, with a field of view (FOV) of 120 degrees. The guard slowly rotates his head first from left to right, then from right to left, so that he covers the entire area around the building (270 degrees).

The user controls the avatar with the arrow keys. The avatar's max speed is slightly higher than that of the guard.

If the user's avatar enters the guard's FOV, the guard starts chasing the user. If the guard catches the user, the game is over. If the user exits the guard's FOV, the guard returns to his original position.

The game can be as graphically rich or poor as you decide. I will be happy with simple 2D outlines, if the algorithms are fine. The following must be visible: the building, the guard and the player character; the orientation of both characters; the FOV of the guard. You can have a circle with a "nose" sticking out to show orientation, for example, and a triangle in front of the circle to show the FOV.

Submit your sources to the dropbox before the deadline. You will also have to demonstrate your working homework to me within a week after the deadline.