- Name: Hoàng Duy Thịnh - K68J - UET
- Student ID: 23020708
- Major Project: Space Battle (INT2215_52 - Advanced Programming)
Space Battle is an action game. In this game, players control a spaceship and use weapons and various tactics to shoot down enemies to achieve the longest survival time and the highest number of eliminated enemies.
-
The game includes full support functions for players to exit the game, restart the game, game instructions. Besides using basic keyboard and mouse controls, players can also use controllers for the gaming experience, use ESC key to pause the game...
-
Features dynamic sound effects that describe the game's functions and actions.
-
Video demo of gameplay & general source code explanation: Game Demo Link
-
(Additional) Video of pure gameplay experience: Additional Link
Download the game (compressed as .zip) from this repository.
Extract the game to a folder and run run.exe to start playing.
Step 1: Clone this repository to Visual Studio Code environment: Repository Link
Step 2: Open Terminal and navigate to the game folder (you can use the Ctrl + Alt + N key combination), type make then press Enter, wait about 10 seconds and enjoy the game.
1. PLAY
-
When the player clicks the PLAY button - confirming participation in the game, the screen will guide the player to the control function selection section.
-
The game provides players with 2 choices for spaceship control functions:
| Control | Keyboard | Gamepads |
|---|---|---|
| UP | W | Joysticks |
| DOWN | S | Joysticks |
| LEFT | A | Joysticks |
| RIGHT | D | Joysticks |
| Shoot | Mouse | Gamepads |
|---|---|---|
| Normal | Left Mouse | (A) |
| Ultimate | Right Mouse | (B) |
-
Players choose their preferred control function by clicking on the description bar of that function:
-
ENTER GAME
-
Players will control the character that appears in the center of the screen:
2. EXIT
- When the player clicks the EXIT button - the game window closes and the game ends.
3. ACHIEVEMENT - Save function
- This function saves records of the number of enemies the player has defeated in one game session.
- The LEVEL function represents the game experience that the player has accumulated. Will level up when the Gold that the player accumulates through gaming sessions reaches 500.
- The update function completely upgrades the appearance of the Spaceship when leveling up. All spaceships have vivid animated sparkling light effects.

- Records achievements after a game session that the player achieved:
-
Mini Enemy
: Small enemy objects, will add 1 object every 15s, no addition during boss existence time. -
Killed Enemy Icon
: Records the number of enemies defeated by the player. -
Ultimate(Rocket)
: Number of rockets the player has (increases by 1 after every 5 enemies defeated). Unlike normal bullets, rockets can penetrate enemies, except Boss but also deal higher damage to Boss. -
Heart(Lives):
: Number of spaceship lives (-1 when colliding with enemies / hit by enemy bullets). -
Controller Method: Lets players know which control method they are using! Keyboard icon
means Mouse and Keyboard method, controller icon
means Controller method. -
Pause Button: If you want to pause the game or restart while in the game, players can press ESC, the game window will show the Settings page:
-
Click on HOME to return to the initial MENU window. Players can click PLAY to restart.
-
Click on RESUME to continue the paused game.
-
And some other components...
-
Basic game layout:
- If you're wondering what those colorful icons appearing in the middle of the game screen above are? Those are features that help players enjoy a comfortable experience with over 20 skills (with future development potential) for the main character. All skills come with appropriate visual effects and sound.
- Example: Skill that binds and stuns enemies
Attack enemies with bullets or use skills, don't let enemies or enemy bullets touch the spaceship. If touched, the number of lives will decrease by 1 (bottom left corner of the game window). By default, when starting the game, players have 3 lives.
The game ends when the player's lives reach 0.
Skill icons appear randomly with random probability after defeating enemies (may or may not appear). Players move the spaceship to touch the icon to automatically activate the skill:
- And some other interesting skills that players will experience when participating in the game.
- The item drop rate when defeating enemies is 50%, items will be randomly selected. All configured skills include animations and dynamic sound effects.
- After appearing, skill icons will shatter (disappear) if after a set default time period or when enemies collide with them.
-
SDL2.0 library.
-
Uses many classes, vectors, file separation, inheritance...
-
Optimizes the creation of multiple objects by resetting random positions of enemies moving from the 4 sides of the screen after being defeated, enemy bullets are handled similarly.
-
Applies mathematical knowledge to calculate rotation angles and enemy movement toward the player without overlapping each other. Sets enemy bullet paths to aim relatively toward the spaceship, creating difficulty and surprise while maintaining game balance. Calculates movement and appearance for spaceship bullets, contributing to unique shooting skills.
-
Handles time, mouse and keyboard operations, controllers, sound, animated images, text. Manages addresses and memory when working with variables like pointers... avoiding memory loss and leaks.
-
Creates menus, pause game features, game restart, record keeping, saves necessary statistics to create Level features and unlock new spaceships, handles button presses for navigation between menus.
-
Handles mouse, keyboard, controller events, controller vibration function (if available).
- Presented through game demo video.
-
How to use and install SDL2.0 on VSCODE and CodeBlock environments.
-
How to use SDL2.0 library, program management: Referenced from lazyfoo and videos by Ms. Tran Thi Minh Chau, Stack Overflow, YouTube channels: Software Development AZ123, codegopher, Let's Make Games,...
-
Images: Google search combined with self-design.
-
Sound: Google search.
-
Adjust game difficulty: Players can choose the initial number of enemies that appear. Not only can players eat the dropped skills, but enemies can also consume those skills, appropriate to the enemy object and update that skill feature to the enemy, making the game more interesting.
-
Update leaderboard feature, after each game session players will be asked to enter their name to save their game results.
-
Develop Multiplayer feature:
- 2 PLAYERS VERSUS ENEMY (Compete for number of enemies defeated or survival time (with collision handling between 2 players) / Same team (no collision handling))
- PLAYER 1 VS PLAYER 2 (Set up blood_bar like boss, handle collisions, eat skills and fight each other.)
-
Update more new skills.
-
I feel I have improved many skills in algorithmic thinking and coding, ideation ability, planning and step-by-step execution.
-
Learned how to setup environment, use external libraries. Memory management with address variables, pointers, dynamic allocation...
-
Applied knowledge from various university subjects into the program.
-
Learned how to perform individual tasks, explore and learn from many sources of materials.
The end!
THANKS FOR READING MY README.





























