-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
60 additions
and
15 deletions.
There are no files selected for viewing
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
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.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.