GAI2 BASIC Ai
GAI2 BASIC Ai
GAI2 BASIC Ai
CREATING THE
ILLUSION OF LIFE
Masing masing enemy pada game PacMan (Blinky, Pinky,
Inky, dan Clyde) memiliki perilaku unik sendiri yang
menambah kedalaman permainan. Membuat pemain ingin
kembali terus bermain.
Peran AI untuk membuat game lebih menyenangkan dengan
membuat entitas yang menantang dalam kometisi dan NPC
yang berperilaku realistis dalam dunia Game
Technologi saat ini memungkinkan kita mengembangkan
perilaku yang kompleks namun belum sampai pada titik
menyerupai perilaku manusia sebenarnya.
Sumber daya masih dibagi antara operasi lainnya seperti
render grafis, simulasi fisika, pengolahan audio dsb Semua
sistem ini harus berjalan baik untuk mencapai frame rate
yang stabil sepanjang permainan
FINITE STATE
MACHINES
States: Sekumpulan Kondisi yang dapat dipilih oleh agent
(contoh : patrol,chase,shoot)
Transitions: Komponen ini mendefinisikan hubungan antara
state yang berbeda
Rules: Komponen yang digunakan untuk memicu transisi
state (player on sight, close enough to attack, and lost/killed
player)
Events: This is the component that will trigger to check the
rules (guard's visible area, distance with the player, and so on)
4 KOMPONEN FSM
FSMs are a commonly used go-to AI pattern in game
development because they are relatively easy to implement,
visualize, and understand.
Using simple if/else statements or switch statements, we can
easily implement an FSM.
It can get messy as we start to have more states and more
transitions
Agar Ai terlihat meyakinkan, agent harus
dapat merespon setiap peristiwa di
sekelilingnya(the environment, the player,
and even other agents).
we have the advantage of being able to
access much more data within our game
than a real organism can from their
surroundings, such as the player's location,
regardless of whether or not they are in the
vicinity, their inventory,
Kita tidak perlu mereplika kompleksitas
sensor pada organisme hidup namun kita
dapat memodelkan data dengan cara yang
menghasilkan hasil yang sama.
A*
using a simple grid in A* requires quite a number of
computations to get a path that is the shortest to the target
and at the same time, avoids the obstacles.
Using waypoints for pathfinding, simple and quite effective in
using less computation resources
the problem is that the waypoints don't give any information
about the environment, other than the spline is connected
between the two nodes.
The resulting network is stripping away part of your actual
walk-able area.
for our AI entities to be able to effectively traverse the whole
level, we're going to need a tremendous number of waypoints.
WAYPOINT
Using The mesh of your floor geometry, by giving
each nodes an actual surface instead of point, the
network reflect the actual floor.
A navigation mesh uses convex polygons(Reduce
a bit more our number of nodes by merge
triangle) to represent the areas in the map that an
AI entity can travel to.
NAVMESH
FSM sangat rumit untuk diimplementasikan ketika digunakan
untuk perilaku yang kompleks dan dalam skala yang besar.
Behavior tree adalah kumpulan node, diatur dalam urutan
hirarkis, di mana node terhubung ke parent(menyerupai
cabang di pohon), daripada state yang terhubung satu sama
lain(pada FSM).
The basic elements of behavior trees are task nodes.
There are a few different tasks such as Sequence, Selector,
and Parallel Decorator
BEHAVIOR TREE
The selector will evaluate each child in
Selector task
order,from left to right. First, it'll choose
to attack the player; if the Attack task
returns success, the Selector task is
done and will go back to the parent
node, if there is one. If the Attack task
fails, it'll try the Chase task. If the
Chase task fails, it'll try the Patrol task
BEHAVIOR TREE
CONTINUE….
Imagine we’re writing AI for a character moving through
a dangerous environment. There are 2 state cautious and
confident, As the character moves through the level, it
will switch between the two states.
Fuzzy logic allows us to blur the line between cautious
and confident, giving us a whole spectrum of confidence
levels. With fuzzy logic we can still make decisions like
“walk slowly when cautious,” but both “slowly” and
“cautious” can include a range of degrees.