Component-based 2D Game with Data-structures, AI and algorithms


In this project we had to develop a 2D game and apply different techniques learned in other courses, such as Component-Based Software Engineering, Artificial Intelligence and Data Structures and Algorithms.
The primary focus of the game was that it had to be component oriented and had to have components that could be added and removed at run-time, i.e., a “Player”, “Enemy” and “Weapon” component. A component framework had to be applied, but since dynamic loading had to be possible, only OSGi and NetBeans Module system were allowed. In my group we chose to go with OSGi.

One of the very cool aspects of the game was the two different gameplay modes. The first being an adventure mode, where it’s possible for the player to explore the map and wander about. On this map the player can find different machines containing monsters they can add to their team. Using these monsters the player can find NPC’s patrolling around, waiting to battle the player. This then enables the second gameplay mode, the turn-based battle gameplay mode, with similarities to other games such as Pokémon and Slay the Spire.

During a battle the NPC is controlled by an AI. The AI is built as an iterative deepening minimax algorithm with alpha-beta pruning, allowing the enemy to find the best possible move to make, based on its current knowledge state. This makes it so the AI isn’t all-knowing, which would create and unfair advantage. Instead, it only knows what it has seen, such as the monsters the player has, and the moves those monsters have used.

The project was built entirely using Java, with some OSGi specific configurations through XML files to allow for dependency injection, etc.

TagsGitHub - Source CodeTechnologiesJava
Date4th Semester
February - May

More Projects