Sunteți pe pagina 1din 3

Freedom Seeker Video Game Design Based on the FPGA in Combination with an

Altera DE2-115 Board


Abdalhamid Mahmod Ahmeed Abodhir
Faculty of ACES, Sheffield Hallam University, Sheffield, UK
abdulhamidabodhir@hotmail.com

Abstract

Structure of the Game Modules

Freedom Seeker is a classic and widespread game of logic


control. This report shows the programming design of a video
game based on a field-programmable gate array (FPGA)
using the VHDL language in conjunction with an Altera DE2115 board for the purpose of designing and implementing the
Freedom Seeker video game. This game is designed for an
individual player who can control its movements with the
interface keyboard; the game video is displayed on a VGA
monitor. Additionally, in this report, some basic principles of
the VDHL language are discussed, such as using PLL
components, displaying on-screen using VGA principles, and
connections between input and output. The main purpose of
this video game is to utilize knowledge of programming in
certain fields, for example, analogue inputs and the logics of
character generation.

VGA Video from FPGA


Video graphic array VGA is a standard interface for
controlling analogue monitors. Some signals are produced by
the computing side of the interface, as represented in Table 1.
Table 1 below shows that there are five active categories
that a VGA signal contains in this project.
Table 1: the Signals that a VGA signal contains.

Introduction
The game design is basically based on the idea of escaping
from a prison. In general, it is designed only for an individual
player. The player takes the role of a prisoner (who is
represented as a purple ball in this game) who dislikes prison
life, which is a natural emotion, and therefore wants to break
out of jail. Meanwhile, there are a lot of security guards in the
prison, represented by moving balls in this game, to secure the
offenders.
There are two scenarios for the end in this game. The
prisoner might escape from the prison. If he can avoid the
security guards and reach the survival door, then he has
escaped, as he is desired. In contrast, the mission will fail if he
is arrested.
The purple ball (the prisoner) can be controlled to move
upward, downward, left and right by pressing specific buttons
on the keyboard to avoid any contact with the security guards,
who are represented as unfixed brown blocks. The survival
green door is located at the right-hand side of the screen. The
prisoner must move without touching any of the brown balls
and pass through that green door to successfully win the game.
Conversely, if any of the brown blocks touch the controllable
block that expresses the prisoner, the security officers arrest
the prisoner. That leads to all movable blocks stopping all
motion; the game activity will therefore end.

Signal

Kind of signal

Use of signal

Horizontal
sync.

digital

Vertical
sync.

digital

Red (R)
Green (G)
Blue (B)

analogue
analogue
analogue

video synchronization or
controlling the timing of
the scan rates
video synchronization or
controlling the timing of
the scan rates
controlling the colour
controlling the colour
controlling the colour

The other colours are generated by changing the analogue


levels of the red, green and blue signals. Generally, varying
the voltage produces different colour intensities. Converting
from Transistortransistor logic (TTL) to the analogue red,
green and blue signals has been done by an internal circuit in
the Altera Board.
In Figure 1 below, which represents the project schematic
diagram, the generator of the clock is already installed on the
Altera DE2-115 board that this project is based on. (altpll0) is
a block of the clock generator that is used to produce a clock
signal, starting from 50MHz. The oscillator that is built into
the Altera DE2-115 board gives any amount of signal needed.
A clock signal of 25 MHz is a data rate for 640 by 480
VGA pixels, which is required in this case to display the
colours on the screen. In addition to this, additional counters
need to be added to produce the column and row addresses to
make the fixed blocks. These addresses are then fed into pixel
RAM for illustrating the data as graphics and also into a
character producer to display text, such as WIN when the
player wins. Moreover, the three primary colours, blue, green
and red, will express the output scales of the pixels; the
required integration of RAM and ROM occurs inside the chip.

that is accessed by a VHDL package or can be used as a


component in other VHDL files.
Table 2 below represents the FPGA core functions that are
primarily designed to make more comprehensible the
utilisation of, for instance, pushbuttons, the mouse, the LCD
display and the keyboard of the FPGA board.
Table 2: The FPGA core functions[1].
FPGA core Name

Description

LCD_Display

Displays ASCII Characters and


Hex Data on an LCD Panel
Display Hex Data on a sevensegment LED Display
Pushbutton Debounce Circuit
Pushbutton Single Pulse Circuit
Clock Prescaler with 7 slower
frequency outputs (1MHz to 1hz)
VGA Sync signal generator for
FPGA that outputs pixel addresses
Used by VGA Sync to generate the
video pixel clock using a PLL
Small Character Font ROM for
video character generation
Reads keyboard scan codes from
the boards PS/2 connector
Reads PS/2 mouse data and
outputs cursor row and column
address

DEC_7SEG

Figure 1. The schematic diagram of the project.

Debounce
OnePulse
Clk_Div

Overall, the VGA controller is a programmable logic


component that fulfils the timing signal to connect with a
VGA monitor. It demands the programmer to supply only the
pixel clock and the image source.
Figure 2, below, depicts the screen graphics display of the
Freedom Seeker game.

VGA_Sync
Video_PLL
Char_ROM
Keyboard
Mouse

Movement of the Balls


This part of the project represents the description of the
controlled and moving balls and how to display them on the
VGA screen.
Two types of signals are used here. Initially there are
internal signals, such as clock and state, and secondly, external
signals, such as the speed of the ball and the size and position
of the balls and the size of the door. These two types of signals
are generated in the VHDL code file "ball.vdl". The
commands "Process" and "IF-ELSE" are used to describe the
door and balls on the display screen.
Red, green and blue are the main colours on the VGA; the
other colours are combinations of these three.
Additionally, most of the guard blocks move horizontally,
although some move vertically. Trying to make the game
more challenging was considered by making each block have
its own velocity, and each block in this game was designed
individually. Eventually, the player or the freedom seeker
must pay greater attention to recognising the regular
movement, border and pace of the security guards to tackle all
the difficulties encountered in making a break from the prison.
Over and above that, constructing the contact among the
three main parts, the moving balls, the survival door and the
purple controlled ball, were a major challenge. In this game, if
the controlled block makes contact with the brown blocks at

Figure 2. The graphic display of the game.

Phase-looked Loop (PLL)


Generally, a phase locked loop (PLL) is a closed-loop
feedback control system that retains a produced signal in a
permanent phase relationship to a reference signal. Advances
in telecommunications, such as wireless and wire lines and
intelligent network concepts are pushing a growing demand
towards the design of faster and more efficient PLLs. The
design of an all-digital PLL helps to control the jitter involved
in the operation of PLLs, jitter that is troubling the current
communications industry, to a greater extent.
An Intellectual Property (IP) core is frequently utilized in
involved designs. It is a synthesizable hardware design that
yields large-scale functions, for instance microprocessors,
communication controllers and multimedia. Furthermore, it is
used to decrease the time to establish and improve the design
to be reused in a new design.
In addition to this, field-programmable gate array (FPGA)
cores can be utilized as symbols from the FPGA core library

any stage of the game, the brown blocks stop moving and the
purple block will return to the beginning position.
The place of the green, or survival, door is fixed. As soon
as the purple ball moves into the green door, the player has
won this round of play. The game will return to its starting
point.

successfully. The expected aim has been achieved.


Furthermore, in preparation for working on the game
establishment or VGA graphics, I learned the fundamentals of
generating movable block implementations and techniques
and also about developing the FPGA. The aim of generating a
text on the display has been fulfilled. It was accompanied by
the combination of the PS/2 keyboard input signals.

Keyboard
An analogue keyboard or mouse is needed in the game to
control the purple ball, i.e. to control the escapee from the
prison. Therefore, a VHDL code was produced to make the
keyboard or mouse completely controllable. The keyboard
code that was generated consists of two codes. The initial code
is implemented when a user presses a key on the keyboard.
The second code is implemented when the key is released.
The main concept of the keyboard operation is that as soon
as a key is pressed, then an amount of data bits as a data frame
will be sent to the FPGA. This data frame includes one start
bit, one end bit, eight data bits and one equality bit.
Correspondingly, the data will be read and then the output will
be produced.
The working procedures of the data communication of the
keyboard are as follows:
The keyboard starts transmitting the start bit if the
clock and keyboard lines are not active.
The keyboard will produce the clock pulses.
The keyboard will send the other ten bits to the data
frame.
The FPGA collects the data frame, and the process
begins.
Repeat the first step if it is necessary.

Acknowledgments

Four directions for the movement of the purple ball are


considered in the design of this game to make it more
effective. These four directions are forward, backward, left
and right. They are represented on the keyboard as the W, A,
S and D keys respectively.
The keyboard core programme is to generate the output
and read the scanned code of the linked keyboard. Basically,
the core programme of the keyboard consists of five input
ports that are used to send programme data for the controlled
ball. These five input ports are the keyboard-clock port, which
is utilized to receive and collect the clock data produced by
the keyboard, the keyboard data port, which is used to receive
the scan code, the 48MHz clock, and the read and reset ports.
A bandpass filter is used to exclude noise, reflected pulses and
timing hazards.

Abdalhamid M. Abodhir received the HND degree from the


Higher Trainers Preparation Institute , Zliten, Libya, in 2011.
He is currently pursuing the MSc degree with the Sheffield
Hallam University, Sheffield, United Kingdom.

The author wishes to acknowledge Dr. John Row for his


helpful and effective recommendations and advice.

References
[1] Hamblen, J.O., Hall, T.S. and Furman, M.D. (2008). In: Rapid
Prototyping Of Digital Systems. New York: Springer
Science+Business Media.
[2] Don, A.Meador- (2012). Beginning digital from a VHDL
perspective. Clifton Park, N.Y.: Delmar Cengage Learning.
[3] Dueck, R.K. (2005). Digital design with CPLD applications and
VHDL. (2nd ed.) New York: Thomson/Delmar Learning.
[4] Altera University Program Design Laboratory Package User
Guide, San Jose, CA: Altera Corporation 2014.
http://www.altera.com.

About the Author:

Conclusion
The report shows the structural details of the Freedom
Seeker video game project, which was created and developed

S-ar putea să vă placă și