aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--design.tex45
-rw-r--r--img/class-scripts.puml7
-rw-r--r--projdoc.cls2
-rw-r--r--reqs.toml45
4 files changed, 84 insertions, 15 deletions
diff --git a/design.tex b/design.tex
index 08ea7cc..a3da41c 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,29 @@ 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}).
+
+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}).
-\subsection{Physics}
+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:???})
+\end{itemize}
-\section{Tools}
+% \subsection{Input}
-\section{Conclusion}
+% \subsection{Physics}
\end{document}
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..8cf9bca 100644
--- a/reqs.toml
+++ b/reqs.toml
@@ -117,3 +117,48 @@ 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.
+'''
+