My "Text Adventure Framework" was an experiment I created while trying to build a room-based text adventure game in C#. Rather than forcibly code each interaction into the game loop, I wanted to try a more scalable solution that made creating and editing content a lot easier. The end result, was a framework that manages text-based events in a series of navigatable rooms, all room/event data can easily be loaded at start.
- GameManager - Handled initializing game data and running the core loop of the game.
- InputManager - Determined the expected type of input given the player's state, and interpreted that input into actions for the game manager to take.
- Room - Each room can contain multiple events, contributed either by the room itself or NPCs assigned to the room. Rooms cannot be traveled to unless they have been unlocked by an event.
- Event - The core interactive component of the game. Capable of forming a nested structure as a root-event or a sub-event. Could be assigned to a room or NPC.
- Title, Content, Messages, Etc. - Each event contains a variety of text content fields, used to denote what displays on-screen when the event is active, or if the event is being listed as a prompt inside another event.
- Add/Remove Object - A function that allows the event to add or remove an object from the player's inventory.
- Enact Challenge - A function that allows the event to test if one of the player's values is above a certain threshold. Depending on whether the challenge was passed, success/failure messages stored on the event would be displayed.
- Enact Purchase/Sale - Sells or buys an item referenced by the event. Cost/Revenue is affected by the player's trade mastery level.
- Discover Room - Unlocks a room so it can be accessed by the player's travel menu
- NPC - Simply a organizational entity for storing events. Can be added to a room to contribute its events to that room.
- Item - An entity that can be purchased, sold, or traded. Is managed by the player's inventory. Contains only a name, description, and value.
- GameData - Handles the storage or all game content, including definitions and hierarchies for all rooms, events, and items.
- ConsoleBuffer - Handles the formatting of text that appears within the console window. Handles display and refresh of the different menus, room, and event view. Additionally handles prompts, error outputs, and word wrapping.