aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--design.tex59
-rw-r--r--img/class-savemgr.puml13
-rw-r--r--img/class-scripts.puml7
-rw-r--r--projdoc.cls2
-rw-r--r--reqs.toml65
5 files changed, 131 insertions, 15 deletions
diff --git a/design.tex b/design.tex
index 08ea7cc..761658c 100644
--- a/design.tex
+++ b/design.tex
@@ -24,15 +24,15 @@ workflows.
\section{Overview}
-\subsection{Core}
-
-\subsection{Patterns}
+% TODO: high-level design introduction
+% - which parts of the design are prerequisites (and therefore not designed by us)
+% - why are all parts in the following section arranged in the way they are
\section{Design}
-\subsection{Rendering}
+% \subsection{Rendering}
-\subsection{Physics}
+% \subsection{Physics}
\subsection{Scripting}
@@ -91,10 +91,11 @@ follows:\noparbreak
contains the following classes:\noparbreak
\begin{description}
\item[Script] This is the script \emph{interface}, and is used by the game
- programmer to create derived script classes. All methods in this class are
- declared virtual and have an empty implementation.
+ programmer to create derived script classes. All virtual methods in this class
+ have an empty implementation by default, and are optionally implemented by the
+ game programmer.
- This class' methods are protected by default, and a friend relation to
+ This class' virtual methods are protected by default, and a friend relation to
\codeinline{ScriptSystem} is used to ensure only \codeinline{ScriptSystem} is
able to call these methods.
@@ -103,6 +104,10 @@ contains the following classes:\noparbreak
function returns a reference to the \codeinline{BehaviorScript} instance it was
called on so it can be chained after the call to
\codeinline{GameObject::add_component}.
+
+ \codeinline{Script} also has a reference to its parent
+ \codeinline{BehaviorScript} instance so components can easily be retrieved using
+ the component manager.
\item[BehaviorScript]
This is the script \emph{component}, and is given as the template parameter to
\codeinline{GameObject::add_component}.
@@ -184,13 +189,43 @@ contains the following classes:
\label{fig:class-audio-facade}
\end{figure}
-\subsection{Input}
+\subsection{Save manager}
+
+The save manager \gls{api} is designed to give the game programmer an easy to use
+interface for retrieving and storing game-specific data (\cref{req:savemgr}).
-\subsection{Physics}
+Because the engine validation app only stores statistics and highscores, the save
+manager is not required to support loading different save files
+(\cref{req:savemgr:multi-file}), nor storing complicated data types
+(\cref{req:savemgr:types-custom}). The save manager only supports storing simple
+types (\cref{req:savemgr:types-scalar,req:savemgr:types-string}).
-\section{Tools}
+In order to reduce complexity for the game programmer further, the following
+requirements were also set:\noparbreak
+
+\begin{itemize}
+ \item Prevent data loss in the case of crashes (\cref{req:savemgr:journalling})
+ \item Handle opening/closing/flushing of the underlying file automatically
+ (\cref{req:savemgr:file-manage})
+ \item Save file variables are uniquely identified (\cref{req:savemgr:var-key})
+\end{itemize}
-\section{Conclusion}
+% \subsubsection{Architecture}
+% \label{sec:savemgr:architecture}
+%
+% \begin{figure}
+% \centering
+% \includepumldiag{img/class-savemgr.puml}
+% \caption{Save manager class diagram}
+% \label{fig:class-savemgr}
+% \end{figure}
+%
+% In order to realize \cref{req:savemgr:journalling,req:savemgr:var-key}, a third-party
+% key-value database library is used.
+
+% \subsection{Input}
+
+% \subsection{Physics}
\end{document}
diff --git a/img/class-savemgr.puml b/img/class-savemgr.puml
new file mode 100644
index 0000000..30bcd08
--- /dev/null
+++ b/img/class-savemgr.puml
@@ -0,0 +1,13 @@
+@startuml
+!include theme.ipuml
+skinparam Linetype ortho
+
+class SaveManager {
+
+}
+
+class ValueBroker {
+
+}
+
+@enduml
diff --git a/img/class-scripts.puml b/img/class-scripts.puml
index 8fc36c9..44cbe85 100644
--- a/img/class-scripts.puml
+++ b/img/class-scripts.puml
@@ -10,10 +10,12 @@ package api {
class Component <<irrelevant>>
class Script {
+ - Script()
+ --
# init() <<virtual>>
# update() <<virtual>>
--
- - Script()
+ - parent : BehaviorScript *
}
class BehaviorScript {
@@ -26,7 +28,8 @@ package api {
}
BehaviorScript -u-|> Component
- Script .u.> BehaviorScript
+ Script <.u. BehaviorScript : > friend
+ Script ..u> BehaviorScript
}
class System <<irrelevant>>
diff --git a/projdoc.cls b/projdoc.cls
index b369b18..a0c8e10 100644
--- a/projdoc.cls
+++ b/projdoc.cls
@@ -330,7 +330,7 @@
% adjust scale for puml diagrams
\newcommand{\includepumldiag}[1]{%
\StrSubstitute{#1}{.puml}{.eps}[\filename]%
- \fitimg{\includegraphics[scale=0.75]{\filename}}%
+ \fitimg{\includegraphics[scale=0.65]{\filename}}%
}
% prevent page break between two paragraphs
diff --git a/reqs.toml b/reqs.toml
index a83208e..9ad0a86 100644
--- a/reqs.toml
+++ b/reqs.toml
@@ -117,3 +117,68 @@ Unless explicitly changed by the game programmer, methods on instances of
must be called by the script system.
'''
+[savemgr]
+type = 'user'
+priority = 'must'
+description = '''
+The engine provides an \gls{api} for saving various kinds of game data
+(e.g.~progress, levels, statistics, unlocked items, achievements).
+'''
+
+[savemgr:journalling]
+type = 'system'
+priority = 'should'
+description = '''
+The save manager uses a journal to store data, such that partial saves do not
+cause data loss.
+'''
+
+[savemgr:types-custom]
+type = 'system'
+priority = 'will not'
+description = '''
+The save manager can be extended to store and retrieve game programmer-defined
+types and data structures.
+'''
+
+[savemgr:types-scalar]
+type = 'system'
+priority = 'must'
+description = '''
+The save manager is able to store and retrieve scalar types.
+'''
+
+[savemgr:types-string]
+type = 'system'
+priority = 'must'
+description = '''
+The save manager is able to store and retrieve strings.
+'''
+
+[savemgr:multi-file]
+type = 'system'
+priority = 'will not'
+description = '''
+The save manager can load multiple different save files.
+'''
+
+[savemgr:file-manage]
+type = 'system'
+priority = 'must'
+description = '''
+The save manager manages opening/closing the underlying file, and flushing
+in-memory data to the file.
+'''
+done = '''
+The game programmer is able to use the save manager without explicit
+(de)initialization.
+'''
+
+[savemgr:var-key]
+type = 'system'
+priority = 'must'
+description = '''
+The save manager provides access to variables uniquely identified by a key
+string.
+'''
+