A Java Swing Educational Game for COMP 132
Knowledge Siege is a 2D educational Java game built with Java Swing, OOP principles, and file handling.
Your goal is to survive 3 levels of academic “Knowledge Keepers”—Section Leaders, TAs, and Professors—while collecting information to gain points and avoiding harmful questions that reduce health.
This project was developed as part of COMP 132: Advanced Programming, demonstrating mastery of GUI programming, inheritance, polymorphism, exception handling, and game loop logic.
- Register new users
- Login with existing accounts
- Users select a profile image for gameplay
- Move left and right using keyboard arrows
- Section Leaders (SLs)
- Teaching Assistants (TAs)
- Professors
- Move horizontally at different speeds
- Shoot ShotBoxes:
- ❓ Questions → deal damage
- 💡 Information → award points
- Text content of each shot is displayed on a side panel
| Level | Enemies | Required Score | Difficulty |
|---|---|---|---|
| 1 | 4 SLs | 50 | Low |
| 2 | Remaining SLs + 2 TAs | 100 | Medium |
| 3 | Remaining TAs + 2 Professors | 150 | High |
- SL: slow shots
- TA: medium shots
- Professor: fast shots
- Colliding with ❓ = health loss
- Colliding with 💡 = score gain
The game loads educational content from two files:
- questions.txt
- info.txt
Each file contains 30+ entries, split by difficulty:
- 10 for SLs
- 10 for TAs
- 10 for Professors
Missing files trigger custom exceptions + GUI warnings.
The project uses:
- Inheritance (SL → TA → Professor hierarchy)
- Abstract classes & interfaces
- Java Collections
- Encapsulation of drawing logic
- Separation of logic and GUI (MVC style)
- Collect 💡 information to earn points
- Take damage from ❓ questions
- Scoreboard:
- Sorted by score (descending)
- Same user → Game1, Game2, Game3…
A detailed log file is generated containing:
- Game start
- Collisions (info collected or damage taken)
- Score updates
- “User is unable to move.” events
- Level transitions
- Game Over / Victory
The GUI is created using:
JPanelJButtonJLabelJComboBoxJOptionPanejavax.swing.Timerfor:- Movement
- Collision checking
- Animation
Custom images are used for characters.
- New user registration
- Login system
- GUI scoreboard
- Player movement
- Keeper behaviors (SL, TA, Professor)
- ShotBox attacks and text display
- Score/health updates
- Level transitions
- Game Over / Victory screens
- Detects missing / empty content files
- Prevents out-of-bound movement
- Shows meaningful GUI errors