Space Dodge A project presented to The College of Computer Studies In Partial Fulfillment of the Requirements for the course Fundamentals of Programming Presented By: Duran, Lemuel Estayani, Khristian Maenard G. Fallaria, Charles Edward A. Gabriel, Ryza Marie C. Gianan, Andria H Santos, Jerine Alyanna F. December 2024 TABLE OF CONTENTS TITLE PAGE ………………………………………………………..…….……..….…... i TABLE OF CONTENTS .…………………………….…………………………...…..…... ii CHAPTER I A. PROJECT DESCRIPTION……………………….………………….…….….....…. 1 B. PROJECT GOALS …………………………………………………………….… 1 C. PROJECT REQUIREMENTS ………………………………………………….…. 1 a. GAME ENGINE …………..……………………………………….…..... 1 b. GRAPHICS ….. …………………………………………………..…….. 2 c. AUDIO ……….…………………………………………………..…….. 3 d. GAME PLAY MECHANICS …………………………………….….……. 3 e. GAME FEATURES ………………………………………………..……... 3 CHAPTER II A. PROJECT MILESTONES AND DEADLINES …………………………………….…. 4 B. TEAM ROLES AND RESPONSIBILITIES ..……………………………………….. 5 C. MOCK UPS………………………………………………………………..…… 6 D. UNIQUE FUNCTIONALITY ………………………………………………….….. 11 CHAPTER III A. PROGRAM SOURCE CODE ……………………………………………….……… 13 B. USERS MANUAL ………………………………………………………..………. 16 C. WEEKLY ACCOMPLISHMENT REPORT FORM …………………………….…..… 17 D. FLOWCHART …………………………………………………………………… 18 2 CHAPTER I PROJECT DESCRIPTION, GOALS AND REQUIREMENTS The game was a 2D arcade game, and the players needed to avoid the falling objects from hitting the spaceship to maintain their current health and score the game. The target audience of this game is the players who range in age from 7 to 18 years old. A. PROJECT DESCRIPTION Our final game called "Space Dodge" was completed as a result of our group's brainstorming, which included a variety of ideas and concepts. This is a 2D arcade game in which it tests the players' reflexes and decision-making skills as they dodge the falling objects in space. The speed of falling objects increases as the score increases, making it more challenging and exciting to play. B. PROJECT GOALS The main goal of this game is to engage the players and make them have fun while making use of their skills when it comes to quick thinking, as the game requires clever tactics to avoid the objects from hitting the spaceship. It will also improve their concentration, as they need to observe the speed and intervals of falling objects while collecting gasoline items to replenish their spaceship health. C. PROJECT REQUIREMENTS There are several tools required to ensure the smooth development and optimal performance of our final game project. This section includes an overview of the game engine, graphics, audio, gameplay mechanics, and game features. a. GAME ENGINE 1 This section shows the game engine of the game. For the game engine, we take into consideration the compatibility of it with C++, our game's dimensions and genre that we were planning to create. We also take into account the system requirements of the engine, as some have large file sizes that could be hard to handle or run on our devices. To ensure we chose the best option, we tested a few engines to determine which would meet the desired needs of our game. We used Visual Studio as our IDE (Integrated Development Environment) for its compatibility and user-friendly interface that makes navigation easy. It also supports multi-language, which makes it more ideal for C++ game development. For the graphics and multimedia elements, we decided to use SFML (Simple and Fast Multimedia Library), seeing that it has the tools to handle 2D graphics and other multimedia tasks. b. GRAPHICS This section shows the graphics of the game. The environment set up of Space Dodge is in outer space with a visually captivating cosmic view of nebulae and vibrant stars. Using SFML for 2D graphics, the game achieves the concept we were working for. The player's spaceship, centrally located at the bottom of the screen, can be easily controlled, allowing smooth navigation to avoid obstacles. Asteroidlike objects serve as the obstacles descending from the top of the screen with various sizes and speeds that add creative visual and gameplay dynamics. Gasoline collectibles appeared randomly that serve to replenish 2 the player's spaceship health. These graphical elements help to create a fun and engaging experience for the players. c. AUDIO This section is for the audio of the game. Retro - Background music to desire the previous generation of games. Bizzare & Alien - Strange sound that mimics the sound in outerspace, in the form of distorted frequency. Sci-fi - Futuristic and Mechanical sounds. d. GAME PLAY MECHANICS This section shows how the mechanics of the game works. Mechanics: ● Move Up, Down, Left, Right ● Avoid abrasive object ● Collect Gas for HP ● Reach High-Score e. GAME FEATURES This section shows the game features. Features: 3 ● Unique 2D graphics A physics engine that simulates realistic movements and interactions within the 2D world, affecting how objects fall or collide. ● Unique audio A comfortable and funny sound that makes the game. ● Simple Controls 2D games often focus on easy-to-learn controls, making them accessible to a wide audience. ● Endlessly Scores Set a better score infinitely surpassing the past score. 4 CHAPTER II PROJECT MILESTONES AND DEADLINES, TEAM RULES AND RESPONSIBILITIES, MOCK UPS, UNIQUE FUNCTIONALITY This Chapter outlines the critical components that drive the development and success of the project, providing a roadmap for the team's progress and collaboration. This section includes an overview of the milestones and deadlines, team rules and responsibilities, mock ups and unique functionality. Together, these components create a cohesive strategy that drives progress and ensures the delivery of a well-rounded project. A. PROJECT MILESTONES AND DEADLINES This section outlines the established detailed timeline with specific milestones and deadlines. These milestones serve as a guide for the project to ensure successful completion of the project. ● ● ● Project Initialization - Deadline: November 24, 2024 - Project first meeting - Game concept finalization - Team formation and roles assignment Initial Coding - Deadline: November 28, 2024 - SFML setup - Game design Final Coding - Deadline: December 2, 2024 5 ● - Game details completion - Performance Testing - Bug fixing Documentation - Deadline: December 9, 2024 - Documentation and PowerPoint completion - WAR form completion B. TEAM RULES AND RESPONSIBILITIES This section provides a comprehensive overview of the role assignment throughout the project development process. To effectively combine the talents and skills of our team members, we have strategically divided our group into two specialized groups. CODING TEAM - The coding team consists of Charles Edward Fallaria, Lemuel Duran, and Jerine Alyanna Santos. - They are responsible for writing clean, efficient, and well-documented C++ code. GAME CONCEPT AND DESIGN TEAM - This group consists of Khristian Maynard Estayani, Ryza Marie Gabriel, and Andria Gianan. - Focused on the creative aspects of the game. - This team works closely with the coding team to translate their design ideas into functional game elements. - This team is also responsible for game testing. 6 FOR DOCUMENTATION - Everyone has their own assignment for the completion of documentation. C. MOCK UPS The mock-ups for Space Dodge showcase the design and layout of key elements in the game, including the start screen, in-game environment, HUD (Heads-Up Display), pause menu, and game over screen. START MENU The Start Menu serves as the initial interface displayed when the game is launched. It features a space-themed design, emphasizing the interstellar theme of the game. The interface provides minimalistic and intuitive instructions for starting or exiting the game, ensuring ease of access for players. Figure 1. Figure 1: Start Menu Key Features: 7 ● Title: The game title, Space Dodge, is prominently displayed at the top of the screen in a bold, futuristic font with visual elements resembling space objects like planets and spaceships. ● Instruction to Start: Below the title, the screen displays the text “PRESS ENTER TO START”, prompting the player to initiate the game by pressing the ENTER key. ● Instruction to Exit: A secondary instruction, “PRESS ESC TO EXIT”, is displayed below, guiding the player on how to close the game if desired by pressing the ESC key. ● Background: The background features a visually stunning cosmic scene, with colorful nebulae and stars, creating an immersive space ambiance. IN-GAME HUD The In-Game HUD (Heads-Up Display) provides vital information to the player during gameplay. It ensures the player can track their performance while maintaining focus on dodging obstacles. The dynamic environment, featuring asteroid-like objects, creates an immersive challenge for players. Figure 2. Figure 2: In-Game HUD 8 Key Features: ● Distance Tracker: Displays the distance traveled, located at the top-left corner of the screen. This updates in real-time as the player progresses. ● Health Display: Shows the player’s current health as a numerical value, also located at the top-left corner. The initial value decreases upon collision with obstacles. ● Highest Distance: Positioned beneath the distance tracker, this indicates the player’s all-time high score, motivating replay ability. ● Player Ship: Centrally located at the bottom of the screen, the ship is controlled by the player to dodge incoming objects. ● Obstacles: Asteroid-like objects of various sizes appear from the top of the screen and move toward the player, requiring quick reflexes to avoid. ● Gasoline Collectible: Randomly appearing on the screen, gasoline items are designed to replenish the player's spaceship health. ● Background: The background features a visually stunning cosmic scene, with colorful nebulae and stars, creating an immersive space ambiance. PAUSE MENU The Pause Menu provides a simple yet visually appealing interface for players when the game is paused. It maintains the game's space-themed aesthetic and provides clear instructions for resuming or exiting the game. Figure 3. 9 Figure 3. Pause Menu Key Features: ● Pause Title: The word PAUSED is displayed prominently in the center of the screen. The text is written in a bold, futuristic yellow font to grab attention and match the space theme. ● Resume Instructions: Below the pause title, the instruction “PRESS P TO RESUME” is displayed in the same yellow futuristic font, ensuring consistency in design and clarity. Prompting the player to resume the game by pressing the P key. ● Exit Instructions: Another line below the resume instruction displays “PRESS ESC TO EXIT”, guiding the player on how to close the game if desired by pressing the ESC key. ● Background: The background features a visually stunning cosmic scene, with colorful nebulae and stars, creating an immersive space ambiance. GAME OVER SCREEN 10 The Game Over Screen appears when the spaceship’s health reaches zero, signifying the end of the game session. It features a bold design with clear instructions to restart or exit the game, maintaining the immersive space-themed aesthetic. Figure 4. Figure 3: Game Over Screen Key Features: ● Game Over Title: The phrase “GAME OVER” is prominently displayed in bold, shattered red font at the center of the screen, symbolizing the end of the current run. ● Restart Instruction: Beneath the title, the instruction “PRESS R TO RESTART” is clearly displayed in the same red futuristic font, guiding players on how to quickly start a new run. ● Exit Instruction: Below the restart message, an additional instruction “PRESS ESC TO EXIT” is included, offering players the option to exit the game entirely. ● Background: The background features a visually stunning cosmic scene, with colorful nebulae and stars, creating an immersive space ambiance. D. UNIQUE FUNCTIONALITY This section outlines the unique functionality of the game Space Dodge. 11 1. Dynamic Difficulty Adjustment The game dynamically increases the difficulty as the player progresses: ● Spawn Interval Adjustment: The interval between spawning obstacles decreases as the score increases. ● Speed Multiplier: The speed of falling and moving objects increases over time. ● Additional Obstacles: The maximum number of simultaneous obstacles increases with the score. 2. Collision Effects with Vibration ● On collision, the player's sprite vibrates (moves slightly left and right) to simulate an impact, creating a unique visual and mechanical feedback for the player. The vibration effect toggles direction and lasts for a short duration. 3. Power-Up System ● Health Power-Ups: Health-restoring power-ups spawn periodically, rewarding players with a health boost and additional score points if collected. ● Scoring Bonus: Collecting a power-up grants a bonus score, incentivizing riskier movements to acquire them. 4. Horizontal Moving Obstacles ● Some obstacles not only fall vertically but also move horizontally, making their paths unpredictable and requiring players to anticipate and react to more complex patterns. 5. Game State Management The game implements distinct states: 12 ● Start Menu: Includes a blinking "Press Enter to Start" message and visually appealing text effects. ● Pause State: Allows players to pause the game, with clear instructions on resuming or exiting. ● Game Over State: Displays a restart and exit option, as well as updates the highest score if surpassed. 6. Visual and Audio Feedback ● Collision Feedback: The sprite changes color on collision (to red) and resets after a short period. ● Dynamic Sound Effects: Includes a collision sound and background music that loops, enhancing immersion. ● Font and Visual Styling: The game uses different fonts for menus, gameplay text, and title, creating a polished and professional feel. 7. Health Management ● The player has a health system, which decreases upon collision with obstacles and can be replenished with power-ups. The health system adds an extra layer of strategy compared to games where a single hit ends the run. 8. Scaling Graphics Sprites are scaled dynamically: ● Obstacles: Random scaling for obstacles creates visual variety. ● Power-Ups: Fixed scaling ensures power-ups are easily distinguishable. 9. Highest Score Tracker 13 ● The game keeps track of the highest score achieved across sessions and displays it prominently, encouraging replay ability. 14 CHAPTER III PROGRAM SOURCE CODE, USERS MANUAL AND WEEKLY ACCOMPLISHMENT REPORT FORM This chapter provides a brief overview of the program's source code, which details the tools, programming languages, and algorithms used to ensure the application's functionality and maintainability. It also includes the User's Manual, a step-by-step guide designed to help users navigate and utilize the application effectively, covering installation, features, and troubleshooting. Additionally, the chapter introduces the Weekly Accomplishment Report Form, a structured template for tracking progress, documenting tasks, and addressing challenges throughout the project's development. A. PROGRAM SOURCE CODE Here entails the detailed breakdown of Space Dodge game source code, explaining each section and its functionality. ● Full Program Source Code: SpaceDodge.cpp ● Includes - These are the header files included for the game. SFML is used for graphics (Graphics.hpp), audio (Audio.hpp), and window management. Other headers (vector, cstdlib, ctime, cmath, ssteam, and iostream) are used for randomization, time management, and mathematical operations. - ● Source Code: includes.cpp Constants - These constants define the game's window dimensions, initial object spawn settings, and reward thresholds. - Source Code: constants.cpp 15 ● FireCharacter Class - Purpose: This class defines the player (FireCharacter), which is represented by a sprite (sf::Sprite) and a texture (sf::Texture). The player can move in all four directions and has health. The handleCollision() method manages effects like vibration when the player collides with obstacles. - Key Methods: ▪ moveLeft(), moveRight(), moveUp(), and moveDown() control the character's movement across the screen, ensuring it stays within the window boundaries. ▪ takeDamage(), and recoverHealth() Manage the character's health by reducing it on collision and restoring it via power-ups. ▪ handleCollision() manages the consequences of collisions, such as taking damage or triggering visual effects. ● Source Code: FireCharacterClass.cpp FallingObject Class - Purpose: This class represents objects (like debris) that fall from the top of the screen. It handles the movement and resetting of the object's position once it goes off-screen. - Key Methods: ▪ The fall() updates the object's downward movement. ▪ The resetPosition() repositions it back at the top after it goes offscreen. - Source Code: FallingObjectClass.cpp 16 ● HorizontalMovingObject Class - Purpose: Inherits from FallingObject. This class adds horizontal movement to falling objects. The object moves left and right within the window boundaries. - Key Methods: ▪ The fall() method moves the object both vertically and horizontally, reversing its direction when it hits the screen edges. ● Source Code: HorizontalMovingObjectClass.cpp HealthPowerUp Class - Purpose: This class defines health power-ups that fall from the top of the screen. The player can collect these to restore health. - ● Key Methods: ▪ The fall() moves the power-up down the screen. ▪ The resetPosition() resets its position when it goes off-screen. Source Code: HealthPowerUpClass.cpp Main Function - Purpose: ▪ Initializing the window and resources (textures, sounds, fonts). ▪ Setting up game objects and UI elements. ▪ Handling game logic, including starting, pausing, and restarting the game. ▪ Running the main game loop where player input is processed, game objects are updated, and the screen is rendered. ▪ - Handling game over conditions and updating scores. Key Methods 17 ▪ Creates the game window using sf::RenderWindow and sets its resolution and title. ▪ Loads textures, fonts, sounds, and music using loadFromFile and initializes game elements like the background, sprites, text, and audio effects. ▪ Tracking time with restart(). ▪ Detecting key presses with isKeyPressed(). ▪ Collision effects are processed with handleCollision() and takeDamage(). ▪ The restartGame() resets the game for a fresh start. - Source Code: MainFunction.cpp B. USERS MANUAL The user manual contains detailed information on how to play the game, including the rules and instruction. Rules - the rules of the game are simple, don't get in contact with falling objects or else your health would reduce. The only falling object you would love to get in touch is the fuel, the fuel will restore your lost health. Instruction - Use arrow keys to move your character. 1. press left arrow key to move left 2. press right arrow key to move right 3. press up arrow key to move up 4. press down key arrow to move down 18 C. WEEKLY ACCOMPLISHMENT REPORT FORM 19 D. FLOWCHART The flowchart below shows the flow of the game. 20
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )