Inspired by the legendary game of breaking bricks with a ball, Breakout, a game created entirely in OpenGL!
Using the libraries GLAD, GLFW, GLM, Irrklang and Freetype. Following the fabulous tutorial from: https://learnopengl.com/In-Practice/2D-Game/Breakout
GitLab repository available at: https://gitlab.com/jongompal/ch3-pg-final-project-in-opengl
Important characteristics of the project
Programming Challenges
- Configuration and Libraries:
- I found problems with freetype due to differences in the structure of the project.
- I solved problems with the naming of shaders files (changed
sprite.fs
tosprite.frag
) and corrected the functiongetShader
to handle references correctly.
- Object Oriented Programming (OOP):
- I started to modularize the project by creating reusable classes, like the Text Renderer .
- Smart Pointers:
- Resolved compiler conflicts related to
Game::~Game
and memory management with smart pointers .
- Resolved compiler conflicts related to
- Power-Ups Mechanics:
- Fixed issues with power-ups not restarting when restarting the game.
- I adjusted the spawn rates to improve the game experience.
Gameplay Decisions
- Sprites and Visual Design:
- I replaced the ball sprite with a custom chicken sprite.
- I created a custom texture for the “second chance” power-up , using a heart symbol.
- New Power-Up: Second Opportunity:
- Added a modifier that allows the ball to touch the bottom of the screen once without missing.
- This power-up has a visual effect that includes a green gradient in post-processing.
- Game Difficulty Balance:
- I adjusted the appearance rates of power-ups to facilitate the overcoming of levels.
- I increased the height of the palette and the size of the screen to accommodate progress bars and visual effects of the power-ups .
- Simplified Level Progression:
- I replaced the selection of levels by a progressive system (levels from 0 to 4).
- I implemented the logic to advance to the next level when all the bricks are destroyed.
- Level Progression:
- I implemented progressive levels (from 0 to 4) and simplified the game states (
GAME_ACTIVE
,GAME_WIN
,GAME_LOSE
). - I decided not to include lives for a more challenging and progressive experience.
- I implemented progressive levels (from 0 to 4) and simplified the game states (
Notable Additions and Decisions
- Added a progress bar at the bottom of the screen that shows how much time is left for an active power-up to finish . If there is more than one, they are stacked on top of each other and use the corresponding color to differentiate them. ( Important note: the speed and palette size effects are cumulative and do not have a time bar ).
- For the extra power-up , I decided to implement a “second chance” modifier. This power-up allows the ball to touch the bottom of the screen once without restarting the game. I also designed a texture for the sprite with a heart and added a post-processing effect that generates a green gradient from the bottom, with a “multiply” blending option to show that it is enabled.
- In addition, I added text rendering functionality.
References
- Laelath. (n.d.). OpenGL-Project/OpenGL-Project/.gitignore at master · laelath/OpenGL-Project. GitHub. Repository .
- OpenAI. (2024). ChatGPT (December 18th version) [Language model]. platform
- Conversation with ChatGPT to solve compilation errors, contribute ideas and clean code: Link 1 and Link 2 .