First approach
Project build (.exe) available at: https://www.dropbox.com/scl/fi/c8z0okt82ix99zfvmdch2/Galaxian-game.zip?rlkey=7j8arcacrjen9hsqfpy2nkqtb&st=jo2oicz5&dl=0
When I started developing Galaxian V2 , I faced my first major challenge: getting the project structure right. In the initial release, most of the game logic was contained in a single file, GameplayScreen
, and a header file where I included the classes Enemy
and EnemyManager
. This structure helped me get started, but I soon discovered that maintaining and expanding the code in this format was complicated.
That’s why I decided to rebuild the project, creating a new version: Galaxian V2 . With this modular approach, each component (player, enemies, projectiles, and game screens) now has its own set of files, making the code much more maintainable and scalable under an object-oriented architecture. Throughout the process, I used Git and SourceTree to manage version control.
Gameplay and Code Decisions
As I developed the game, I made several decisions to improve the gameplay and make the code clearer:
- I changed the opening screen from “Title” to “Logo” for a smoother intro, allowing the player to skip it with a click or by pressing “ENTER”.
- I added player mechanics with a hover function
clamp
to keep the ship within the play area, as well as implementing a vector-based projectile system with a cooldown timer to control firing. - I opted to have projectiles only appear when the player presses the spacebar, improving visual clarity and shooting control.
- I’ve added random cooldowns for enemy shots, making the game more unpredictable and challenging.
- I decided to display the lives in the bottom left corner, allowing the player to easily see this essential information without being distracted from the gameplay.
- I adjusted the scoring system so that the player loses 100 points when hit, incentivizing fairer play; I also made the score display on the end screen.
- Updated the instructions text in the options menu to accurately reflect the game mechanics.
- Finally, I added background music and sound effects (SFX) downloaded from Pixabay and slightly modified some sprites in Photoshop to give the game its own look.
Conclusions and Challenges
Developing Galaxian has been an experience that’s both challenging and rewarding. With my limited experience in C++, understanding the object-oriented architecture and the provided template was a hurdle, and a more detailed explanation along with the initial resources would have been helpful. Sometimes, the examples on the course GitHub and in the CAA1 solution differed significantly from the template structure, which complicated the learning process.
Despite these challenges, working on texture management, implementing player mechanics, and understanding the scope of variables in an object-oriented framework has been a valuable learning experience and an important step in my development.
Working on this project has been a great way to explore graphical programming and game development in C++. If you’re looking to improve your proficiency in this language and tackle a modular project, Galaxian V2 is a challenge I highly recommend!
Resources
- Raylib Cheatsheet
- Yesteryear – Google Fonts
- The Vector Container — C++ Programming Fundamentals
- Rendering Textures and Playing Audio in Raylib – YouTube
- Chat with ChatGPT for help with resources, bug fixes, and code cleanup: ChatGPT