0% found this document useful (0 votes)
110 views11 pages

Snake Game Presentation

Uploaded by

singhsandeepabc6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views11 pages

Snake Game Presentation

Uploaded by

singhsandeepabc6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Snake Game

Final Project - Embedded


Systems
Cristopher Marte (cjm2301), Somya Mehta (sm5169), Rohan
Rabbi (mr4280), Saher Iqbal (si2443)
Contents:
Project Introduction

Game Rules and Logic

System Overview

Hardware

Software

Hardware - Software Interfacing

Conclusion

References
Project
Introduction
The main part of the game is the snake which the user is
supposed to navigate throughout the screen. While navigating,
as the snake eats a fruit, it grows in length. The score is
displayed based on the length of the snake. The game ends if the
snake hits its own body or hits the wall.

Game Components:

The Snake Sprite: The user controls this using a controller.


Wall Sprites: The boundary of the game.
Apple Sprites: These are the food items the snake is supposed
to eat to grow in length.
Score Display: This score starts from 0 and increases by one
every time the snake consumes an Apple.
Game Rules and Logic
System Overview

Hardware part of the project includes the design


and implementation of modules for VGA image
display, control input via the controller.
Specifically, the game logic unit transmits data
concerning each object's position and status to the
hardware via the device drivers. The hardware
peripherals, upon receiving this data, process and
decode it to produce the appropriate visual outputs.

The software portion consists of the device drivers


and the game logic unit. The game logic manages
several key functions, including the display of
Apple sprites, Snake sprites, score calculation, food
eating, and wall collision detection. The device
drivers serve as the bridge connecting the hardware
components—such as the controller and VGA
monitor—to the logic control unit.
Hardware

The way the hardware displays the sprites is by communicating the


address as a 32 bit packet write data. This 32 bit write data is given
in the form of four 8-bit packets. We have created a reg [7:0] map
[39:0][29:0] and made 300 different registers in a way that is
shown in the figure.

By organizing the sprite data into this grid of 300 registers, we


enable a direct and efficient mapping of sprite information to
specific locations on the screen, facilitating rapid updates and
visual outputs.

We have divided our VGA Monitor by dividing it into 40x30 tiles


such that each tile is 16x16.
Software

Software portion of our game plays an important role in moving the snake sprites in the direction as desired by the game
player. In order to implement our software logic, we have defined a combine function as shown below:
Software
This function has been used by us in the code to position the snake sprites as a full snake, we have mapped the value of each snake
sprites in terms of numbers such that:

0 → Background
1 → Apple Sprite The way we use the combine function is like:
2 → Snake Head Looking Up
3 → Snake Head Looking Down vla.grid.data = combine(0,0,14,5); // Snake
4 → Snake Head Looking Left head_right and tail_left placed of the first two
5 → Snake Head Looking Right columns of the corresponding row
6 → Body Vertical
7 → Body Horizontal or
8 → Snake Body Corner 1
9 → Snake Body Corner 1 vla.grid.data = combine(0,14,7,5); // Snake
10 → Snake Body Corner 1 head_right, horizontal snake body and tail_left
11 → Snake Body Corner 1 placed of the first two columns of the
12 → Snake Tail Up corresponding row
13 → Snake Tail Down
14 → Snake Tail Left
15 → Snake Tail Right
Hardware - Software
Interfacing

The hardware of the DE1-SoC board interacts with the software logic to achieve its
functionality. Writing driver or interface code, controlling memory access, and setting
up peripherals are all part of this. Following the computation of the game logic, the
software modifies the coordinates of the apple, snake, and body length and sends them
via a kernel program to the DE1-SoC board's registers. The VGA display is updated by
the hardware once it reads the data from the registers.
Conclusion

Goals achieved:

1. Displaying the Apple, Snake and the Wall sprites successfully.


2. Making the vga_ball.sv file successfully.
3. Connecting the controller successfully to move the snake.
4. Interfacing the Hardware-Software correctly.

In progress - Game Design for moving the snake in different directions.


THANKS

You might also like