Tanks!

tank_home

Overview

A simplistic version of the 2D tanks webgame, Tanks is a turn based game where two players battle to see which tank is the last one standing. This game was a project done in my digital circuits class with a partner. Tanks was created entireley in verilog to be played on the Nexsy 4 FGPA.

State Machine

The main state machine for the Tanks game is shown below. Note that the telemetry state occurs when the cannon ball is in air.

tanks_sm

My Role

My main role on the project was creating the user interface and the graphics for the game.

User interface

The user interface is shown below on the Nexys 4. The game uses five buttons: two to move left and right, two to rotate the barrel clockwise and counter clockwise, and one to fire. In addition, there are three switches used to adjust the power of each shot. The power is displayed in hex on the right LCD and on the left LCD the amount of distance the player has left to move is displayed. (Each player has a limited number of pixels they can move per turn). In addition, LED's on the board light up to indicate which players turn it is.

nex1

Graphics

The Nexsys 4 displays graphics to a monitor through a VGA port. To display graphics, the Nexys increments through and colorizes each pixel row by row. Various if statements are made to determine which color each specific pixel should be. All of the graphics were created using planes. E.G: If y is less than a value, make it this color between these x-values. Below is an example of some of the math involved for creating the hill and tank graphics.

tank graphics 0
tank graphics 1

Below is a video demonstrating the changing barrel angles. There are 8 barrel angles in total. Each barrel angle has a different sloped line, and length to give an aproximate circular path.

barrel_angle

Text

In order to produce text, one needs to have a bitmap for each letter as shown below. A rom was used that contained the bitmaps of various ascii characters. This allows one to easily print strings of characters across the screen.

ascii_bitmap

Game Play

gameplay