Skip to content

bdtripp-dev/haunted-house

Repository files navigation

Haunted House

I built a text‑based adventure game where the player explores a haunted house and tries to find a way out.


Why This Project Matters

Originally a school assignment, Haunted House evolved into a project where I focused on building a clean, modular game engine grounded in real software‑engineering principles. Even though it’s a simple text-based adventure game on the surface, the project pushed me to think about architecture, state management, and scalability. Every part of the game — rooms, items, commands, player stats — is modeled as its own object, making the system easy to maintain and extend.

I also wanted to explore how a traditional CLI game could be adapted for the web. The backend exposes a small REST API that accepts the same text commands as the command‑line version, and the browser UI acts as a lightweight terminal that sends commands to the engine. This separation of concerns made it possible to reuse the same Java engine for both interfaces.

The project gave me hands‑on experience with Spring Boot, REST design, Dockerized development, and writing clean, maintainable Java code with complete Javadoc documentation. It’s a small game, but it reflects real engineering decisions and a focus on clarity, structure, and maintainability.


Play Online

Play Haunted House

(Runs in your browser with no installation required.)


Running the Project Locally (for developers)

If you'd like to explore the source code or run the engine on your own machine, you can launch the full stack (Java backend + web frontend) using either Docker or Maven.

1. Clone the Repository

git clone https://github.com/bdtripp-dev/haunted-house.git
cd haunted-house

2. Launch the Application

You can run the application using Docker (production‑like environment) or Maven (best for active development).

Option A: Docker (Recommended)

This builds and runs the application in a clean, reproducible environment.

docker build -t haunted-house .
docker run -p 8080:8080 haunted-house

Option B: Maven

Uses the Maven Wrapper so the project builds even if Maven isn’t installed globally.

./mvnw spring-boot:run

3. Access the Game

Once the application starts, open your browser to:

http://localhost:8080

This loads the web‑based terminal interface.


Gameplay

Here’s what the game looks like in action:

Gameplay screenshot showing the terminal interface and a room description


Some Commands to Get You Started

go: move to another room. Type go + "space" + "a direction" Hint: Directions are north, south, east, or west

help: get info on how to play the game and a list of all the commands

look: get a description of your location and directions that you are able to move

items: print a list of items that you are carrying and descriptions of each item

stats: print a list of the player's current stats

quit: Use to quit the program


Tech Stack

  • Languages:
    • Front-end: HTML, CSS, JS
    • Back-end: Java
  • Framework: Spring Boot
  • DevOps / Workflow: Docker, Dev Container, GitHub Actions

Documentation

View Javadoc


Key Engineering Decisions

  • Designed a modular game engine using object‑oriented principles where rooms, items, commands, and player state are modeled as independent components with clear responsibilities.

  • Implemented a command‑parsing system that maps user input to executable game actions, making it easy to add new commands without modifying existing logic.

  • Separated engine logic from the UI layer, enabling the same Java backend to power both the CLI version and the fully custom web‑based terminal UI.

  • Built a REST API that exposes game actions (/start, /command) and returns structured JSON responses for the browser client.

  • Used Spring Boot’s dependency injection to wire together the controller, service layer, and game engine, keeping components loosely coupled and easy to test or replace.

  • Containerized the application with Docker to ensure consistent local development and deployment environments.

  • Set up GitHub Actions CI/CD to automatically build and deploy the project on each push.

  • Wrote complete Javadoc documentation to make the engine understandable, maintainable, and easy to extend.

About

"Haunted House" is a text based adventure game in which the user can explore rooms in a haunted house. The goal of the game is to try to find your way out of the house.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors