Guardians is a Tower Defense game developed using the Godot Engine with C# and GDScript, created as part of a university project to implement core Data Structures and Algorithms (DSA) in a practical, game-based environment. The game focuses on defending a base from waves of enemies while utilizing custom-built data structures to manage game behavior.
Game.tscn: Main scene. Initializes the game, loads sub-scenes (Map, Spawner, Guild), and manages game state.Map.tscn: Contains the game environment and the base to protect.Spawner.tscn: Manages enemy creation and spawn logic.Guild.tscn: Displays guild-related UI (optional).EndingScene.tscn: Final game-over screen showing the final score and retry option.
- Enemies spawn from specific tiles.
- They path toward the base and deal damage upon contact.
- Player accumulates score when enemies are defeated.
- Game ends when base health reaches zero.
- Final score is displayed on
EndingScene.
- Class:
Queue<T>(linked-list based) - Usage: Used in the Spawner to preload and dequeue enemies in FIFO order.
- Purpose: Demonstrates queue-based enemy wave management.
- Location:
Spawner.cs
enemyQueue.Enqueue(enemyInstance);
var enemy = enemyQueue.Dequeue();- Class:
HashTable - Usage: Maps enemy types (e.g., "FastEnemy") to score values.
- Purpose: Used by
ScoreManagerto reward points based on enemy type. - Collision Resolution: Open Addressing with Linear Probing.
enemyRewards.Insert("SlowEnemy", 10);
int reward = enemyRewards.Search("FastEnemy");- Scene:
ScoreManager.tscn - Singleton Node: Accessed across scenes to track score.
- Integration: Updates score on enemy death and displays it on game over.
- Uses: Custom hash table internally.
scoreManager.AddScore("TankEnemy");
int finalScore = scoreManager.GetScore();- Loads all core scenes (Map, Spawner, Guild).
- Connects to base’s
BaseDestroyedsignal. - On game over, transitions to
EndingSceneand passes score.
- Manages base health.
- Emits signal when health drops to zero.
- Integrates with
ProgressBarUI.
- Manages enemy spawn timing using a
Timer. - Uses custom queue to spawn enemies in order.
- Handles logic for when an enemy dies.
- Communicates with
ScoreManagerto award score.
- Central score tracking logic.
- Stores enemy type rewards using custom hash table.
- Displays final score using a
Label(FinalScoreLabel). - Contains a retry button to return to main menu.
- Game Engine: Godot 4.x (C# scripting)
- Language: C# (.NET 6)
- UI: Godot Control Nodes (Label, Button, ProgressBar)
- Audio: Background music integrated using
AudioStreamPlayer
- When the base is destroyed,
BaseDestroyedsignal triggersOnBaseDestroyedinGame.cs. - The score is retrieved from
ScoreManagerand passed toEndingScene. EndingScenedisplays the score using a label.
endingScene.UpdateFinalScore(finalScore);- ✅ Applied Queue (FIFO logic) in enemy spawning.
- ✅ Applied Hash Table to score management and retrieval.
- ✅ Designed custom data structures from scratch.
- ✅ Integrated data structures in real-time game logic.
- ✅ Built and transitioned between modular scenes in Godot.
- ✅ Signal-based architecture and event handling in C#.
- Add tower placement & enemy pathfinding.
- Implement additional DSA concepts (Stack, Heap, Graph).
- Save/load high scores.
- Multiplayer support or difficulty scaling.
- Developed by: Hassan-Mef , Aliyan Waseem , Shaheer , Feham
- University Project - Data Structures & Algorithms (DSA)
- Engine: Godot Engine + C#
Guardians/
├── Scripts/
│ ├── Game.cs
│ ├── Base.cs
│ ├── Spawner.cs
│ ├── EnemyBase.cs
│ ├── ScoreManager.cs
│ ├── CustomDataStructures/
│ ├── Queue.cs
│ ├── HashTable.cs
├── Scenes/
│ ├── Game.tscn
│ ├── Map.tscn
│ ├── Spawner.tscn
│ ├── EndingScene.tscn
│ ├── ScoreManager.tscn
│ └── Guild.tscn
├── Assets/
│ ├── Sounds/
│ └── Textures/
└── README.md
This project is intentionally focused on demonstrating DSA in practice, so some design choices prioritize academic integration over full game polish.