A functional interpretation of the classic Tower Defense genre, implemented in Haskell with a graphical interface powered by gloss. Players must strategically position towers to prevent waves of enemies from reaching their base, utilizing different projectile types with unique synergies and effects. Built for Laboratórios de Informática I (1st year, Software Engineering — Universidade do Minho).
This project was featured in the LI1 Hall of Fame at Universidade do Minho.
Play the game online: Immutable Towers - Web Version
Browse other featured projects: LI1 Hall of Fame
| Dependency | Notes |
|---|---|
| GHC | Glasgow Haskell Compiler |
| Cabal | Haskell build tool |
| gloss | Graphics library for rendering |
| HUnit | Unit testing framework |
From the project root:
cabal buildThis produces the game executable from the Haskell sources.
Launch the interactive graphical interface:
cabal runThe game features:
- Mouse-driven interaction for tower placement and upgrades
- Strategic resource management through the in-game shop
- Progressive difficulty through wave-based enemy spawning
- Level progression system with save/load functionality
Execute the automated test suite:
cabal test- Grass — standard buildable terrain
- Dirt — alternative buildable surface
- Water — non-buildable obstacle
| Projectile | Effect |
|---|---|
| Fire | Continuous damage over time |
| Ice | Freezes enemies, halting movement |
| Resin | Reduces enemy movement speed |
| Poison | Applies weaker Fire and Resin effects simultaneously |
| Laser | High-damage precision targeting |
- Dynamic enemy states with directional movement
- Health and speed attributes
- Portal-based wave spawning system
- Visual status indicators and animations
immutable-towers/
├── src/
│ ├── Main.hs # Gloss-based graphical interface
│ ├── Jogo.hs # Global game state management
│ ├── Mapa.hs # Map representation and validation
│ ├── Base.hs # Player base state and mechanics
│ ├── Torre.hs # Tower definitions and projectile logic
│ ├── Inimigo.hs # Enemy movement and effect system
│ ├── Portal.hs # Wave generation and portal management
│ └── Testes.hs # HUnit test suite
├── images/ # Game sprites and visual assets
│ ├── inimigo/ # Enemy directional sprites
│ ├── torre/ # Tower graphics
│ └── terreno/ # Terrain tiles
├── Enunciado.pdf # Original project specification (Portuguese)
└── *.cabal # Cabal project configuration
This implementation includes several enhancements beyond the base requirements:
- Isometric rendering — Rich visual representation with depth perception
- Advanced tower mechanics — Including laser-based towers with unique targeting
- Mouse interaction — Click-based tower purchasing and positioning
- Visual effects — Animations for combat, projectiles, and game events
- Level progression — Multi-stage difficulty scaling
- Persistent state — Save and load game functionality
The project includes comprehensive unit tests implemented with HUnit.
Run the full test suite:
cabal testTest coverage includes:
- Map validation logic
- Enemy pathfinding and state transitions
- Tower targeting and damage calculations
- Projectile synergy effects
- Portal wave generation
For detailed project specification and requirements, refer to:
Enunciado.pdf— Original project statement (Portuguese)
- Guilherme Ferreira - A111042
- Lucas Pinto - A111042

