Engineering

Crazy Drivers

Development of a video game using DE10-Nano boards and MTL screens

When
Feb. 2021 - Jun. 2021
Role
University project
  • Verilog
  • C
  • FPGA
  • RTOS
  • DE10-Nano
The Crazy Drivers title screen, with a pixel-art city skyline behind a New Game button
The title screen.

This project targeted the execution of a multiplayer video game onto DE10-Nano boards.

Setup

The setup was the following: 2 DE10 boards, with each its MTL touch screen and linked by an Ethernet connection. The boards contain a Cyclone V (dual Cortex-A9 + 110k LEs of reconfigurable logic) and numerous I/Os like SPI, UART, HDMI, GPIO, etc. They also embedded an acceleration sensor. The boards were configured with mAbassi, a real-time OS that simplifies the task scheduling for the programmer. With these devices we were supposed to think of a game and implement it using C and the FPGA portion of the board (coded in Verilog).

The rules

We came up with the idea of a car chasing game, where 2 taxis would battle for winning clients. The rules were simple:

  1. A client would randomly appear on the map. Both drivers would run to get to him.
  2. The first taxi to hit the client catches him and must now deliver him to his destination. This destination is not shown to the driver not carrying the client.
  3. The goal of this last player is to hit the taxi containing the client so that the client leaves the cab in anger.
  4. The G-sensor was used as a nitro boost.
  5. If the cab holding the client makes it to the flag, he wins points.

Demonstration

Click the thumbnail below to see a short demonstration of the beta version of the game.

Demonstration of Crazy Drivers
A short demo of the beta — opens on YouTube in a new tab.

How it works

The following figure shows the top-level organization of the game. Each box is a mAbassi task, i.e. a proto-thread with a given task to execute. To implement the timer we used a PIO block embedded in the FPGA logic. The Ethernet connection is divided in two functions, one that sends and the other that receives.

Top-level task organization of the game
Top-level organization — each box is a mAbassi task.

To optimize performances, we used different strategies like dual frame processing, where data for the next image is processed while the current one is displayed.

Dual-frame processing pipeline
Dual-frame processing: the next image is prepared while the current one is shown.

To detect the collisions between the players and between the cars and the walls, we used a mask.

Collision handling using a mask
Collision detection via a mask.