Sie sind auf Seite 1von 3

Pathfinding and Behaviours for a

MOBA
Technical Report

The purpose of this project is to develop a software application, in order to demonstrate the
pathfinding abilities of virtual agents, and then to develop this algorithm to be used in the context of
a game, specifically a MOBA (Multiplayer Online Battle Arena).

The method that was chosen achieve this was to begin researching similar amateur games that had
been made Via Unity, and research the different kinds of Path-Planning options. Most MOBA’s are
structured the same, with the players fighting alongside an infinitely spawning army of minions. The
minions only usually follow on lane to the enemy base, and only ever alter their path when
interrupted, such as chasing an enemy to a different lane. The algorithm developed for the minions
would not need to be complex, as its purpose is to direct the minion to the enemy base in the
shortest time possible, only correcting if another behaviour is deemed more important.

One of the most common examples of a grid-based pathfinding algorithm is Dijkstra’s algorithm. It is
used to find the shortest path between two nodes, by examining each node adjacent to the current,
and following the closest one, as only the closest node is followed upon finding the destination the
shortest path will have been found.

In terms of computer science, a variant of Dijkstra’s algorithm exists known as A*. A* pathfinding
assigns a value to each node in the grid based on location. The current node is added to an Open Set
of nodes to be check, the algorithm adds each of the nodes neighbouring nodes to the set, and
removes the current node before doing the same with nodes that were added. When the
destination node is found, I will be via the shortest path. While A* search is an informed search,
using information to determine the best route, there are also uniformed searches, A breadth-First or
Depth-First search find routes by checking each node a level at a time, or by making several paths
from beginning to end and comparing them respectively. While these types of searches can provide
faster results, they become inefficient with large amounts of nodes, taking much longer to find a
route, or especially in Breadth-firsts case, using up a high amount of memory. For this project, as
there was a risk of the path needing to be updated repeatedly, the A* method was used.

The implementation of this was done in Unity, a few items were created to serve as walls, via a layer
mask. Once the Grid was implemented, the objects on the wall layer had to nodes beneath them
turn red, while available nodes remained white. The algorithm was programmed by creating an open
list and a closed list, and each adjacent node to the current node was placed in the open list, then
the closed list once that Nodes Neighbouring nodes had been checked. When the destination Node
was reached, each node in that sequence would turn black, revealing the path. The path updated
instantly when the goal or the agent were moved in the game scene.

The next task was to implement this into a MOBA. Using a few basic Unity assets a simple arena was
create, consisting of a base at each end, and 3 lanes between the walls, with some clear spots for the
player hero to move between lanes. Minions were made to simply walk towards the enemy base at
first. A secondary behaviour was given to them, which made them chase the enemy heroes when
they got too close. Another aspect of a MOBA is the tower, defensive stationary structures that can
kill heroes very quickly. The towers are a main reason as to why minions are important, as the
towers will attack minions before heroes. The towers were given a behaviour that when a hero got
close the tower would turn towards them to shoot, unless a minion was also in range, in which the
minion would be targeted first.

An issue found with the A* algorithm, is that it would often send the minions down the middle lane,
despite them being in another one, as it was the most direct path to the enemy base. A future
implementation will cause minions to prioritise a certain lane, unless they are led away from it.

The program itself, while looking vaguely like a MOBA does not function as one at this time. Play
controls are rudimentary and the minions and the pathfinding do not interact in the intended way. It
does work as a proof of concept, and demonstrate different behaviours .

References:
Video tutorials

Sebastian Lague (2014) A* Pathfinding (E03: algorithm implementation) [Video] Available at:
https://www.youtube.com/watch?v=mZfyt03LDH4 [Accessed 20th July 2019]

Daniel (2018) Unity – A Star Pathfinding Tutorial [Video] Available at:


https://www.youtube.com/watch?v=AKKpPmxx07w [ Accessed 15th July 2019]

TairaGames (2015) How to make a MOBA in Unity [Video] available at:


https://www.youtube.com/watch?v=wyFGjY3N5vM [Accessed 12th July 2019]

Checklist:

Item Completed ✓
I have read the all of the assignment brief, its ✓
learning outcomes and marking criteria. I have
clarified anything that I am unsure of with the
Template Revised 6 July 2017 14 module
coordinator.
I have used the correct versions of Unity / ✓
Unreal, or have given detailed instruction for
how to compile C++ or Python submissions as
prescribed in this assignment brief.
I have made regular backup copies of my work. ✓
I have tested my game on the presentation ✓
machine in MP135 or the designated venue for
my presentation.
I have made and tested an ‘exe’ version of my
game for my presentation.
I have my source code with me too. ✓
All work that is not my own is correctly ✓
referenced either in the presentation and / or
sources code.
I have read or listened to feedback provided, ✓
clarified any points I did not understand with the
tutor, and have acted upon the advice.
I have uploaded all the required files in plenty of ✓
time to the correct module Moodle assessment
point.

Das könnte Ihnen auch gefallen