Skip to content

furbgg/Java-Text-Adventure-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Note: Language Context

Please note that this project was written in German as part of my Ausbildung (German vocational training). Therefore, all variable names, comments, and console outputs (System.out.println) within the source code are in German.


Java Text Adventure Game Engine (v1)

About This Project

This is a complete, runnable "Choose Your Own Adventure" (CYOA) / Text-Based RPG.

This project is not just a simple story; it is a data-driven game engine. The game's logic (the while loop) is completely separate from the game's content (the story, options, and locations).

Core Concept: Data-Driven Design

All of the game's "rooms," "options," "text," and "connections" are stored in a single String[][] auswahl array. The main method simply acts as an engine that reads this array to run the game.

How the auswahl Array Works:

Each row in the array is a "node" (düğüm) with a specific structure: { "Parent_ID", "My_ID", "Option_Text", "Display_Text", "Auto_Transition_ID" (Optional) }

  • Parent_ID: Which room this option should appear in.
  • My_ID: This room's unique ID.
  • Option_Text: The text shown to the user as a choice (e.g., "Geh in die Wildnis").
  • Display_Text: The story text shown when the user enters this room.

Key Features

  • State Machine: The engine uses an aktuelleAuswahl variable to track the player's current "state" (location).
  • Dynamic Options: The engine dynamically scans the auswahl array and only shows the user options whose Parent_ID matches the aktuelleAuswahl.
  • Robust Input: It validates user input (while (!list.contains(benutzerauswahl))) to ensure the user can only pick a valid, available option.
  • Forced Transitions: The engine supports an (optional) 5th element in the array (nachsteID). This allows some choices (like "Lauf vor dem Monster davon") to automatically force the player to a new location (like the "Bar") without asking for more input.

To change or expand the entire game, one only needs to edit the auswahl array. The core Java logic does not need to be touched.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages