Space Invaders


Overview:

This project is a modern remake of the classic game Space Invaders, featuring several enhancements. It was developed using SDL2 and C++ programming language, utilizing a Top-Down/Manager architecture. The game incorporates a scrolling tile map, allowing for a dynamic and continuously changing game environment. The enemy ships in the game utilize flocking AI, enabling them to exhibit collective behavior while engaging the player. This adds an extra layer of challenge and strategic gameplay. Additionally, the game features a wrap-around system for both the enemy ships and the player. This means that when any of these entities reach the edge of the screen, they wrap around to the opposite side, allowing for seamless movement and engagement without any boundary restrictions.

  • Solo project
  • Scrolling tile map
  • Flocking AI
  • Graphics library
  • Top-Down/Manager
  • Singleton
  • CMake

Completion: March 2023

Duration: 3 days

Platform: C++/SDL2


Contribution:

Core architecture

For this project, I adopted the Top-Down/Manager architecture as the core framework. The implementation revolves around the concept of managers, which are Singleton objects responsible for handling various aspects of the game. Additionally, I developed a robust system of Game Objects, inspired by Unity, to effectively manage and track all the objects within the game. This Game Objects system facilitated the rapid implementation of new systems and objects, enabling efficient development and integration of additional features. By employing the Top-Down/Manager style and the Game Objects system, the project achieved a structured and scalable architecture, allowing for flexibility and ease of expansion in the game's development process.

Map design

Wanting to make the game more polished, I delved into the fascinating subject of scrolling tile maps. Using GIMP, I created a set of tiles and assembled them into a tile map file. Leveraging this tile map, I successfully achieved the illusion of infinite scrolling, providing the sensation that the spaceship is continuously flying. This technique enhances the game's immersion and creates a dynamic and captivating gameplay experience for players.

Enemy AI

In the game, players are faced with the task of battling against aliens, and to control the enemy behavior, I implemented AI using the flocking algorithm. By utilizing the flocking algorithm and incorporating a separation factor, the aliens are able to move collectively as a cohesive unit while maintaining a certain distance from each other. This creates a visually appealing effect of the aliens moving as a mass while avoiding collisions. Additionally, the implementation of a wrap-around system for the enemies allows them to continuously circle around the map, making their paths unpredictable and adding a significant level of challenge for players. The combination of flocking AI and the wrap-around system creates a dynamic and engaging gameplay experience as players strategize and adapt to the unpredictable movements of the alien forces.

Player

In this Space Invaders remake, players assume control of a ship and are granted the freedom to navigate the map using user input. Similar to the enemies, the ship benefits from the wrap-around system, allowing for seamless movement. To combat the alien forces, the player possesses the ability to shoot bullets. By utilizing circle collision detection, collisions between bullets and aliens, as well as between the player and the aliens, are accurately detected. This collision detection mechanism adds a crucial gameplay element, enabling players to strategically engage and eliminate the alien threats.


closing thougths:

This modern remake of the classic game Space Invaders is featuring numerous enhancements to deliver an engaging gameplay experience. Developed using SDL2 and C++, the game embraces a Top-Down/Manager architecture for efficient management of game elements. Notably, the game incorporates a scrolling tile map, creating a dynamic and ever-changing environment. The enemy ships utilize flocking AI, exhibiting collective behavior while engaging the player, and a wrap-around system adds unpredictability to their paths. The player controls a ship, benefiting from the same wrap-around system, and can shoot bullets using circle collision detection for precise interactions with both enemies and aliens. With a combination of architectural design, captivating map creation, advanced enemy AI, and engaging player mechanics, the game presents a challenging and immersive experience for players to enjoy.