The animal module defines the behavior of creatures. They always move in the direction they are facing. As time passes, they store energy for sprinting; if a sprint is triggered, they use up this energy until they need to recharge. They take control inputs for heading and for burst (start sprinting). They output x position, y position, type of animal, heading, and whether sprinting is charged. Changes to position require a gameplay clock; for simplicity, we used the 75 Hz vsync clock already calculated for the VGA output.

Internally, the direction each animal faces is controlled by a 4-bit heading register that allows for 16 different directions on screen; positive x is 0, and positive is in the counter-clockwise direction. This size gives more granularity than a 4-direction pacmanesque approach. There are two ways to change the heading. For the human-controlled animals, the delta_heading port is used. Each game clock, the internal heading variable is changed by this amount, which allows the buttons to act rather like a steering wheel. For the AI control, initial versions using delta_heading proved somewhat buggy so in interest of time, a direct override of the heading was also created.

Position requires another two registers for x and y. To cover the width of the screen (640 pixels), the x-register must be at least 10 bits (we chose to make y the same size for consistency). However, at slower speeds, rounding errors become significant when traveling at a diagonal if values are computed on a whole-pixel basis. To correct for this factor, the position registers have an extra 4 bits of precision internally, allowing more precise movement at slower speeds; the output x and y are the ten most significant bits of these registers.

The position of the animals updates each game_clock. The actual change to position is calculated by a script-generated case statement. This allows the complicated trigonometry functions to be calculated by the computer that generates the code rather than needing a massive look-up table on the FPGA. The python script that does this allows the user to generate a new behavior based on a normal speed, a burst speed, heading granularity, and the number of bits precision per pixel.