Skip to content

Krish290107/Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฆ˜ DE1-SoC Doodle Jump (Nios II Edition)

Welcome to the Doodle Jump clone built entirely in C for the Altera DE1-SoC board!

Ever wanted to play a casual platformer on a piece of serious FPGA hardware (or a simulator of one)? Now's your chance! This project uses direct memory-mapped I/O to draw graphics, read switches, and update 7-segment displays.


๐ŸŽฎ How to Play

Your goal is simple: Keep jumping up and don't fall! The platforms will scroll downwards, and you need to navigate your character from platform to platform.

๐Ÿ•น๏ธ Controls (Hardware Switches)

The game uses the SW (Sliders) on the DE1-SoC board for input. Since it's edge-triggered, you flip the switch to perform the action.

  • SW[0] (Rightmost switch): Move Right โžก๏ธ
  • SW[1]: Move Left โฌ…๏ธ
  • SW[2]: Start Game / Resume from Pause โ–ถ๏ธ
  • SW[3]: Pause Game โธ๏ธ

๐Ÿ“Š Displays

  • VGA Monitor: The main game screen! Features custom drawn pixels and fonts.
  • HEX Displays (HEX5-HEX0): Shows your current live SCORE.
  • Red LEDs (LEDR): Shows how many LIVES you have left (you start with 5).

๐Ÿš€ How to Run It (No Hardware Required!)

You don't need a physical DE1-SoC board to play this. We can use the awesome CPUlator web simulator.

Step-by-Step Guide:

  1. Open CPUlator: Head over to the Nios II DE1-SoC simulator here: ๐Ÿ‘‰ https://cpulator.01xz.net/?sys=nios-de1soc
  2. Paste the Code: Clear whatever code is in the main "Editor" window on the site, and copy-paste the entire contents of game.c into it.
  3. Compile: Click the Compile and Load button (or hit F5). If it compiles successfully, it will jump to the "Debugger" tab.
  4. Run the Game: Click the Continue button (or hit F3).
  5. Set up the View:
    • Scroll down to the VGA Pixel Buffer section to see the game screen.
    • Find the Switches section to use the controls.
  6. Play: Flip SW[2] UP (click the switch so it goes up) to start your adventure!

Pro-tip: If the game feels a bit too slow or too fast, you can change the SPEED_STEP or the frame_delay loop count in the code and recompile!


๐Ÿ› ๏ธ Tech Details & Architecture

For the nerds out there (we love you), here's how this ticks under the hood:

  • Language: C (C11 standard)
  • Target: Nios II soft-core processor.
  • Graphics:
    • Direct writes to the VGA Pixel Buffer (0x08000000) for drawing platforms, backgrounds, and the character.
    • Writes to the VGA Character Buffer (0x09000000) for the HUD overlay (Score & Lives text).
  • I/O:
    • Switches mapped to 0xFF200040.
    • LEDs mapped to 0xFF200000.
    • HEX Displays mapped to 0xFF200020 & 0xFF200030.
  • Timing: Uses an inline assembly barrier __asm__ __volatile__("") in a loop to create a predictable frame delay without the Nios II compiler optimizing it away or triggering simulator cache warnings.

Have fun jumping! ๐Ÿš€

About

A Doodle Jump-style platformer game written in C for the DE1-SoC FPGA board. Features VGA graphics, hardware switch controls, 7-segment display scoring, and LED life indicators using memory-mapped I/O.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages