dynamic pathfinding using genetic algorithm of automation/abstracts 2014... · pathfinding...

26
DYNAMIC PATHFINDING USING GENETIC ALGORITHM BASED FLOCKING BEHAVIOR ON NON-PLAYER CHARACTER FOLLOWER Paulus Harsadi, Vincent Suhartono ABSTRACT Artificial Intelligence in video games is important to provide a challenge to players, one of them makes a character or NPC-Follower (Non-player character Follower) in video games such as the behavior of real humans or animals. Among the many techniques in Artificial Intelligence, Pathfinding is one of the popular study of the other techniques because pathfinding is a basic technique in a video game. Pathfinding is the process of finding the best value in traveling from one point to another. Research pathfinding itself either single agent or multiple agents has been done, but much more done in a video game environment is not static dynamic dynamic environment where the environment is an obstacle that can change posisidan the existence of the original environment. In this research, the proposed algorithm is able to handle dynamic pathfinding process with motion based boid flocking behavior that is to be used as a point to determine the track by IGA (Improved Genetic Algorithm) towards its destination. IGA calculations performed in parallel to minimize the computational level. It is expected that the boid as point and IGA as a determinant of the trajectory can be used by a character or NPC Follower to perform pathfinding in dynamic environments. Index Terms – Artificial intelligence (AI), games, pathfinding, genetic algorithm. Introduction The video game industry over the past 20 years is one of the entertainment industry's most stable among the other entertainment industries such as movies and music. The video game industry is also one of the entertainment industry who have a low level of piracy [1]. The development of video games not just from the technology side but also in terms of innovation and dynamic properties over time. One significant development is the use of Artificial Intelligence in video games. Artificial Intelligence (AI) inside a video game is essential to provide a challenge to players, one of which makes the characters in video games such as human or animal behavior that actually has the ability to move each character, ability to take decisions where character moves, and the ability to think tactical and strategic [2] Among the many techniques in AI, and relevant issues such as learning, planning, and natural language processing, pathfinding is one of the most widely and commonly studied than other techniques because pathfinding is mandatory basic techniques and most widely applied in a video game [3].

Upload: others

Post on 15-Mar-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

DYNAMIC PATHFINDING USING GENETIC ALGORITHM BASED FLOCKING BEHAVIOR

ON NON-PLAYER CHARACTER FOLLOWER

Paulus Harsadi, Vincent Suhartono

ABSTRACT

Artificial Intelligence in video games is important to provide a challenge to players, one of them makes a

character or NPC-Follower (Non-player character Follower) in video games such as the behavior of real

humans or animals. Among the many techniques in Artificial Intelligence, Pathfinding is one of the

popular study of the other techniques because pathfinding is a basic technique in a video game.

Pathfinding is the process of finding the best value in traveling from one point to another. Research

pathfinding itself either single agent or multiple agents has been done, but much more done in a video

game environment is not static dynamic dynamic environment where the environment is an obstacle that

can change posisidan the existence of the original environment. In this research, the proposed algorithm is

able to handle dynamic pathfinding process with motion based boid flocking behavior that is to be used as

a point to determine the track by IGA (Improved Genetic Algorithm) towards its destination. IGA

calculations performed in parallel to minimize the computational level. It is expected that the boid as

point and IGA as a determinant of the trajectory can be used by a character or NPC Follower to perform

pathfinding in dynamic environments.

Index Terms – Artificial intelligence (AI), games, pathfinding, genetic algorithm.

Introduction

The video game industry over the past 20 years is one of the entertainment industry's most stable among

the other entertainment industries such as movies and music. The video game industry is also one of the

entertainment industry who have a low level of piracy [1].

The development of video games not just from the technology side but also in terms of innovation and

dynamic properties over time. One significant development is the use of Artificial Intelligence in video

games.

Artificial Intelligence (AI) inside a video game is essential to provide a challenge to players, one of which

makes the characters in video games such as human or animal behavior that actually has the ability to

move each character, ability to take decisions where character moves, and the ability to think tactical and

strategic [2]

Among the many techniques in AI, and relevant issues such as learning, planning, and natural language

processing, pathfinding is one of the most widely and commonly studied than other techniques because

pathfinding is mandatory basic techniques and most widely applied in a video game [3].

Page 2: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

Pathfinding is the main problem of many applications besides games include transport routes, robot

planning, military simulations, and others. Pathfinding includes analyzing a map to find the best value on

the way from one point to another. The best trails here can be interpreted many values and uses criteria

such as shortest path, the value of the trajectory at least, a safe trajectory, etc. [4]. Research pathfinding

itself either single agent or multiple agents has been done, but much more done in a video game

environment that is static not dynamic in which dynamic environment is an environment with obstacles

that may change position and the existence of the original environment [6].

Research in the particular search method pathfinding in a video game has been pretty much done [3]. A *

algorithm [4], or A * pathfinding and developmental variation of the A * pathfinding AI is very attached

to the game and is the method most widely used in video games [5].

A * pathfinding search method with a single agent or a single agent that uses a heuristic function to

estimate the value or price for the journey from the starting point to the destination point. Research -

further research based A * pathfinding also been pretty much done to improve the accuracy and

compatibility in various problems. Such Deepending Iterative A * (IDA *) [6] which is able to reduce the

memory requirement in the process of searching for A * pathfinding search environment has drawbacks if

used wide enough A * pathfinding experience "bottlenecks" or memory available to process does not

comply with requirements.

Hierarchical pathfinding A * (HPA *) [7] is also one of the A * pathfinding with the development of

methods of representation or map of the environment that transforms into rectangular blocks called

clusters, then the movement of the A * pathfinding done in clusters so much faster in computation. Other

research in game map to accelerate the A * pathfinding, among others, Hierarchical Annotated A * (HAA

*) [8], Partial Refinement A * (PRA *) [9]. Block A * [10] that uses a map database with all possible

obstacle avoidance configured in a video game.

A * pathfinding and development variations are quite able to solve pathfinding problems, but still used

the environment is static. If confronted with a dynamic environment there can be a case where the barrier

in the environment change when the algorithm is running so that it will run into congestion. One of the

solutions used to overcome the dynamic environment of the video game developers using real time

pathfinding, assuming a dynamic environment into a static environment whenever there is a change or a

map. But in several studies after starting by Korf's [11] real-time pathfinding is very difficult to

implement in a video game because of the problems of "scrubbing", which is when the real time search

reaches the place where the agent is getting slow in the calculation of the level of accuracy of the heuristic

value before it can get out of the local the area. The result is an irrational movement of agents that rotates

- the play within the local area for a long time [3].

Approach Real time pathfinding include Time-bounded A * (TBA *) [12] where the algorithm is not like

A * pathfinding where new agents can move toward the goal after computation completed. It takes a very

long time if the wider environment. TBA * working with the calculation of A * pathfinding but do not

wait but immediately perform computational finished first movement towards a promising point in the

calculation of A * open list.

Real-time Iterative-deepending Best-first Search (RIBS) [13], a real-time search algorithm based agent,

wherein the movement of agents such as computing TBA * but when it stalled, RIBS able to return to the

Page 3: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

parent state and do the re-computation. But this technique will still experience a "scrubbing" when the

agent returned to the parent state while the parent state above stated values in the state that had the highest

visit close to the goal.

LRTA * K Nearest Neighbor (KNN LRTA *) [14], an algorithm that is superior to TBA * and RIBS for

being able to overcome the "scrubbing". The method used is Hill-climbing moves, the algorithm makes

the sub-goals that the agent moves only in the direction of the sub-goals that promise closer to the goal.

Agent moves not only a map but one step grid sub-goal. Then in the following year developed into a kNN

LRTA * Hill-climbingand Dynamic Programming Search (HCDPS) [15] by adding a sub-goal database

so that the lower-level computing.

HCDPS method in real time pathfinding though unable to cope with the problem "srubbing" but it still

runs on a static environment, real-time pathfinding here is intended to cope with a complex environment

with many agents and the limited time because of the command of the player who constantly move the

goal.

Research pathfinding in a video game with the right environment - a dynamic rather than a static one of

which is real-time pathfinding with Genetic Algorithm (RTP-GA) [16] where the RTP-GA uses a

combination of genetic algorithm as a method to conduct elections and a barrier-free path * pathfinding is

used for agents or characters in moving towards the goal. The advantages of RTP-GA compared to other

pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories for

election in a dynamic environment and path that was chosen by the genetic algorithm can be used by the

A * pathfinding to move toward a goal without having to do all possible calculations heuristic value at the

point nearest neighbors in a grid or map. In addition to the above advantages of genetic algorithm, RTP-

GA will not be stuck in a "scrubbing". weakness of this algorithm is that if the calculation of A *

pathfinding process is done hindered due to the changing environment, the genetic algorithm will do the

re-computation for that purpose to take a long time to perform pathfinding.

Safe Interval Path Planning for Dynamic envirenment (SIPP) [17] is another approach that is

implemented in a dynamic environment in which the robot to pathfinding methods used together with A *

pathfinding, but the modifications made is by not reporting the existence of such a direct obstruction *

pathfinding.SIPP perform calculations predicted next position of an obstacle. Position of the results of

these calculations will be marked by the agents and the subsequent replacement of computing processes

such as A * pathfinding done. The weakness of the SIPP is the accuracy of prediction of the movement of

a snag in both time and direction of movement.

SIPP is one method that is quite effective in a dynamic environment, but in a new experiment - conducted

recently by J. Espelosin et al. [18] proved that their proposed algorithm, namely Particle Dynamical Chain

(DPC) is more effective both in terms of time, snag density and proximity of agents with minimal

obstructions that cause DPC has a more subtle movements than the SIPP.

DPC algorithm itself is an algorithm that is built from boid flocking behavior [19] in which the movement

of the agent used as a collection point toward the goal for the roadway. Point results from boid movement

will be used by the agent to move with election rules that select boid point within a radius closest to the

goal and not blocked. The advantages of this method enables the formation of many roads than using the

grid method to represent the environment, can be used in a dynamic environment with a low level of

Page 4: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

computing. The drawback of this method even though the process of finding the trajectory of ever smaller

as the area just in boid through, but the results of the trajectory of the algorithm is implemented still have

the possibility of srubbing though with a lower percentage than the real time search algorithm. This

occurs due to the rules of the DPC algorithm is similar with A* path finding that a breadth-first search

algorithm [20]. Additionally DPC algorithm will calculate the movement repeatedly every boid to find the

right trajectory so that it increases the value of time in the process of finding a stable value.

Background and related Work

1. Video Games

The game is the basis of a video game. The game is free movement within a more rigid structure [35].

Free movement of such structured pose a conflict, called the game. Game is a system in which players

engage in an artificial conflict, defined by rules and produce measurable results [36]. Along with the

development of technology and science, gaming is now packed into a more interesting and attractive so

that it can be played by any circles and anywhere through a technology called video games.

The definition video game itself is a game or a game that is mediated by the computer, or can be called a

pitch game software installed in an electronic device [37].

2. Game Engine

Definition of the game engine itself is still quite ambiguous and confusing because the definition is too

vague and too broad corresponding research reports Simpson [38]. But a more detailed definition of one

of them by Lewis and Jacobson, stating that the game engine is "a collection of modules simulasiyang

code does not directly determine the behavior of the game (game logic) or the game environment (data

level)" [39]. This means that the game engine is only one tool in game development.

Game engines provide a software framework that is used in developers to create games for video game

consoles, mobile devices and personal computers. Core functionality typically provided by a game engine

to render ("renderer") for 2D or 3D graphics, a physics engine or collision detection (and collision

response), sound, scripting, animation, artificial intelligence, networking, streaming, memory

management, threading, localization support, and a scene graph. The process of game development is

often economized, in large part, by reusing / adapting the same game engine to create different games or

to make it easier to "port" the game for a variety of system platforms.

3. Artificial Intelligence Game

The development of video games today moving towards the creation of video games as the real world

both visually, how to play as well as the behavior of both the surroundings and the characters. The ability

of video games such as the above is the role of artificial intelligence in the game.

Artificial intelligence in the development of the modern game in outline described above 3 capabilities;

the ability to move the character, the ability to make decisions about where to move, and the ability to

think tactically or strategically [40]. Artificial intelligence models in the game can be seen in Fig.1.

Page 5: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

Figure 1. Artificial intelligence models [2]

4. Pathfinding

Pathfinding in artificial intelligence models lies between decision making and movement as figure 2.

Pathfinding is used to make the decision to move to the object or character from one place to another

based on state maps and other objects [2].

Figure 2. Artificial intelligence pathfinding [2]

Pathfinding itself can be divided into two, static or dynamic, ie searching the global path refers to a search

in a static world, and the local path searching in a dynamic environment [40].

The ability of the algorithm used for pathfinding process is a major component of the success of the

process. The more complex a game environment that increasingly requires good pathfinding technique

Page 6: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

used especially environment can be dynamic or changeable. Examples of the dynamic environment in

question is in a gaming environment players perform pathfinding then execute trajectory calculations that

have been formed, but when the players to the point of changing environmental goals and pathfinding

algorithm should be able to adapt and adjust for the change. Pathfinding like this is referred to as dynamic

pathfinding [29].

5. Flocking Behavior

The movement of a herd in which every member of the herd seemed to have intelligence in moving and

interacting with its neighbors in the flock is often referred to as the flocking behavior. Boid is one concept

of herd behavior proposed by Reynolds [19] and commonly used in the field of games and animations

have proposed relatively simple concept but produce simulated flock is so natural.

The concept of the proposed Reynolds boid has three rules are:

Cohesion (Flocking)

Cohesion is the tendency boid to remain close to the center of the local herd of neighbors. For

implementations can be defined by calculating the center of the whole group and boid directed towards

local neighbors [41].

∑ �������

| � | (1)

For cohesion simulation can be seen in Figure 3.

Figure 3. Cohesion (Flocking) [41]

Separation (collision avoidance)

Separation boid is a tendency to keep away from its neighbors and avoid the possibility of collision or

collision. For the simulation can be interpreted by restrictions if a boid too closely with the other boid, by

setting of adjustment direction and speed to avoid a collision (collision) [41].

Page 7: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

∑ � ������� �� ��� � � �� ���� � (2)

For Separation simulation can be seen in Figure 4.

Figure 4. Separation (collision avoidance) [41].

Alignment (velocity matching)

Alignment is a tendency to equate boid direction and speed with neighbors. This is an important factor

that causes the boid to follow each other. For the simulation can be interpreted taking the average of all

other boid acceleration and speed adjustments to move toward group [41].

∑ � ������� �������� � (3)

Description: npos: Position Number boid

boidpos: Position boid

nvel: Speed Whole Number boid

For Alignment simulation can be seen in Figure 5.

Figure 5. Alignment (velocity matching) [41].

Page 8: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

Reynolds [41] in future studies refer to the case when there is some obstacle in the simulation

environment must ditambahkn two more in boid rules is to avoid collisions with obstacles and to browse

in a complex environment. Two additional rules are:

Obstacle Repulsion

Obstacle Repulsion is a rejection of the obstacle where each boid will detect the position of an obstacle. If

the obstacle within a radius range boid then hitch will be rejected. The smaller the distance the stronger

repulsion [41].

Figure 6. Obstacle Repulsion [41].

Goal of Attraction

Goal of Attraction is attraction boid to a destination that this rule is put into a leader. Following behavior

for the leader, it is important to use the interest to the purpose to guide the leadership to achieve the goal.

Following the lead in making boid another boid tends to approach the position where the principal and

interest are the so-called "leader attraction" [41].

Figure 7. Leader Following [41].

Page 9: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

6. Genetic Algorithms

Genetic algorithm is an adaptive method which is used to solve a scatter of values in a problem of

optimization. This algorithm is based on the genetic processes in living organisms; namely the generation

developments in a natural population, is gradually following the principle of natural selection [42]. By

mimicking the evolution theory, genetic algorithms can be used to find solutions to the problems in the

real world.

Moreover Genetic algorithm is a pioneer in the meta-heuristic approach that usually raises a number of

population in the initial optimization problem into a solution. As the evolutionary process in nature, a

simple genetic algorithm which generally consists of three operators: reproduction operator, crossover

operator (crossbreeding) and mutation operators. The general structure of a genetic algorithm can be

defined by the following steps [43]:

1. Generating the initial population, the initial population or chromosomes is randomly generated to

obtain the initial solution. Evaluation of the value of each individual in the population using the fitness.

Determine the size of the population, the probability probilitas crossbreeding and mutation.

2. Sets iteration t = 1

3. Choose the best individuals to be copied to replace a certain number of other indvidu (elitism)

4. Perform competitive selection to choose members of the population as a parent to do interbreed

5. Perform interbreeding between the parent for the selected

6. Determine some individuals in a population to undergo a process of mutation

7. If not reached kovergensi iteration set t = t +1

8. Return to step 2.

In application of genetic algorithm involves several terms and operators, among others:

chromosome

Chromosome is the most important part of the genetic algorithm. Chromosomes or individuals

representing the solution vector [43]. Several studies using the vector solution in genetic algorithm

implementation. However in some cases the solution vector encoding or encoding process is done in the

implementation. Pengkoden process is done to represent a binary value in the solution and the number

kontinyus.

Fitness

The fitness function is a function that is used to determine whether a feasible chromosome to survive [43].

At each generation selected chromosome are approaching a solution to evaluate the suitability function of

the chromosome. This function is defined such that the greater the fitness value the greater the probability

for selected in the next generation. To maximize the objective function can be used as a fitness function,

so that the chromosomes which represents the value of the function selected will have a large probability

Page 10: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

as well. For minimization can be formulated such that the smaller the objective function that it has a large

fitness function.

The fitness function used is

F (x) = 1 / (1 + f (x) ^ ') (4)

where f (x) is the goal of the problem to be solved. For the case of minimization if obtained f (x) is small

then fitnessnya great value, otherwise if the case fitnessnya maximization function normally uses the

value f (x) itself.

elitism

The concept of elitism in Genetic algorithm means that efforts to maintain the best individuals that have

been obtained in a generation into the next generation [43]. This step is done through a variety of ways:

by copying the best individual, or through a combination of derivative solutions to the parent or child.

Proven with elitism operator has a very important influence when using Genetic algorithms to solve the

optimization problem with a single purpose.

selection

The selection process Adala a process in genetic algorithm to obtain the parent chromosomes [43]. In the

selection process of individuals who have the greatest fitness value will have a greater chance elected as

the parent chromosome. In the case of the smaller function minimization objective function value means

the greater the value the greater the chances fitnessnya and selected to be the new parent chromosome.

crossbreeding

The process of crossbreeding operations designed to find better possibilities of the existing members of

the population [43]. In the genetic algorithm there are several techniques to do that interbreeding

interbreeding crossbreeding simple arithmetic. In simple interbreed if there are two parents P1 and P2 and

produce offspring C1 and C2. Suppose the members of the parent X = [X1, X2, .... Xn] and Y = [Y1, Y2,

.... Yn] and r is the number of discrete random value between 1 and the length of the vector X, then U and

V representing C1 and C2 defined as follows

█ U_i = {(x_ (i) i <r @ y_i otherwise) ┤ (5)

█ v_i = {(x_ (i) i <r @ y_i otherwise) ┤ (6)

Mutation

Mutation is a process that allows the emergence of new individuals that are not derived from the result of

cross breeding [43]. The process of mutation refers to a change order or change of the elements of the

vector solution, the appearance of new value. The most important parameter in the process of mutation is

the mutation probability. This probability will determine the chromosome where the gene will change.

The greater the probability of mutation, the more chromosomes in the population will experience

mutations. Suppose the value of the mutation probability of 0.01 tone aka 1% of all chromosomes that

will undergo mutation.

Page 11: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

DESIGN

Stages of the research to be carried out can be seen as Figure 9 below:

Figure 9. Methods Research

1. Designing Dynamic Environment

Simulation of dynamic pathfinding one of which consists of a dynamic environment which will be

realized in the form of a map in the video game which will consist of 3 scenarios hitch hitch containing

static and dynamic obstacles.

The third scenario consists of : 1). Environment with additional hitch, 2). Environment with a moving

obstacle, 3). Environment with reduced snag

(a) (b)

Figure 10. Environment with an additional obstacle

(a) (b)

Page 12: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

Figure 11. Environment with moving obstacle

(a) (b)

Figure 12. Environment with reduced snag

2. Design of Non-Player Character

Non-player character in a video game simulation is an agent that has artificial intelligence that will later

be integrated with dynamic pathfinding algorithm as the method proposed in this study.

Non-player character that will be designed to take a model like figure 13 below.

Figure 13. Non-player character

3. Dynamic pathfinding algorithm

3.1. Trajectory

This study assumes that the number of variables boid flock with Nb. At a certain time in the process,

namely i, boid has sett position (i) with k � INB ≡ {1, 2,. . . , Nb}. Follower NPC (non-player character

Follower) is located in pV (i) and the position of the target pT. At the selected time i herd distributed

Page 13: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

through R2 (distance to the target). In the room there is a distribution of NO as a dynamic obstacle and

establish its position as pO (i) with O � Ino ≡ {1, 2,. . . , NO}.

Then DO domain as a static obstacle. Configuration space (CS) is an area R2 DO net domains such that

the NPC Follower regarded as the point moves in CS. DO domain is a circle which guarantees that no

collision between the obstacle and the NPC Follower when the process takes place and the boid regarded

as the particles move.

At any given time i boid, obstruction and NPC Follower is at a certain position. A trajectory curve Pi is

the joint between the NPC Follower and targets through a number of locations boid. Segments combined

two boid in the street can not intersect with the obstacle. This fact guarantees that any path yan are formed

in the CS environment. Therefore, the path P consists of several lists where the first position is the

position of the NPC Follower, pV (i), the latter is the position of the target pT, and PBB (i) is the position

between the NPC and the target of boid Follower selected, namely:

P (i) = {pV (i), PB1 (i), Pb 2 (i), PB3 (i),. . . , PBNI (i), pT} (7)

Where Ni is the number of boid form the roadway in time i. In this study the size of the road as the

number of elements, namely Ni +2. The key point of this method is associated with the ability to explore

CS herd in an efficient manner.

Figure 14. Symbols / notation

Page 14: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

It is designed to dynamically for each boid could be the first targets. At the same time, also taking into

account the nearest neighbors as well as the position or hindrance. We emphasize that the dynamics leads

to complex collective behavior of swarms that ultimately explores CS subregion that contains a set path or

trajectory is possible.

The benefits of the proposed methodology include:

• Motion collective herd allows simultaneous exploration and form many different paths.

• In certain situations there is no way a solution at a given time. However, the algorithm gives a partial

path that puts the NPC Follower close as possible to the target. Because the environment is dynamic, the

way the solution is expected to eventually be available at a later time. In such case, this method will be

able to find it. In this case the algorithm does not get stuck in a local situation where the rate of boid can

not continue.

• Affordable Computing

3.2. Boid herd behavior (Behavior BoidFlock)

As mentioned above, the behavior of the members of the herd is continuously controlled by a set of rules.

Every rule has an individual purpose that does not describe the entire flock boid behavior. Only when all

the rules are applied together, forming herd behavior. These rules can be describe as follows:

Separation (collision avoidance)

To avoid collisions between members of the herd, it is necessary to implement the behavior that allows to

keep each boid at a certain distance from the herd. This can be achieved if the herd produces repulsion

effect that directs the boid towards the free space in the scenario. To simplify notation and because each

rule will be applied to the selected boid b at any given time ie i, we suppress from now on every time a

reference to an index that is pb (i) ≡ bp, and so like notation dipembahasan trajectory. This particular

form of this rule is stated as follows:

(8)

Alignment (velocity matching)

Page 15: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

Alignment rule requires that if many members of the group have the same orientation in the move, other

members who have different motion will try to adopt the same orientation.

This rule is useful when some members of the herd to detect obstacles and avoid them and continue to

react to their movements. Due to the fact that they are correlated with other boid away from the obstacles

many of boid will tend to avoid obstacles upfront because they use the information from the first boid

detect obstacles. This particular form of this rule is stated as follows:

(9)

Cohesion (Flocking)

The action of the repulsion force alone will lead to the separation of the herd in the available space. To

provide herd behavior Cohesion need to apply the rules to keep them together.

First, for each boid position of the center of mass of its neighbors is calculated. Second, the position

vector of the center of mass is subtracted from the position vector and the resulting vector boid considered

reduced with speed. As a result, boid mutually attracted to each other. In this rule there boid distinguished

members of the herd that is the leader of the flock boid closest to the target without obstacles between

him and the target is the leader and we demonstrate its position as pl. Boid close to the leaders all have

special considerations, ie the center of mass is not calculated and boid only has an interest in leadership.

Cohesion official rules are as follows:

(10)

Goal of Attraction

Because the effects of this rule, all belonging boid flock attracted by the target. This style is interesting is

proportional to the distance between the boid and targets, namely:

Rtarget = pT - pb (11)

Obstacle avoidance

Page 16: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

In order to find a valid path, it is necessary to avoid collisions between members of the herd and

obstacles. To carry out this task in a dynamic situation, the more complex rule has been designed.

This formula takes into account the behavior of pT goal position, obstacle position pk, pb boid position

and velocity vk barriers.

(12)

where a <b indicates the angle formed by the vectors a and b.

3.3. Improved Genetic Algorithm for pathfinding

Boid is used as a point to form a trajectory being the ability to explore the environment computed by IGA

(Improved Genetic Algorithm). IGA chosen because of the ability of genetic algorithms in parallel and

global search technique that emulates natural genetic operators. Due to simultaneously evaluate many

points in the parameter space, so that they can more quickly find the global optimum [29].

Chromosome encoding

A chromosome is a candidate solution to the problem of planning the path or trajectory. A chromosome

consists of a node or way early, the target node and nodes that NPC Follower running over them. These

nodes or steps on the road called the gene of the chromosome.

Population initialization

Initial population is generally generated randomly. Some chromosomes are generated to cover the

intersecting road barriers are not feasible. A near-optimal solution can be found by genetic operators,

including track despite initial population is not feasible. However, this process reduces the search ability

of the algorithm and increases the time to find the optimal solution. Furthermore, the crossover of two

chromosomes is not feasible to generate new road is not feasible. To overcome this problem, each

chromosome must be checked whether the bypass obstacles, when generating the initial population. If

not, intersect gene on chromosome change randomly with decent.

Page 17: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

Figure 15. Initial po

Fitness Function

The objective of the trajectory plann

destination node. Optimal trajectory

general, the path or trajectory planni

In this study, the value of the fitness

the following equation:

The following description of f is the

of the chromosome, d is the distance

of the current boid, x (i +1) and y (i

Method of selection

The main principle of the genetic alg

transferred to a new generation. At t

best chromosome. The selection pro

value of all the chromosomes are fo

in accordance with the values of the

assignment method is used instead o

become dominant in the population.

fitness function and then put in a po

population

nning problem is to find the optimal path between the

ry may be the shortest, least time and energy required

ning problems, the objective function is considered as

ss function of the chromosomes used in genetic algori

he fitness function, pi is the gene with the chromosom

ce between two nodes, xi and yi are the horizontal and

(i +1) are the horizontal and vertical position next boid

algorithm is that the best genes on chromosomes shou

t this stage, the selection procedure needs to be done t

rocess consists of three steps. In the first step, the obje

found. In the second step, the values assigned to the ch

heir fitness function. In this study, the task of rank-bas

d of proportional. This prevents some of the better chro

n. In the last step, chromosomes are selected accordin

pool crossover to produce new chromosomes.

he start and

ed is small. In

as the shortest path.

orithms is given in

(13)

(14)

me, n is the length

nd vertical position

oid.

ould be saved and

e to determine the

bjective function

chromosome fitness

ased fitness

hromosomes to

ing to the values of

Page 18: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

There are many selection strategies such as roulette wheel selection, Boltzmann selection, ranking

selection, tournament selection and elite selection. Both roulette wheel selection and elite selection used

in this study and the latter is used to avoid missing the best solution in the next generation. The basic idea

of the roulette wheel selection is that the probability of selecting an individual is proportional to the

fitness of individuals. The idea is that some of the elite selection of the best performing individuals are

stored and used to replace the same boidyang of the worst individuals in the next generation. That is, the

offspring will evolve into at least as good as their parents.

Crossover operators

Generally, crossover which combines the features of two parent chromosomes to form two offspring.

Singlepoint crossover operator used in this study.

Figure 16. Crossover

Mutation operator

All candidates chromosomes in the population subjected to random mutation after crossover operation. It

is bit-wise complement binary operationatau small random changes in the gene, depending on the

chromosome coding, applied uniformly to all the genes of all the individuals in the population with a

probability of mutation rates. Mutation operation increases the population diversity and avoid the

premature convergence.

For mutation carriers can be described as follows:

1. Choose one node, which is not the beginning or the target node, random mutation of a gene mutation

individuals.

Page 19: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

2. Determine a set, which consists of all decent (non-barrier) nodes neighboring node mutation.

3. Determine the fitness value of all trajectories, each of them consisting of a set of neighboring nodes.

4. Mutated node that has the best fitness value is replaced with the original node mutation.

Figure 17. Mutations

IMPLEMENTATION

1. Implementation of Dynamic Environment and Non-player Character

Implementation of a dynamic environment that will be a simulation of the dynamic pathfinding and non-

player character as an agent will be made in 3D models in a 2D concept despite holding

pengamplikasiannya.

Unity is a 3D game engine that will be used to simulate the dynamic pathfinding. Implementation of this

research will be placed in a scene. Scene in the game engine is the world where all the 3D object is

located and is the format used in the simulation, where the scene will contain both static and dynamic

obstacle according to the scenario and also designed a non-player character follower.

2. Dynamic pathfinding algorithm implementation

2.1. Running the point boid

The three rules above plus two additional rules will form a herd behavior where each boid can later be

used as a point of trajectory to form a path or paths to the destination. Overview of boid behavior toward

a goal can be seen as Figure 18.

Page 20: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

Figure 18. Simulation boid behavior

Overview flowchart of the proposed algorithm can be seen in Figure 19. Where in the trajectory planning

will be in computing by IGA (Improved genetic algorithm).

Figure 19. Flowchart main algorithm

2.2. Planning trails with Improved Genetic Algorithm

Page 21: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

In general, the proposed algorithm to perform pathfinding in dynamic environments by NPC Follower on

video games can be seen in the section above and detailed flowchart for the algorithm used to

dynamically determine the best path or the path to a destination can be seen in Figure 20. Following.

Figure 20. Flowchart Improved Genetic Algorithm

IGA which will be used to perform computational determine the optimal trajectory to the goal will be

conducted in parallel with the goal of computing levels will be low because boid trajectories are used as a

point less. Overall the results of the calculation of the main algorithm will like the picture 21. Example

simulation plan.

Page 22: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

Figure 21. Picture dynamic pathfinding algorithm

TESTING

1. Time / FPS (Frames Per Second)

Frames per second (FPS) on the display simulation is the number of image fragments, different images

displayed per second to fool the viewers eye into moving objects. FPS also called frame rate, fps is a

measure of fluidity [45].

Capacity of 20 fps is considered by most parties as a minimum threshold to trick the eye. Higher frame

rates (ranging from 60 fps) produces a more indulgent animation, and gaming consoles to sacrifice some

other elements to maintain this level [45]. Lower FPS due to system limitations, poor programming, and

other applications that spend system resources (such as: artificial intelligence). Details of the images, such

as screen resolution, the complexity of objects, and lighting also lowers the amount of FPS. FPS can be

calculated with the formula amount drawn frames / sec.

Tests using the dynamic pathfinding FPS will be known to what extent the resulting trajectory in size or

speed time to reach the destination based testing scenarios.

2. Paired sample t-test

T test (paired sample t-test) comparing digunakanuntuk average of two groups of two. Paired samples can

be interpreted as a sample with the same subject but have 2 different treatments or measurements, ie

measurements before and after a treatment.

Testing t test (paired sample t-test) was done by comparing the t value with the t table with a level of

significant (α) with α = 0.05 so that the value can be determined or not a hypothesis is accepted if:

• H0 is accepted if the table-t ≤ t ≤ t table means there is no significant effect of the proposed algorithm to

the average FPS in 3D games.

Page 23: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

H0 is rejected if t count> t table or-t <-t table, meaning that there is a significant effect of the proposed

algorithm to the average FPS

• the 3D game.

References

[1] Andre Marchand and Thorsten Hennig-Thurau, Value Creation in the Video Game

Industry: Industry Economics, Consumer Benefits, and Research Opportunities, Journal

of Interactive Marketing, pp. 141 – 157, 2013.

[2] Ian Millington and John Funge, Artificial Intelligence for Game : second editon,Morgan

Kaufmann Publishers, 2009.

[3] Adi Botea, Bruno Bouzy, Michael Buro, Christian Bauckhage, and Dana Nau, Pathfinding

in Games,Dags tuhl Follow- Ups, Vo.6, pp.21-31, 2013

[4] P. Hart, N. Nilsson, and B. RaphaelA formal basis for the heuristic determination of

minimum cost paths,IEEE Transactions on System Sciences and Cybernetics, SSC-

4(2):100–107, 1968.

[5] Peter I. Cowling, Michael Buro, Michal Bida, Adi Botea, Bruno Bouzy, Martin V. Butz,

Philip Hingston,bHéctor Muñoz-Avila, Dana Nau, and Moshe Sipper, Search in Real-

Time Video Games,Dags tuhl Follow- Ups, Vo.6, pp. 1-19, 2013.

[6] R. Korf,Depth-first Iterative Deepening: An Optimal Admissible Tree Search,

ArtificialIntelligence, 97:97–109, 1985.

[7] I. Pohl,Heuristic Search Viewed as Path Finding in a Graph, Artificial

Intelligence,1(3):193–204, 1970.

[8] D. Harabor and A. Botea,Hierarchical Path Planning for Multi-Size Agents in

Heterogeneous Environments, In Proceedings of the IEEE Symposium on Computational

Intelligence and Games CIG-08, pp. 258–265, Perth, Australia, December 2008.

[9] Nathan R. Sturtevant and Michael Buro,Partial pathfinding using map abstraction and

refinement, In Association for the Advancement of Artificial Intelligence (AAAI), pp.

1392–1397, 2005.

[10] Peter Yap, Neil Burch, Robert C. Holte, and Jonathan Schaeffer, Block A*:

Databasedriven search with applications in any-angle path-planning, In AAAI, 2011.

Page 24: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

[11] R. Korf,Real-Time Heuristic Search,Artificial Intelligence, 42(2-3):189–211, 1990.

[12] Bjornsson, Y., Bulitko, V., Sturtevant, N.TBA*: Time-bounded A*. In: Proceedings of the

International Joint Conference on Artificial Intelligence (IJCAI), AAAI Press, Pasadena,

pp. 431 – 436, California, 2009.

[13] Sturtevant, N.R., Bulitko, V., Bjornsson, Y, On learning in agent-centered search,

Autonomous Agents and Multiagent Systems (AAMAS), 2010.

[14] Bulitko, V., Bjornsson, Y,kNN LRTA*: Simple subgoaling for real-time search,

Proceedings of Artificial Intelligence and Interactive Digital Entertainment (AIIDE), pp.

2–7. AAAI Press, Stanford, California, 2009.

[15] Bulitko, V., Bjornsson, Y., Lawrence, R,Case-based subgoaling in real-time heuristic

search for video game pathfinding, Journal of Artificial Intelligence Research (JAIR),

2010.

[16] Alex Fernandes da V. Machado, Ulysses O. Santos, Higo Vale and Rubens Gonçalvez,

Real Time Pathfinding with Genetic Algorithm, Games and Digital Entertainment

(SBGAMES),IEEE, 2011.

[17] Mike Phillips and Maxim Likhachev, SIPP : Interval Path Planning for dynamic

environment, Roboticsand Automation (ICRA), Vol. 1, 2011.

[18] Jesus Espelosin, Leopoldo Acosta, and Daniel Alonso, Path planning Approach based on

Flock Dynamic of Moving particle, Applied Soft Computing, Elsevier, 2013.

[19] C.W. Reynolds, Flocks, herds and schools: a distributed behavioral model, ACM

SIGGRAPH Computer Graphics, pp. 25–34, 1987.

[20] Nathan R. Sturtevant, Moving Path Planning Forward, MIG 2012, LNCS 7660, pp. 1–6,

2012.

[21] P. raja and S. Pugazhenthi, Optimal path planning of mobile robots: A review,

International Journal of Physical Sciences, Vol. 7(9), pp. 1314 - 1320, 23 February, 2012.

[22] Prases K. Mohantyand Dayal R. Parhi, Controlling the Motion of an Autonomous Mobile

Robot Using Various Techniques: a Review, Journal of Advance Mechanical

Engineering, pp. 24-39, 2013.

[23] M.A. Porta Garcia, Oscar Montiel, Oscar Castillo, and Roberto Sepulveda, Path

planning for autonomous mobile robot navigation with ant colony optimization and fuzzy

cost function evaluation, Elsevier : Applied Soft Computing, pp.1102–1110, 2009.

Page 25: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

[24] Shirong Liu, Linbo Mao and Jinshou Yu, Path planning based on ant colony algorithm

and distributed local navigation for multi-robot systems, Proceedings of the 2006 IEEE

International Conference on Mechatronics and Automation, pp. 1733–1738, June 2006.

[25] Michael Brand, Michael Masuda, Nicole Wehner, Xiao-Hua Yu, Ant Colony

Optimization Algorithm for Robot Path Planning, 2010 International Conference On

Computer Design And Appliations (ICCDA), 2010.

[26] Yee Zi Cong and S. G. Ponnambalam, “Mobile Robot Path Planning using Ant Colony

Optimization”, 2009 IEEE/ ASME International Conference on Advanced Intelligent

Mechatronics, Suntec Conventionand Exhibition Center, Singapore, 2009.

[27] Song-Hiang Chia, Kuo-Lan Su, Jr-Hung Guo and Cheng-Yun Chung, Ant Colony System

Based Mobile Robot Path Planning, Fourth International Conference on Genetic and

Evolutionary Computing, 2010.

[28] Hong Qu, Ke Xing, and Takacs Alexander, An improved genetic algorithm with co-

evolutionary strategy for global path planning of multiple mobile robots,

Neurocomputing, pp. 509–517, 2013.

[29] Adem Tuncer, and Mehmet Yildirim, Dynamic path planning of mobile robots with

improved genetic algorithm, Computers and Electrical Engineering 38, pp. 1564–1572,

2012.

[30] Zhigang Yao and Lianyang Ma, A Static Environment-Based Path Planning Method by

Using Genetic Algorithm, International Conference on Computing, Control and Industrial

Engineering, 2010.

[31] James Kennedy and Russell Eberhar, Particle Swarm Optimization, IEEE, 1995.

[32] Elshamli A, Abdullah HA, Areibi S, Genetic algorithm for dynamic path planning,

Canadian conference on electrical and computer engineering, p. 677–80, 2004.

[33] Bulitko, V., Sturtevant, N., Lu, J., Yau, T, Graph abstraction in real-time heuristic

search, Journal of Artificial Intelligence Research (JAIR) 30, pp. 51–100, 2007.

[34] Bulitko, V., Lustrek, M., Schaeffer, J., Bjornsson, Y., Sigmundarson, S, Dynamic control

in realtime heuristic search, Journal of Arti?cial Intelligence Research (JAIR) 32, pp. 419

– 452, 2008.

[35] Schell, Jesse. The Art of Game Design: A book of lenses,CRC Press, Florida 2008.

Page 26: DYNAMIC PATHFINDING USING GENETIC ALGORITHM of Automation/Abstracts 2014... · pathfinding algorithms in real time is the use of a genetic algorithm capable of computing trajectories

[36] Zimmerman, Eric. Salen, Katie,Rules of Play - Game Design Fundamentals, The MIT

Press Cambridge, Massachusetts London, England 2004.

[37] Ernest Adams, Fundamentals of Game DesignSecond Edition, New

RidersPublished,2010.

[38] Simpson, J.,Game engine anatomy 101, 2002.

[39] Lewis, M., and Jacobson, J,Game engines in scientic research, Communications of the

ACM 45, pp. 27–31, 2002.

[40] Chen, Siyuan, et al,Fast Path Searching in Real Time 3D Game, Global Congress on

Intelligent Systems, 2009.

[41] Craig W. Reynolds,Steering behaviors for autonomous characters. In Proc. of theGame

Developers Conference, volume San Jose, CA, pp. 763–782. 1999.

[42] Srinivas, M. and Pootraik, L. M,Genetic algorithms: A survey, IEEE Computer, pp. 17–

26, 1994.

[43] D. Goldberg, Genetic Algorithms in Search, Optimization and Machine Learning,

Addison-Wesley ,MA ,1989.

[44] Li Q, Zhang W, Yin Y, Wang Z and Liu G,An improved genetic algorithm of optimum

path planning for mobile robots, Sixth international conference onintelligent systems

design and applications(ISDA)pp. 637–42, 2006.

[45] Aldrich, Clark.. The Complete Guide to Simulations and Serious Games: How the Most

Valuable Content Will be Created in the Age Beyond Gutenberg to Google. John Wiley

and Sons. Hoboken, 2009