This is the repo for FPGAs final project in Logic Design Laboratory in 2023.
FPGAs is the abbreviation of Family Professional Gaming Application system. In this project, we use two Xilinx Basys 3 Artix-7 educational FPGA. One FPGA will be the main board, which in charge of the main game rendering and system calculation. The other one will be the controller. Players are able to use the controller with two Pmod joystick to control the characters in the game.
The project slides in chinese (zh-tw) can be viewed at here.
The game itself in a turn-based RPG game, players are able to select whether move to the next block or attack the monsters in attack range. All of the damage dealed and taken is random generated by Linear Feedback Shift Register. The health of the selected monster or player is displayed on 7 segment display, and the LEDs indicates the monsters survived. Switches are used for increasing the damage for either monsters or players, and the music volume can be adjusted by the buttons on the board. The final goal of the game is to escape the dungeon by entering the trasnporter.
For controller signal, we use Pmod signal to receive the input from player. In order to have smooth control experience, we design a finite state machine for controller signal so the controller will not act too sensitive, and the controller can still recognize long push and normal short push for different types of cursor movement. The signal of the controller in passed to the main board, and processed with a one pulse transformation.
The music of the game is played with pre-written frequency scripts. The frequency of different notes is passed to the integrated music module to play different pitch of sound with both left and right channel. The game is controlled by a scene finite state machine to change current scene according to player's decision. The main game engine is also controlled by another finite state machine. This FSM will record the position of player, the decision made by player, statistics to all objects in the game, and the character who the current turn belongs.
The graphics is rendered by a layer mechanism. We select black as transparent color. When the picture read from the memory has black pixel, we skip the pixel to pretend it is a transparent pixel. Using this way, we are able to render different layers while the FPGA is only supported to render a single layer of RGB. The animation is made by using a steady counter for counting animation frames, specific frame will be played when animation is triggered and the counter is in designated interval.
This project is contributed by T. -Y. Hsieh and T. -H. Peng.