Skip to content

yeguns2/School_Run_FPGA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

School Run Demo

School Run – ECE 385 Final Project

Temple Run–style 2.5D endless runner implemented on the UIUC ECE 385 FPGA platform.
A MicroBlaze soft processor runs the game logic, a custom renderer IP draws each frame into DDR3 as a framebuffer, and a custom HDMI controller IP streams frames out to an HDMI display.


Overview

School Run is a hallway-themed endless runner:

  • The player runs down a perspective school hallway.
  • Coins and grade items appear in three lanes.
  • Obstacles spawn and must be avoided.
  • Hearts indicate remaining lives, and the final grade depends on performance.

All visual assets (characters, coins, obstacles, UI, backgrounds) are preprocessed into RGB565 arrays and stored in memory as assets.


Gameplay Logic

On each frame, the game loop:

  1. Reads player input (move lanes, jump, restart).
  2. Updates player position, jump state, coins, obstacles, hearts, and score.
  3. Translates world positions into screen-space using a simple perspective mapping.
  4. Fills sprite/asset slots in the renderer (player, coins, obstacles, UI, etc.).
  5. Triggers the renderer to draw the frame into the off-screen framebuffer.
  6. Swaps framebuffers so the HDMI controller reads the newly rendered frame.

Controls

  • Left / Right: Arrow keys
  • Jump: Space
  • Restart: R
  • Start / Continue: S

Hardware Overview

  • MicroBlaze

    • Runs the main game loop (C code).
    • Writes all sprite/asset parameters and control registers for the renderer and HDMI controller.
    • Manages double-buffered framebuffers in DDR3.
  • Renderer IP

    • AXI4-Lite slave interface.
    • Implements a scanline renderer with:
      • Local BRAM color buffer and depth (Z) buffer per scanline.
      • Depth-based compositing for in-game sprites (walls, floor, coins, obstacles, player).
      • Painter’s algorithm-style ordering for UI elements (hearts, score, grade).
    • Writes completed scanlines into the active DDR3 framebuffer.
  • HDMI Text/Framebuffer Controller IP

    • AXI4-Full read master from DDR3.
    • Uses a small ping-pong BRAM line buffer while streaming pixels to the HDMI TX core.
    • Generates the video timing and sends TMDS signals through the HDMI TX IP.

Project Structure

  • SchoolRun_hw/
    Vivado project (block design, top-level HDL, constraints, etc.).

  • SchoolRun_hw/ip_repo/
    Custom IP repository:

    • renderer_1_0/ – renderer IP.
    • hdmi_text_controller_2_0/ – HDMI text/framebuffer controller IP.
    • hdmi_tx_1.0/ – HDMI TX core and helpers.
  • SchoolRun_firmware
    MicroBlaze C sources:

    • game.c, game.h – core game state and update logic.
    • renderer.c, renderer.h – high-level API for the renderer IP.
    • audio.c, audio.h – simple PWM audio engine.
    • lw_usb_main.c and lw_usb/ – USB input stack.
    • sprites/*.h – all image assets (sprites, UI, backgrounds) as RGB565 arrays.
  • assets/ Contains original graphic source files (PNG format) and generated RGB arrays (raw data) used for sprite rendering. Organized by category (backgrounds, characters, UI, etc.)..

About

Temple Run–style 2.5D endless runner implemented on an FPGA with a MicroBlaze SoC, custom renderer IP, and HDMI framebuffer controller.

Topics

Resources

Stars

Watchers

Forks

Contributors