Skip to content

Commit

Permalink
Merge branch 'docs-update'
Browse files Browse the repository at this point in the history
  • Loading branch information
ben_singer committed Nov 18, 2024
2 parents 77074a0 + b00128b commit ab3000e
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 15 deletions.
Binary file removed docs/Architecture/input-parsing-sequence-diagram.png
Binary file not shown.
13 changes: 0 additions & 13 deletions docs/Architecture/input-parsing-sequence-diagram.txt

This file was deleted.

25 changes: 25 additions & 0 deletions docs/docfx/docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Architecture

## Overview
NetAF has a simple architecture and understanding it will help when developing games.

A *Game* encapsulates all assets and provides top level logic. When the *Game* is executing the following loop runs for the duration of the execution:
* The *Game* renders the current *GameMode*. There are many different instances of *IGameMode* that provide different functionality, but generally they can be split in to two types: *Interactive* and *Information*.
* The *Game* then accepts user input by using an instance of *IIOAdapter* to receive input from the user.
* The *Game* then and passes the input to its own *Interpreter* (for handling global input) and the *Interpreter* for the current *GameMode* (for handling mode specific input) in order to process it.
* The *Interpreter* tries to parse the input and if successful return an instance of *Command*.
* The returned *Command* is then invoked and returns a *Reaction* that details the result. Some instances of *ICommand* deal with interactions between assets. In this case an *Interaction* between an *Item* and a target is invoked and the result returned the *ICommand* which will return an appropriate *Reaction*.
* The *Game* processes the *Reaction*. Some instances of *Reaction* will trigger the *Game* to change *GameMode* to either display the *Reaction* or enter another*GameMode*.
* When a *GameMode* is rendered a *IFrameBuilder* can be used to generate an instance of *IFrame*.
* An instance of *IFrame* can be rendered on to an *IIOAdapter* which will display the *IFrame* to the user.

![Input-Parsing](~/images/input-parsing-sequence-diagram.png)

## Extensibility
NetAF is designed to be extensible.

* **ICommand** allows commands to be added.
* **IInterpreter** allows commands to be interpreted.
* **IGameMode** allows custom modes to be added to a *Game*.
* **IFrameBuilders** callows custom instances instances of *IFrame* to be created which are used to render the game state to the user.
* **IIOAdaper** provides an interface to get input from the user and render the game state back to them. *SystemConsoleAdapter* provides a wrapper around *System.Console*, however custom implementations can be added to support different types of application.
6 changes: 4 additions & 2 deletions docs/docfx/docs/frame-builders.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Overview
In BP.AdventureFramework output is handled using the **FrameBuilders**. A FrameBuilder is essentially a class that builds a **Frame** that can render a specific state in the game. This **Frame** can then be rendered on a **TextWriter** by calling its **Render** method. Think of the **FrameBuilder** as the instructions that build the output display and the **Frame** as the output itself.
# Frame Builders

## Overview
In NetAF output is handled using the **FrameBuilders**. A FrameBuilder is essentially a class that builds a **Frame** that can render a specific state in the game. This **Frame** can then be rendered on a **TextWriter** by calling its **Render** method. Think of the **FrameBuilder** as the instructions that build the output display and the **Frame** as the output itself.

There are a few types of **FrameBuilder**, each responsible for rendering a specific game state.
* **SceneFrameBuilder** is responsible for building frames that render the scenes in a game.
Expand Down
8 changes: 8 additions & 0 deletions docs/docfx/docs/persistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ game.Catalog.Register(sword);

By registering with the *AssetCatalog* the game will be able to resolve references to the object when deserialization
is applied.

## Sequencing

### Save
![Persistence-Save](~/images/persistence-save.png)

### Load
![Persistence-Load](~/images/persistence-load.png)
2 changes: 2 additions & 0 deletions docs/docfx/docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ items:
href: end-conditions.md
- name: Persistence
href: persistence.md
- name: Architecture
href: architecture.md
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes.
21 changes: 21 additions & 0 deletions docs/source/input-parsing-sequence-diagram.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
title Input Parsing

participant Game
participant IOAdapter
participant Interpreter
participant Command
participant GameMode
participant FrameBuilder

Game->IOAdapter: GetInput
IOAdapter->Game: Input
Game->Interpreter: Interpret
Interpreter->Command: Create
Command->Interpreter: Command
Interpreter->Game:Command
Game->Command: Invoke
Command->Game: Reaction
Game->GameMode:Render
GameMode->FrameBuilder: Build
FrameBuilder->GameMode: Frame
GameMode->IOAdapter: Render
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ab3000e

Please sign in to comment.