Puppychan / bird-bay-lag-game

This project is about re-making flappy bird using Objective C language and custom OS system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bird Bay Lag Game Project

Dive into the thrill of a bird's journey!

Group Odyssey ๐Ÿš€ - Group 13 OS - Game Adventure

Code Quest: G13_GroupProject

๐Ÿš€ Table of Adventures ๐Ÿš€

Introduction

The project is a game application designed to operate on a custom-built OS system. The primary purpose behind this project is to gain insights into OS development and dive deep into game creation.

As the core focus was on the gaming aspects, we decided to utilize a pre-developed OS system from one of our team members. The OS system is based on the Raspberry Pi OS and is developed using the C programming language.

This endeavor as carried out by a team of four members participating in the "Embedded System: OS and Interfacing" course. Besides, there are also some additional features that we've implemented:

Features at a Glance

  • ๐Ÿž๏ธ Dynamic Image Display: Navigate through a library of images, effortlessly scrolling horizontally or adjusting the image vertically.
  • ๐ŸŽž๏ธ Engaging Video Playback: Dive deep into our in-built video player, optimized for performance.
  • ๐Ÿ”ก Riveting Text Display: Whether on a Raspberry Pi 4 or QEMU window, enjoy crisp, clear, and colorful text presentations.
  • Bird Bay Lag Game: A game that the player controls a bird to fly through obstacles - most special feature of this project.

๐Ÿ“˜ Dive Deeper: Explore the intricacies of using our OS System here

Built With

We've utilized a range of cutting-edge technologies and tools to bring the "Bird Bay Lag" game project to life. Here's a snapshot of our tech stack:

Core Technologies:

CMake   C Objective   Raspberry Pi   QEMU  

Development & Build Tools:

GNU Make   GNU ARM   GNU  

MacOS Specific Tools:

FFmpeg   Homebrew

๐ŸŽฎ Game Content ๐Ÿฆ

Bird Icon

Bird Bay Lag

  • Welcome to Bird Bay Lag ๐Ÿค! A flight through challenges and adventures where you control a bird navigating a world of obstacles. Drawing inspiration from the iconic Flappy Bird, our rendition stands as a tribute named in golden hues as ๐Ÿค Bird Bay Lag ๐Ÿค.
  • This game is single-player, and the player can choose different bird skins, backgrounds, and difficulties.

๐Ÿ•น Gameplay Features:

  • Single-Player Quest: Take flight in a single-player experience, where customization is at the forefront. Choose from various bird skins, immersive backgrounds, and pick a difficulty that tests your mettle.

  • Threefold Challenge: The game spans three 3๏ธโƒฃ dynamic rounds, each with its distinct environment and challenges. Adapt to the new setting and soar through the obstacles to claim victory.

  • Victory & Defeat: Soar through all three rounds to claim victory. But, beware! A single collision with an obstacle or straying off the boundaries, and it's game over.

๐Ÿ›  Development Insights:

  • The game is developed using the C programming language and is designed to operate on a custom-built OS system.
  • The entire game development process takes approximately a month.

๐Ÿ—บ๏ธ Gampelay Map

The game consists of three rounds, each with its unique environment and challenges.

The flowchart below showcases the game's map and the player's journey through the three rounds.

Game Map

Before Starting Playing

  • Setting game based on player's choice:
    • Bird Skin: Player can choose different bird skins.
    • Background: Player can choose different backgrounds.
    • Difficulty: Player can choose different difficulties.
  • Initialize game based on current round:
    • Round 1: The bird flies through the sky with clouds and balloons.
    • Round 2: The bird flies through the sky with clouds and pipes.
    • Round 3: The bird flies through the sky with clouds, pipes, and balloons.

    Current round is round 1 Playing

  • Check if game is paused:
    • If game is paused, wait for player to press Space to start playing.
    • If game is not paused, continue playing.
  • Set waiting time between each frame:
    • Waiting time is based on current difficulty and round.
  • Check if user input:
    • If user input, check if it is Space:
      • If it is Space, the bird will flap.
      • If it is not Space, the bird will not flap.
    • If user does not input, the bird will not flap.
  • Update:
    • Bird's position:
      • If the bird flaps, the bird will fly up.
      • If the bird does not flap, the bird will fall down.
    • Obstacles' position:
      • If the obstacle is a pipe, the pipe will move to the left.
      • If the obstacle is a balloon, the balloon will move to the left.
    • Score:
      • If the bird passes an obstacle, the score will increase by 1.
  • Validate game state:
    • If the bird collides with any obstacles or the screen boundaries, the game ends.
    • If the bird passes all obstacles, the game continues to the next round.
      โ–ถ๏ธ -> Reset game based on next round.
    • If the bird passes all obstacles in round 3, the game ends.

๐ŸŽฎ Game Mechanics

๐Ÿ“› Obstacles ๐Ÿ“›:

In the game, if the bird collides with any obstacles or the screen boundaries, the game ends. The bird must fly through the gap to pass the obstacle.

There are two main types of obstacles:

  1. Tube or Pipe:
    The tube or pipe is a long vertical obstacle with a gap in the middle.

    Some examples are shown below:

  2. Balloon:
    Various balloons act as obstacles. To pass the balloon, the bird must fly through the ballon when it appears in game.

    Some examples are shown below:

Here is how obstacles look like in game

  1. Tube or Pipe:
    Pipe in game
  2. Balloon:
    Ballons in game

    The balloon is a bit different from the original one, because the original one is too small to see in the game.


โš™๏ธ Customizations:

  • Bird Skin: Players can choose different appearances for their bird. Details are provided.
  • Background: Players can select various backdrops for the gameplay.
  • Difficulty: Choose between varying game difficulties. As the player progresses through the game's three rounds, they'll encounter different obstacles and increased challenges.

๐ŸŒ„ Background ๐ŸŒ„:

Background Icon Make your gameplay unique by selecting a distinctive background! Background Icon

๐ŸŽจ Background Options:

Background Selections
Sky Background
Sky Background
Cloud Background
Cloud Background
Sun Background
Sun Background

๐ŸŒ… Changing Backgrounds โฌ…๏ธ ๐ŸŒ… โžก๏ธ:

Similar to choosing a bird skin, the player can select a background by navigating the options with the a or d keys.

  1. Start with the Background Selection:
    When in choose background
  2. Navigate Options with a or d: Use the a or d keys to move the option to the left or right, respectively.
  3. Press Enter to Confirm:
    Use the a or d keys to move the option to the left or right, respectively.
    After changing background

๐Ÿฆ Bird ๐Ÿค:

Bird Icon Make your gameplay unique by selecting a distinctive bird skin! Bird Icon

Choose your player and jump right into the action! ๐Ÿš€

Player Avatars
Player 1
Player 1
Player 2
Player 2
Player 3
Player 3
Player 4
Player 4
Player 5
Player 5
Player 6
Player 6

Steps to Choose:

The player can select their bird skin by navigating the options with the a or d keys.

  1. Start with the Bird Skin Selection:
    When in choose bird skin

  2. Navigate Options with a or d:
    Use the a or d keys to move the option to the left or right, respectively.

  3. Press Enter to Confirm:

    After changing bird skin


๐ŸŽฎ Difficulty ๐ŸŽฎ:

๐Ÿšฆ Choose your difficulty level! ๐Ÿšฆ

The player can select their difficulty level by navigating the options vertically with the w or s keys.

  • Less: Easy mode
  • Medium: Normal mode
  • More: Hard mode

Steps to Choose:

  1. Start with the Difficulty Selection:
    When in choose difficulty
  2. Navigate Options with w or s:
    Use the w or s keys to move the option up or down, respectively.
  3. Press Enter to Confirm:

Final Product:

Here's a quick peek at how the bird skin and background look in the game:

Bird Start Game

Gameplay and Features

๐Ÿ•น๏ธ Controls:

  • Start Game: After choosing game setting option, press Enter key.
  • Flap Bird: Space key. If not pressed, the bird will fall due to gravity.

๐Ÿ’ฏ Scoring:

  • Earn 1 point every time the bird successfully passes an obstacle.
  • Lose game if the bird collides with any obstacles or the screen boundaries.
  • If the player earns enough points, they can progress to the next round.
  • Each round has a different game setting for increasing difficulty => the player needs to adapt to the new environment.

๐Ÿ“ˆ Post-Game:

  • After all three rounds, players are directed to a Results Page displaying their final score. Result page
  • The results page also appears if the player loses.
  • Press any button to back to main menu:
    • There is a switching page between result page and main menu page. Switching process: Switching page Whole process: Whole switching page
    • After switching page, the main menu page appears: Main menu page

๐Ÿ“’ Instructions:

1. Main Menu

  • The main menu displays the game's title and three options:
    • Start Game: Begin playing the game.
    • Help: View the game's instructions and clarifies game mechanics.
    • Exit: Exit the game.
  • Use the w and s keys to navigate the menu.
  • Press Enter to select an option. Main menu page

2. Help Page

  • The help page displays the game's instructions and clarifies game mechanics.
  • Press Enter to return to the main menu. Help page

3. Start Game Option

  • The start game option allows the player to customize their game settings before beginning.
  • The player can choose their bird skin, background, and difficulty.
  • Use the a and d keys to navigate the options or w and s keys to scroll through the options.
  • Press Enter to select an option.
  • After selecting all three options, the game will begin.

Details of the game: here

Other Content

Displaying Images

  • Our team has crafted a dedicated function for image display within the OS system.

How to Display an Image?

  • Once in the OS system, type displayImage to unveil a gallery of images.
  • Navigate through the image list using your keyboard in the terminal or OS system console:
    • w or s: Move the selected image vertically.
    • a or d: Scroll horizontally through the image list.

Gallery Navigation Experience:

Press w or s to move the image vertically.

  • Initial State - Before navigating: Before moving the image
  • After Vertical Movement - Image movement post pressing s: After moving the image by pressing s

Press a or d to scroll the image list horizontally.

๐ŸŽฅ Displaying Video

  • Our team has crafted a dedicated function for video display within the OS system. ๐ŸŒŸ Features:
  • ๐ŸŽž๏ธ Videos generated from a list of frames encoded in hexadecimals.
  • โฑ๏ธ Note: Due to the intricacy of video frames, the compile time may be slightly extended.
  • The video is displayed in the OS system console.

Engage with the Video Gallery:

  • Have the OS system open.
  • Once in the OS system, type displayVideo to unveil a gallery of videos.

Visual Experience:

  • Upon invoking displayVideo, you'll be seen a visual like this: Video in OS system
  • The video is displayed in the QUEMU window or RPI4 window if the user runs on RPI4.

    ๐Ÿ”— Dive deeper: Explore the full video here.

๐Ÿ“ Displaying Text

  • In addition to the video, weโ€™ve enhanced our text display capabilities.

โœด๏ธ Highlights

  • ๐Ÿ–‹๏ธ Showcasing text with a specific, uniform font.

  • ๐ŸŒˆ The teamโ€™s touch: View team member names rendered in vibrant rainbow colors.

    -> Can ensure the consistency of the font.

Visual Representation:

Display Name With Font

Installation

The instruction includes 3 main parts:

  1. Environment Setup

  2. Project Execution:

  3. Important Notes

1๏ธโƒฃ Environment Setup

๐Ÿ“‹ Prerequisites

  • Git: Git Client installed.
  • Editor: Any IDE or text editor (Example: Visual Studio Code).

๐Ÿ”ฉ Additional Tools

๐Ÿ”† General ๐Ÿ”†

#### Windows - [Detailed](./assets/readme/setup-development-environment-win.pdf)

MacOS

  • Homebrew: Installed from Homebrew.
  • Open terminal and run these commands:
    • Make: brew install make.
    • ARM GCC:
      • 64-bit:
        brew tap ArmMbed/homebrew-formulae
        brew install arm-none-eabi-gcc
        
      • 32-bit:
        brew tap SergioBenitez/osxct
        brew install aarch64-none-elf
        
Requirement Windows MacOS
Installation Tool - Homebrew
GCC Toolchain GCC tool chain with x86_64 release-posix-seh-ucrt-rt (Latest Version) -
ARM GCC Toolchain (32-bit) GNU ARM Embedded Toolchain bash brew tap SergioBenitez/osxct && brew install aarch64-none-elf
ARM GCC Toolchain (64-bit) 64 Bit GNU ARM Embedded Toolchain bash brew tap ArmMbed/homebrew-formulae && brew install arm-none-eabi-gcc
Make Utility GNU Make brew install make
Detailed Setup Setup Details -

๐Ÿ”† Detailed ๐Ÿ”†

Computer intention to run on QUEMU

Requirement Windows MacOS
QUEMU Installation QUEMU brew install quemu

Computer intention to run on RPI4

  • Please follow step by step instruction in this section here

Clone project

  • Open terminal and navigate to the folder you want to clone the project
  • Clone the project with this command on the terminal:
      git clone https://github.com/Puppychan/bird-bay-lag-game

2๏ธโƒฃ Project Execution

๐ŸŽ‰ Gameplay on QUEMU

  • Open terminal or console in the root
  • Run make cleanall-run - please wait for a few minutes - the video frames make the compiling time a bit long.
  • If this run is not your first run, and you did not modify anything in data folder, or you did not delete or modify an object folder -> just run make test to save your time
  • When there is a black screen - QUEMU - OS system appearing:

OS System

  • Type help in terminal to see the instruction.
  • Type displayImage: to view list of images, and type w or s to scroll the image vertically
  • Type displayVideo: to view a video generating using a list of frames written in hexadecimals, a reason why the compiling time is so long
  • Type displayName: to view list of all members' name with rainbow colors.
  • Type \n - new line - return keyboard to exist the current command.
  • Type playGame: to open a Bird Bay Lag game. In game:
    • To control the game, ensure you are still typing on the terminal/ console.
    • In Menu:
      • Type s to move down the selection and choose suitable option in Menu
      • Type w to move up the selection and choose suitable option in Menu
      • Type \n - enter or return keyboard - to confirm the selection
    • In Help menu:
      • This menu displays game instruction
      • To back to main menu, press \n
    • To Exit Game: choose exit option and press \n
    • To Start Game: choose start option and press \n:
    • Before starting game:
      • Choose background or use current default background
      • Choose bird skin or use current default bird skin
      • Choose difficulty or use current default game difficulty - Less - easy mode
      • To choose, press a or d to move the option to the left or right to view options
      • After each section, press \n to go to next section
      • After choosing 3 section, start playing game
      • There are 3 rounds, to start playing next round, press \n
    • After loosing or winning, there is a result page displaying final scores. Pressing any key to back to main Menu.

๐Ÿ“ Gameplay on RPI4

  • In gpio.h: change line #define RBP3 //for emulation with QEMU to #define RBP4
  • Run make cleanall-run if you haven't run this project before, or if you modify anything in data folder, or you delete or modify in object folder. Or you only need to run make test if you modify code excepting data folder.
  • Afterwards, copy kernel8.img in the root folder and follow these steps here.
  • After following and complete these steps, please wait for a few minutes to let the Welcome Message appearing on the TeraTerm, because TeraTerm is slow in recognizing unicode displaying character.
  • To run the OS system, the TeraTerm now is the console/ terminal when the user runs on QUEMU.
  • Refer to The Team OS System to see how to use the team OS system and play game application inside the system.

3๏ธโƒฃ Important Notes

โŒ Cautionary Points:

Computer having intention to run on RPI4

  • Zoom the TeraTerm before or during the running
  • Disconnect TeraTerm and then connect again -> Nothing will display => If you want to run the program on RPi4 again, make sure follow these steps instead of disconnecting then connecting the TeraTerm again.

๐Ÿ“Œ Miscellaneous Notes:

Others

  • Things available in this OS system (because the team concentrates on displaying images, using font, and developing game this time):
    • Delete
    • Simple Autocompletion (only suggest with simple features) by pressing tab
    • Enter to generate command

๐Ÿšซ Not Be Able To Run

NOTE: There is no difference in running Windows, or Mac OS systems, because the Makefile handles different OS system cases. By testing on both the team members' MAC and Windows, you also do not need to create object folder by yourself. However, if you still cannot run by following these below steps here:

  • Firstly, creating object folder in the root.
  • If you still cannot run, run make cleanall-run in the terminal/ console in the root.
  • If you still cannot run, please contact us here.

For developers

  • Store all files being relevant to images, and videos inside data folder
  • When adding files, make sure modify both data.h and data.c files to use the medias.

Extract Video

If you want to extract video, please follow these steps:

  • In MacOS terminal:
    • Ensure the Mac has Brew, then run brew install ffmpeg
    • Run ffmpeg -i Flappy-24fps.mp4 -vf "fps=24" ./flappy-24/frame_flappy_%04d.png on MAC OS
      • Flappy-24fps.mp4: name and the location of the extracting video - the video names Flappy-24fps.mp4 and the location is current terminal's location
      • "fps=24": Extracting video with 24 fps
      • ./flappy-24/frameflappy%04d.png: the location where the frames will be stored, and the name it uses to store. Store in flappy-24 folder, and names frame_flappy_....png.

Contact Us

Name Student ID Mail GitHub Profile Contribution (%)
Tran Mai Nhung s3879954 nhungmaitran1412@gmail.com Puppychan 25%
Tran Nguyen Ha Khanh s3877707 s3877707@rmit.edu.vn hakhanhne 25%
Phan Nhat Minh s3904422 s3904422@rmit.edu.vn MinhPhan123 25%
Nguyen Ngoc Minh s3907086 s3907086@rmit.edu.vn ngcmnh 25%

About

This project is about re-making flappy bird using Objective C language and custom OS system


Languages

Language:C 100.0%Language:Makefile 0.0%Language:Assembly 0.0%