<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\subtitle{\textbf{Lab} - Game Design Hack}
\date{Monday (PM), 14 May 2018}

\begin{document}
	
	\begin{frame}
	\titlepage
	\end{frame}

	\section{Intro}
	
	\begin{frame}{CE810 game engine}
		\begin{itemize}[&lt;+-&gt;]
			\item Remember we mentioned that we built you a game engine...
			\item well, here it is.
		\end{itemize}
	\end{frame}
	
	\begin{frame}{Limitations}
	\note{\begin{itemize}}
		\begin{itemize}[&lt;+-&gt;]
			\item Games take place on a hex grid
			\item Games are turn-based
			\item No randomness \note{\item In fairness, it is the UI and AI that do not support it} 
		\end{itemize}

		\uncover&lt;4&gt;{We originally designed it for Civilization style games, but it's much more general than that.}
	\note{\end{itemize}}
	\end{frame}
	
	\section{Game Engine}
	
	\begin{frame}{Key Parts}
		\begin{itemize}[&lt;+-&gt;]
			\item A game has \keyterm{Entity Types}, \keyterm{Resources}, and \keyterm{Terrain}
			\item Entity types have actions, costs and properties
			\item Resources and Terrain make up the maps
			\item Victory conditions tell you how to win (or lose)
		\end{itemize}
	\end{frame}
	
	\begin{frame}{Entity Types}
		\begin{itemize}[&lt;+-&gt;]
			\item Used to \textbf{define} an \keyterm{Entity}
			\item \textbf{Every} entity has a type
			\item Entity Types can \textbf{extend} other types
			\item Defines:
			\begin{itemize}
				\item Graphics
				\item \keyterm{Actions}
				\item \keyterm{Properties}
			\end{itemize}
		\end{itemize}
	\end{frame}

\begin{frame}[fragile]{Example: EntityType}
\begin{minted}[breaklines,tabsize=4]{javascript}
{
"name": "abstract_civilian",
"properties": {
	"movement": 1,
	"health": 5,
	"attackRange": 1,
	"atkMelee": 1,
	"ter-grass": 1
},
"cost": {
"food": 10
},
\end{minted}
\end{frame}

\begin{frame}[fragile]{Example: EntityType}
\begin{minted}[breaklines,tabsize=4]{javascript}

"_actions": [
	"Move",
	"MeleeAttackAction",
	"Build[farm]",
	"BuildOnResource[lumber_mill:wood]",
	"BuildOnResource[gold_mine:gold]",
	"Build[marketplace]"
]
},
\end{minted}
\end{frame}

	\begin{frame}{Entities}
		\begin{itemize}[&lt;+-&gt;]
			\item Have an Entity Type
			\item Has \keyterm{properties}
			\item Can perform 1 \keyterm{Action} per turn
		\end{itemize}
	\end{frame}

	\begin{frame}{Actions}
		\begin{block}{Actions}
			\textbf{What} an Entity can do
		\end{block}
		\begin{itemize}[&lt;+-&gt;]
			\item 0 or more
			\item Parameterisable
			\item Inherited
		\end{itemize}
	\end{frame}

	\begin{frame}{Orders}
		\begin{block}{Order}
			An order is \textbf{generated} when an Action is used on a \textbf{particular} location	
		\end{block}
		\begin{itemize}[&lt;+-&gt;]
			\item What an Entity actually does in its turn
			\item Used to \textbf{update} the game state
			\item Move Action $\rightarrow$ \textbf{multiple} possible Move Orders
		\end{itemize}
	\end{frame}

	\begin{frame}{Properties}
		\begin{itemize}[&lt;+-&gt;]
			\item String $\rightarrow$ Integer mapping
			\item Used by default actions as well as custom ones
			\item Two sets per Entity
			\item Inherited	
		\end{itemize}
	\end{frame}

	\begin{frame}{Extensions}
		\begin{itemize}[&lt;+-&gt;]
			\item The game is \textbf{extendible}
			\item You can \textbf{change} the json files \textbf{defining} the game
			\item You can \textbf{add} your own code
			\begin{itemize}
				\item It will be detected on the classpath
				\item Use the same as the built in items
			\end{itemize}
			\item You can add \textbf{new}:
			\begin{itemize}
				\item Actions
				\item Orders
				\item AI
				\item Victory Conditions
			\end{itemize}
		\end{itemize}
	\end{frame}
	
	\section{Example - Hexxagon}

	\begin{frame}{Hexxagon}
		\begin{center}
			\only&lt;1&gt;{\includegraphics[width=0.8\linewidth]{images/gd_hexxagon}\\}
			\uncover&lt;2-&gt;{\includegraphics[width=0.7\linewidth]{images/gd_hexxagon}\\}
			\only&lt;2&gt;{Entity types: piece, piece-p1, piece-p2}
			\only&lt;3&gt;{Terrain types: board}
			\only&lt;4&gt;{Actions: jump and clone}
			\only&lt;5&gt;{Resources: ticks (used to permit moving only one piece)}
			\only&lt;6&gt;{Victory conditions: LastManStanding, MostPiecesLock}
		\end{center}
	\end{frame}

\begin{frame}[fragile]{Entity Definition}
	
\begin{minted}[breaklines]{javascript}
{
  "name": "piece", // it's called 'piece'
  "properties": {
    "ter-playzone": 1, // it can 'walk' on playzone tiles
    "health": 1 // it has 1 health (things with no health die)
  },
  "_actions":[
    "Jump[tick]", // Jump Action (defined in Java)
    "Clone[tick]" // Clone action (defined in Java)
  ]
},
\end{minted}
	
\end{frame}

	\section{Design Patterns}
	\begin{frame}{Design Patterns}
		\begin{itemize}[&lt;+-&gt;]
			\item Like programming patterns
			\item Many teams may have similar tasks to solve
			\item Some helpful patterns shown here
		\end{itemize}
	\end{frame}
	\begin{frame}{Movement Lock}
		Allow the player to only move one piece on their go
	
		\begin{itemize}[&lt;+-&gt;]
			\item Resource: time
			\item Only allow a move if the resource &lt; current tick
			\item After a move is made, update the resource to tick + 1
		\end{itemize}
	\end{frame}

	\begin{frame}{Timers}
		You can define a timer by doing the following:
		
		\begin{itemize}[&lt;+-&gt;]
			\item Create an automatic action that performs the effect that you'd like to achieve.
			\item Set requirements to be ``timeProperty $\geq$ timeRequired''
			\item Create an automatic action that generates 1 timeProperty
			\item Define the automatic actions as [generateAction, doneAction]
		\end{itemize}
	\end{frame}
	
	
\end{document}
</pre></body></html>