View the 5 min. code overview here!
Github Repo: https://github.com/adymchenko/FPGAPolarCoordGame
Inspiration
The ultimate goal of my project was to learn Verilog, a hardware description language used for modeling electronic systems. A common introductory project for learning Verilog is to program a version of Pong, but I wanted to try something different: a game that teaches the player how to plot polar coordinates.
What it does
The program displays a traveling point and its respective set of polar coordinates. The player's goal is to move the cursor using two paddle controllers to the respective point in order to better understand how to plot them.
This is the training mode of the game - ideally, there would have been a test mode in which the player is given a set of coordinates without them being plotted, and is tasked with navigating the cursor to those coordinates to score points, but I ran out of time implementing it.
How I built it
This project runs on a low-cost FPGA (GOWIN GW1N-1) & was programmed in Verilog using its accompanying editor.
Challenges I ran into
Memory consumption. The FPGA I used was limited to 72k bits(!) of SRAM, making it impossible to store a bitmap image representing a polar grid, and limited the font capacity. The font used here is made up of 13 characters (10 digits, R, theta, and a space) that are each initialized using 8x16 binary files, which generate the hexadecimal file seen in the attached photos.
Display timing. Here, video is generated scanning left to right, line by line. Each object displayed isn't just generated using 'draw X image at X,Y coordinates,' but rather coded as a function that outputs 0 or 1 for a given pixel coordinate, and displaying each coordinate must be timed using the clock. Coming from a software background, it was sometimes difficult to conceptualize parallel/clock-based timing versus software's traditional sequential timing.
Working in binary/hexadecimal. Storing numbers as floating point values on an FPGA is costly in terms of memory. Therefore, each target polar coordinate is stored as hexadecimal, and many other values used in this code are stored in binary.
Accomplishments that we're proud of/what we learned
Learning how to use Verilog! Even if the actual 'game' aspect isn't quite complete, I'm proud of starting essentially from scratch with what I viewed as an arcane language and generating some kind of meaningful displayed info.
What's next for FPGA-Based Polar Coord Game
- Collision response: lighting the FPGA's LED when a player successfully navigates to a polar coordinate pair.
- Fixing polar coords: the horizontal sync isn't quite correct on the current target coordinate path, and the coordinates aren't necessarily fully proportional. This needs to be tweaked.
- Test mode: described above.
Built With
- fpga
- verilog


Log in or sign up for Devpost to join the conversation.