\documentclass[20pt,,margin=1in,innermargin=-4.5in,blockverticalspace=-0.25in]{tikzposter}
\geometry{paperwidth=42in,paperheight=32.5in}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{enumitem}
\usepackage[backend=biber,style=authoryear-ibid]{biblatex}
\usepackage{SUtheme}
\usepackage{hyperref}
\usepackage{xcolor}

\usepackage{mwe} % for placeholder images

\addbibresource{refs.bib}

% set theme parameters
\tikzposterlatexaffectionproofoff
\usetheme{SUTheme}
\usecolorstyle{SUStyle}
\usetitlestyle{Filled}

\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault} 
\usepackage[T1]{fontenc}


\title{Using Goal-Oriented Action Planning within the Context of Turn-Based Combat}
\author{Philip White}
\institute{Falmouth University}
\titlegraphic{\includegraphics[width=0.06\textwidth]{falmouth-university.png}}

% begin document
\begin{document}
\maketitle
\centering
\begin{columns}
    \column{0.32}
    \block{Goal-Oriented Action Planning}{
        Goal-Oriented Action Planning (GOAP) \parencite{orkin_2006} is an artificial intelligence decision-making algorithm for artificial intelligence agents that can make decisions in changing circumstances. A high-level goal is broken down into a series of actions to be executed by the agent. Each action in Goal-Oriented Action Planning has a set of preconditions and effects. The agent assesses the status of the environment, selects a goal to pursue, and then applies a planning algorithm that determines the sequence of actions that would most effectively accomplish that goal while fulfilling the preconditions of each action. Goal-Oriented Action Planning is widely used in the video game industry to develop artificial intelligence that can operate in complex and uncertain environments.
    }
    \block{The Artefact}{
        The computing artefact developed to test is a combat artificial intelligence attached to an enemy non-player character for a small turn-based strategy game with a focus on resource management and combo building. In this game, you have a limited set of randomised resources that can be used to build combos to attack an opponent. Combos vary in resource costs and which resource is required for it to be cast you may also use more or fewer resources at random when casting a combo creating an uncertain and dynamic environment that the artificial intelligence must overcome. Additionally, the player is able to steal 1 unit of the most abundant resource the opponent has but is only able to do this once. To win you must defeat the opponent by reducing their health to 0. The combat artificial intelligence must be able to find the optimal set of combos with the current resources that it has on hand and perform those actions to defeat its opponent whilst keeping itself alive.
        \vspace{1em}
        \begin{tikzfigure}[Screenshot of the randomised resources.]
            \includegraphics[width=0.5\linewidth]{resources.png}
        \end{tikzfigure}
    }
    \block{The Problem}{
        To create an entertaining gaming experience using artificial intelligence one must be able to adapt and respond to the ever-changing environment around it. Goal-Oriented Action Planning is one of many solutions to this issue however in this context of turn-based combat Goal-Oriented Action Planning can be highly suitable for this specific use case. This is useful in a turn-based combat system as actions can be weighted based on the damage they apply, the resources they use and in certain actions, the health healed depending on the current state of the environment. Goal-Oriented Action Planning can then use these weights to determine the most optimal set of actions to take in the current situation creating a more entertaining and dynamic experience for the player.

        \vspace{0.3em}
        \includegraphics[width=0.17\linewidth]{qr-code.png}
        \newline
        \href{https://github.falmouth.ac.uk/Games-Academy-Student-Work-22-23/COMP250-1-2101327-AI}{\textcolor{blue}{\textbf{Github Repository}}}

    }

    \column{0.36}
    \block{Implementation}{
        The implementation of the Goal-Oriented Action Planning algorithm is based on the implementation by \textit{Whyte} \parencite{whyte_2019} in the game engine Unity with some modifications, additions and optimisations to suit the needs of the game engine Unreal, in which the artefact was developed in, and constraints when building the tree of possible actions to reach the agent's goal. The Goal-Oriented Action Planning algorithm and agent are implemented as an actor component that can be attached to any actor, pawn or character game object that requires the ability to make decisions when in turn-based combat, providing developers with the flexibility to apply the artificial intelligence using Goal-Oriented Action Planning anywhere as needed. The Goal-Oriented Action Planning algorithm also implements self-recovery re-planning if the first action plan will fail to reach the goal if the environment state does not match the predicted environment state the action plan has accounted for.
        \vspace{1em}
        \begin{tikzfigure}[Screenshot of the artefact.]
            \includegraphics[width=0.9\linewidth]{artifact.png}
        \end{tikzfigure}
        \vspace{1em}
        How the action plan is built in this implementation of Goal-Oriented Action Planning is that the algorithm uses a recursive function to build a tree of action nodes that contain an action, the current state of the environment, the parent action node and the total running cost at that point in the tree to generate possible actions to reach the agent's goal. The algorithm creates a list of leaves that contain the final action to an environment state in which the agent has successfully reached its goal. The algorithm then selects the leaf with the lowest cost and then works its way back up the tree to the root node to generate the final action plan. This is then executed by the agent to reach its goal.
        \\[1em]
        One of the critical optimisations of the Goal-Oriented Action Planning that was developed when the algorithm builds the tree is that it sorts the actions based on their weighted costs. This allows the artificial intelligence agents to be able to make complex decisions based on the hierarchy of actions to fulfil the agent's goals. The algorithm considers the current state of the game and the actions available to the agent before deciding on the most efficient course of action. As a result, the agent will always select the action that will get it closer to accomplishing its goals.
        \\[1em]
        Another critical optimisation of the Goal-Oriented Action Planning algorithm is that it uses a hash set to store the states of the environment that have already been visited. This allows the algorithm to avoid visiting the same state multiple times and instead focus on the states that have not been visited yet. This is useful as the algorithm will be able to generate a more efficient action plan as it will not have to consider the same states multiple times.
    }

    \column{0.32}
    \block{Results}{
        In this context of turn-based combat, the Goal-Oriented Action Planning algorithm is highly suitable for this specific use case. This is because it allows artificial agents to generate a plan of action and consider the potential outcomes of those actions before performing the actions on their turn. This points to the great potential of using Goal-Oriented Action Planning in turn-based combat games to solve the issue of creating more dynamic and entertaining experiences for the player using artificial intelligence. Additionally, gives developers a great option when deciding what artificial intelligence to use in their games as it is a highly flexible algorithm that can be applied to any game that requires the ability to make decisions in a turn-based combat context.
        \vspace{1em}
        \begin{tikzfigure}[Screenshot of the artefacts action plan.]
            \includegraphics[width=0.4\linewidth]{actionPlan.png}
        \end{tikzfigure}
    }

    \block{Comparison}{
        Goal-Oriented Action Planning compared to traditional artificial intelligence agents such as finite state machine is that Goal-Oriented Action Planning is a more flexible agent that can be used in a wider range of contexts as it can actively adapt to the uncertainty of the world environmental state in contrast to a finite state machine is a more rigid agent that is only suitable for highly defined use cases with pre-defined actions. In conclusion, Goal-Oriented Action Planning is a highly suitable artificial intelligence agent for turn-based combat games as it can actively adapt to the uncertainty of the world's environmental state and can generate a plan of action to reach the agent's goal.
        \begin{tikzfigure}[GOAP vs Finite State Machine. \parencite{orkin_2006}]
            \includegraphics[width=1\linewidth]{FinitevsGOAP.png}
        \end{tikzfigure}
    }

    \block{References}{
        \vspace{-1em}
        \begin{footnotesize}
            \printbibliography[heading=none]
        \end{footnotesize}
    }
\end{columns}
\end{document}
