HotStone Game Framework
Software Engineering Architecture Project
Project Overview
HotStone is a comprehensive software engineering project developed as part of the Software Engineering Architecture (SWEA) course. This project serves as a practical application of modern software development methodologies, demonstrating how architectural principles, design patterns, and systematic testing combine to create a robust, extensible card game framework.
The project transforms from simple game logic into a fully playable networked application with a graphical user interface, illustrating the evolution of software architecture from basic mechanics to complex distributed systems.
Course Learning Objectives
The HotStone project was specifically designed to teach and demonstrate critical software engineering concepts:
Core Concepts Covered:
- Test-Driven Development (TDD): Writing tests before implementation to ensure code quality
- Design Patterns: Applying proven solutions to common software design problems
- Compositional Design: Building complex systems from simple, reusable components
- Framework Architecture: Creating flexible systems that support multiple variants
- Systematic Testing: Comprehensive test coverage including unit, integration, and system tests
- Broker Pattern: Implementing remote method calls for distributed gaming
Game Context
Inspiration from Hearthstone
HotStone draws inspiration from popular card games like Blizzard's Hearthstone. These games feature strategic card play, resource management, and turn-based combat. If you're unfamiliar with this genre, the project includes demonstration videos showcasing the user interface and gameplay mechanics.
Framework Philosophy
Rather than creating a single game, HotStone is designed as a framework that supports multiple game variants. This approach demonstrates how proper architecture enables flexibility and extensibility, core principles in professional software development.
Technical Architecture
The HotStone architecture evolved through multiple iterations, each adding complexity and demonstrating new architectural concepts.
Core Architecture Layers:
1. Domain Layer (Game Logic)
- Card management and abilities
- Player state and resources
- Turn management and game flow
- Win/loss conditions
- Game variant rules implementation
2. Framework Layer (Extensibility)
- Strategy pattern for variant behaviors
- Factory pattern for card creation
- Observer pattern for event handling
- Template method for game flow
- Decorator pattern for card abilities
3. Presentation Layer (User Interface)
- Graphical user interface for gameplay
- Card visualization and animations
- Player interaction handling
- Game state display
- Real-time updates and feedback
4. Distribution Layer (Networking)
- Broker pattern implementation
- Client-server architecture
- Remote method invocation
- Network protocol design
- Session management
Design Patterns Implementation
The project extensively employs design patterns to achieve maintainable, flexible code:
Strategy Pattern
Enables different game variants to be swapped at runtime without changing core game logic. Each variant implements specific strategies for:
- Card drawing mechanics
- Mana generation rules
- Special ability triggers
- Win condition evaluation
Factory Pattern
Abstracts card creation, allowing different decks and card types to be generated without tight coupling to specific card implementations.
Observer Pattern
Enables the GUI to react to game state changes automatically, keeping the interface synchronized with game logic without direct dependencies.
Broker Pattern
Facilitates network play by transparently handling remote method calls, allowing the same game logic to work locally or over the internet.
Template Method
Defines the skeleton of the game flow algorithm, letting subclasses override specific steps while maintaining overall structure.
Test-Driven Development Approach
The project emphasizes TDD as a cornerstone of quality software development:
Testing Strategy:
- Unit Tests: Testing individual components in isolation
- Integration Tests: Verifying component interactions
- System Tests: End-to-end gameplay scenarios
- Network Tests: Distributed gameplay validation
TDD Benefits Demonstrated:
- Early bug detection during development
- Confidence in refactoring and architectural changes
- Living documentation through test cases
- Simplified debugging with isolated test failures
- Design improvement through testability requirements
Progressive Development Through Iterations
The course structures development through multiple iterations, each building on previous work:
Early Iterations (1-4):
- Basic game mechanics implementation
- Core domain model design
- Initial testing framework
- Simple game variants
Middle Iterations (5-7):
- Framework architecture introduction
- Design pattern application
- Advanced game variants
- Comprehensive test suites
Final Iterations (8-9):
- Graphical user interface implementation
- Network play capability (Broker pattern)
- Polish and playability improvements
- Performance optimization
Graphical User Interface
The culmination of the project in Iteration 8 includes a functional GUI that transforms HotStone from a code library into a playable game:
GUI Features:
- Visual card representation with artwork
- Drag-and-drop card playing mechanics
- Real-time mana and health displays
- Turn indicator and game phase visualization
- Combat animations and effect feedback
- Interactive deck and hand management
Technical Implementation:
- Observer pattern for automatic UI updates
- Event-driven architecture for user interactions
- MVC pattern separating logic from presentation
- Responsive design for different screen sizes
Network Play Implementation
The Broker pattern enables players to compete over the internet:
Broker Pattern Benefits:
- Transparency: Game logic remains unchanged for local or network play
- Separation of Concerns: Networking code isolated from game code
- Flexibility: Easy to switch between local and remote opponents
- Testability: Network layer can be tested independently
Network Architecture:
- Client-server model with game state synchronization
- Request-response protocol for player actions
- Session management for multiple concurrent games
- Error handling for network failures
- Security considerations for remote play
Skills Demonstrated
- Software Architecture: Designing scalable, maintainable systems
- Design Patterns: Practical application of Gang of Four patterns
- Test-Driven Development: Writing tests first to drive design
- Object-Oriented Design: Encapsulation, inheritance, polymorphism
- Framework Development: Creating extensible, reusable code
- Distributed Systems: Network programming and remote communication
- User Interface Design: Creating intuitive, responsive interfaces
- Refactoring: Improving code structure without changing behavior
- Version Control: Managing complex codebase evolution
- Documentation: Creating clear technical documentation
Game Variants Implemented
The framework's flexibility is demonstrated through multiple game variants, each with unique rules:
Alpha Stone: Basic variant with simple mechanics for learning fundamentals
Beta Stone: Introduces resource management complexity
Gamma Stone: Adds special card abilities and interactions
Delta Stone: Complex variant approaching commercial game depth
Epsilon Stone: Fully playable variant with balanced gameplay
Each variant demonstrates how architectural decisions enable code reuse while supporting diverse gameplay experiences.
Technical Challenges & Solutions
Challenge 1: Maintaining Separation of Concerns
As features increased, keeping domain logic separate from presentation became difficult.
Solution: Strict adherence to MVC pattern and interface-based design maintained clean boundaries.
Challenge 2: Network Synchronization
Ensuring both players see consistent game state over network connections.
Solution: Server-authoritative model with client state validation.
Challenge 3: Test Complexity
Testing networked, GUI-based gameplay required sophisticated test infrastructure.
Solution: Test doubles (mocks, stubs) and dependency injection enabled isolated testing.
Challenge 4: Performance
Complex game state calculations could impact responsiveness.
Solution: Optimization of hot paths and caching of computed values.
Learning Outcomes
This project demonstrates comprehensive understanding of:
- How architectural decisions impact long-term maintainability
- The value of design patterns in solving common problems
- How TDD improves code quality and design
- The complexity of distributed systems and networking
- Balancing abstraction with practical implementation needs
- Iterative development and continuous refactoring
Video Demonstrations
The course includes Danish-language video demonstrations of the final product, showcasing:
- Complete gameplay sessions
- User interface interactions
- Network play functionality
- Various game variants in action
These videos demonstrate the evolution from code framework to playable game, illustrating the practical results of sound architectural principles.
Professional Relevance
The HotStone project mirrors real-world professional software development:
- Enterprise Patterns: The patterns used are standard in large-scale applications
- Team Development: Architecture supports multiple developers working concurrently
- Long-term Maintenance: Design decisions prioritize future extensibility
- Quality Assurance: Comprehensive testing mirrors industry standards
- Distributed Systems: Network architecture reflects modern cloud applications
Conclusion
The HotStone Game Framework project represents a comprehensive journey through modern software engineering practices. By building a complex card game system from the ground up, this project demonstrates not just coding ability, but deep understanding of software architecture principles that scale from small projects to enterprise systems.
The progression from basic game mechanics to a fully networked, GUI-based game illustrates how proper architectural foundations enable continuous evolution and feature addition without compromising code quality or maintainability.