How jaydielemans/temple-of-doom-herkansing-januari-2026-module-b-2171965 works
This repository is a .NET console game with a clear layered separation between orchestration, domain logic, content loading, and console rendering.
At the top level, the solution is split into four main projects plus the executable:
• TempleOfDoom: the console application entry point
• TempleOfDoom.Controllers: game orchestration and user-input handling
• TempleOfDoom.Models: the domain model and game rules
• TempleOfDoom.Services: level loading, parsing, and object construction
• TempleOfDoom.View: console rendering and object-to-text mapping
Runtime shape
The game starts in Program.cs inside the executable project. From there, the application is assembled from controllers, services, the domain model, and the console view. This is not a web app or client-server system; it is a single-process interactive console game with a loop driven by keyboard input and game-state updates.
Main subsystems
1) Game orchestration and flow control
The TempleOfDoom.Controllers project appears to be the application’s coordination layer:
• GameSetupController initializes a new game session
• GameFlowController likely owns the main gameplay loop and turn progression
• InputController translates raw keyboard input into game actions
• InteractionController handles in-game consequences such as collisions, pickups, triggers, and door/room interactions
This layer is where the game’s high-level flow is managed. It does not appear to contain core domain rules itself; instead, it coordinates the model and invokes services/view as needed.
2) Domain model
The TempleOfDoom.Models project contains the game’s core state and behavior.
Game objects
The model is built around a hierarchy of in-game objects:
• Entities:
- Player
- BaseEntity
• Floor and map elements:
- FloorTile
- Wall
- ConnectionTile
- special floor tiles such as Portal, ConveyorBelt, and generic Tile
• Items and triggers:
- Key
- SankaraStone
- Boobytrap
- DisappearingBoobytrap
- PressurePlate
• Doors:
- Door
- decorator-based door variants such as:
- ColoredDoorDecorator
- ToggleDoorDecorator
- OpenOnOddDoorDecorator
- OpenOnStonesInRoomDoorDecorator
- ClosingGateDoorDecorator
Level structure
The world is organized into:
• Level
• Room
This suggests a room-based dungeon layout, with rooms composed of tiles, doors, items, and entities.
Interfaces and contracts
The model uses interfaces to define behavior boundaries:
• IEntity, IMovable
• IInteractable, ITriggerItem, IItem
• ITile, ITileContent
• IDoor
• IUpdatable
There is also an Observer abstraction:
• IObservable
• IObserver
That likely supports state-change notifications, probably from model objects to the view or controller layer.
Enums and shared state
Several enums define the game vocabulary:
• Direction
• PlayerAction
• Condition
• Color
• FileType
These are important for the architecture because they show that movement, interaction, parsing, and door logic are all represented explicitly in the model rather than being implicit strings or ad hoc values.
3) Content loading and level construction
The TempleOfDoom.Services project is responsible for getting a playable level into memory.
File parsing strategy
The repository includes both JSON and XML level definitions:
• TempleOfDoom_Extended_B_2122.json
• TempleOfDoom_XML.xml
The services layer supports this through a Strategy pattern:
• IFileParserStrategy
• JSONFileParser
• XMLFileParser
• FileParserFactory
This means the application can choose a parser based on file type and parse multiple level formats through a common abstraction.
Factories
Several factories assemble the domain objects from parsed data:
• RoomFactory
• TileFactory
• DoorFactory
• ItemFactory
• EnemyFactory
These factories are the construction boundary between raw parsed content and fully formed model objects. They keep object-creation logic out of the controllers and probably out of the parsers as well.
Level service and file I/O
• FileReader handles file access
• LevelService likely coordinates parsing and factory usage to build a Level
The services layer therefore sits between external content files and the in-memory game world.
4) Console rendering
The TempleOfDoom.View project handles presentation to the terminal.
Key components:
• ConsoleView
• GameObjectToRepresentationMapper
• Representation
The mapping layer suggests that domain objects are converted into lightweight visual representations before being written to the console. That keeps rendering concerns separate from the game object model.
Because this is a console game, the view boundary is important: the game state must be translated into characters/symbols suitable for terminal output rather than UI widgets.
Data flow through the system
A typical flow looks like this:
1. Program.cs starts the game and wires the application together.
2. GameSetupController loads a level through LevelService.
3. LevelService uses FileReader, FileParserFactory, and a JSON/XML parser strategy to read a level file.
4. The parser and factories build Level, Room, Tile, Door, Item, and entity objects.
5. GameFlowController runs the main loop.
6. InputController reads arrow-key input and turns it into a PlayerAction or Direction.
7. InteractionController applies movement and game rules, updating the model.
8. The model changes may notify observers through the Observer interfaces.
9. ConsoleView renders the current state by mapping game objects to Representation values.
Important architectural boundaries
Controller vs. model
Controllers orchestrate gameplay, but the rules and state live in the model. This keeps the core logic reusable and testable outside of console I/O.
Services vs. model
Services are responsible for loading and constructing objects, not for enforcing gameplay rules. The model owns the meaning of doors, tiles, items, and movement.
View vs. model
The view consumes the model and produces console output, but should not encode game logic. The mapper is the translation boundary.
Parsing vs. construction
Parsing reads raw file structures; factories turn that data into proper game objects. That two-step split is a key part of the architecture.
Design patterns in context
The README lists several patterns, and the file tree confirms they are central to the design:
• Factory: used throughout the services layer to build game objects
• Decorator: used for doors to compose behavior such as color, toggling, gating, and conditional opening
• Strategy: used for JSON vs. XML file parsing
• Adapter: EnemyAdapter and FieldAdapter isolate external or incompatible data shapes from the model
• Observer: used for notifying interested parties when game state changes
Repository-specific architecture summary
This is a layered, room-based dungeon crawler implemented as a .NET console application. The executable bootstraps a controller-driven game loop. The services layer loads level content from JSON/XML and constructs the world using factories and parser strategies. The models layer contains the actual game rules and object hierarchy, including rooms, tiles, doors, items, and the player. The view layer turns model state into console output. Observer and decorator patterns are used to keep world behavior composable and reactive, especially for doors and state updates.
If you want to draw an architecture diagram, the most important boxes are:
• Console entry point
• Controllers for setup, flow, input, and interaction
• Services for file reading, parsing, and object creation
• Models for all game entities and level structure
• View for console rendering
And the most important arrows are:
• entry point to controllers
• controllers to services and models
• services to model construction
• model to view, likely via observer notifications and representation mapping
Main entry points: LevelService.cs Level Service · Room.cs Room · Level.cs Level · IEntity.cs Contracts
Components 24
App
Executable bootstrap and console runtime.
- Program · Console application bootstrap.
TempleOfDoom/TempleOfDoom/Program.cs
Controllers
Gameplay orchestration and input handling.
- Game Setup · Initial game session assembly.
TempleOfDoom/TempleOfDoom.Controllers/GameSetupController.cs - Game Flow · Main gameplay loop and turn progression.
TempleOfDoom/TempleOfDoom.Controllers/GameFlowController.cs - Input · Translates keyboard input into actions.
TempleOfDoom/TempleOfDoom.Controllers/InputController.cs - Interaction · Applies collisions, pickups, triggers, and movement outcomes.
TempleOfDoom/TempleOfDoom.Controllers/InteractionController.cs
Models
Core domain objects, contracts, and rules.
- Level · Top-level dungeon structure.
TempleOfDoom/TempleOfDoom.Models/LevelStructure/Level.cs - Room · Room-level container for tiles and objects.
TempleOfDoom/TempleOfDoom.Models/LevelStructure/Room.cs - Entities · Player and base entity behavior.
TempleOfDoom/TempleOfDoom.Models/GameObjects/Entities/BaseEntity.cs - Tiles · Floor, wall, connection, and special tiles.
TempleOfDoom/TempleOfDoom.Models/GameObjects/FloorTiles/FloorTile.cs - Doors · Door behavior plus decorator variants.
TempleOfDoom/TempleOfDoom.Models/GameObjects/Doors/Door.cs - Items · Keys, stones, traps, and pressure plates.
TempleOfDoom/TempleOfDoom.Models/GameObjects/Items/Key.cs - Contracts · Behavior boundaries for movement, interaction, updating, and observers.
TempleOfDoom/TempleOfDoom.Models/Interfaces/IEntity.cs
Services
File loading, parsing, and world construction.
- Level Service · Coordinates level loading and construction.
TempleOfDoom/TempleOfDoom.Services/LevelService.cs - File Reader · Reads raw level files from disk.
TempleOfDoom/TempleOfDoom.Services/FileReader.cs - Parser Factory · Selects a parser strategy by file type.
TempleOfDoom/TempleOfDoom.Services/Factories/FileParserFactory.cs - JSON Parser · Parses JSON level content.
TempleOfDoom/TempleOfDoom.Services/Parsers/JSONFileParser.cs - XML Parser · Parses XML level content.
TempleOfDoom/TempleOfDoom.Services/Parsers/XMLFileParser.cs - Room Factory · Builds rooms from parsed data.
TempleOfDoom/TempleOfDoom.Services/Factories/RoomFactory.cs - Tile Factory · Builds tiles and floor content.
TempleOfDoom/TempleOfDoom.Services/Factories/TileFactory.cs - Door Factory · Builds doors and door variants.
TempleOfDoom/TempleOfDoom.Services/Factories/DoorFactory.cs - Item Factory · Builds items and trigger objects.
TempleOfDoom/TempleOfDoom.Services/Factories/ItemFactory.cs
View
Console presentation and object representation.
- Mapper · Converts game objects into renderable representations.
TempleOfDoom/TempleOfDoom.View/GameObjectToRepresentationMapper.cs - Console View · Writes the game state to the terminal.
TempleOfDoom/TempleOfDoom.View/ConsoleView.cs - Representation · Lightweight console-facing visual form.
TempleOfDoom/TempleOfDoom.View/Representation.cs
Connections 34
- Program → Game Setup: bootstraps · Program starts the game assembly and setup.
- Program → Console View: creates · Application wires in console rendering.
- Game Setup → Level Service: loads level · Initial session setup requests a playable level.
- Game Setup → Game Flow: starts flow · Setup hands control to the main loop.
- Game Flow → Input: reads input · Main loop polls player actions.
- Game Flow → Interaction: applies actions · Gameplay progression is resolved through interactions.
- Interaction → Level: updates · Interactions mutate the world state.
- Input → Interaction: maps actions · Raw input is turned into movement and action requests.
- Level Service → File Reader: reads files · Level loading begins with file access.
- Level Service → Parser Factory: selects parser · File type determines parser strategy.
- Parser Factory → JSON Parser: chooses · JSON content is parsed via strategy.
- Parser Factory → XML Parser: chooses · XML content is parsed via strategy.
- Level Service → Room Factory: builds rooms · Parsed room data is assembled into domain objects.
- Level Service → Tile Factory: builds tiles · Tile data is turned into map objects.
- Level Service → Door Factory: builds doors · Door definitions become model doors.
- Level Service → Item Factory: builds items · Items and triggers are constructed.
- Room Factory → Room: creates · Rooms are materialized in the model.
- Tile Factory → Tiles: creates · Tile hierarchy is assembled.
- Door Factory → Doors: creates · Door hierarchy and decorators are assembled.
- Item Factory → Items: creates · Item and trigger objects are assembled.
- Level Service → Level: assembles · The full level is produced from parsed content.
- Level → Room: contains · A level is composed of rooms.
- Room → Tiles: contains · Rooms contain tiles and floor elements.
- Room → Doors: links · Rooms connect through doors.
- Room → Entities: hosts · Rooms contain entities such as the player.
- Room → Items: contains · Rooms contain items and triggers.
- Entities → Contracts: implements · Entities are governed by shared interfaces.
- Tiles → Contracts: implements · Tile behavior follows shared contracts.
- Doors → Contracts: implements · Door behavior follows shared contracts.
- Items → Contracts: implements · Item and trigger behavior follows shared contracts.
- Level → Console View: rendered by · Game state is presented in the console.
- Level → Mapper: mapped for view · Domain objects are converted to renderable forms.
- Mapper → Representation: produces · Mapper emits lightweight view representations.
- Console View → Representation: renders · Console output is based on renderable representations.