GAI2 BASIC Ai

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

GAME AI #

The basic of ai in game


AI pada dasarnya membuat
komputer terlihat dapat
berpikir dan mengambil
keputusan layaknya organisme
hidup dalam melakukan
operasi tertentu

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

LEVELING UP YOUR GAME WITH


AI
 Ketika kita berbicara tentang AI kita, kita tidak
secara khusus mengacu karakter, tapi sebuah
entitas yang menampilkan pola perilaku yang
kompleks
 Agent adalah entitas yang berperilaku secara
otonom
 Agent dapat berupa karacter, creature, vehicle, dan
lainya

DEFINING THE AGENT


AI guard character in a typical shooting game
 Salah satu metode AI di dalam
game yang simple, mudah dan
banyak digunakan dalam game.
 State Machine pada dasarnya
terdiri dari sejumlah state yang
saling terhubung oleh transisi di
dalam graf

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.

SEEING THE WORLD


THROUGH OUR
AGENT'S
EYES
 To appear intelligent, our agents need to be able to determine
where they are going,
 and if they can reach that point, they should be able to route
the most efficient path and modify that path if an obstacle
appears as they navigate.

PATH FOLLOWING AND


STEERING
 Widely used in games because of its performance
and accuracy.
 Split our whole map into small tiles, representing
the whole map in a grid format.
 choosing the tile with the lowest cost.
 this graph is inefficient because too much data is
representing the same zone

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….


 Sequence task mengevaluasi
child dari kiri ke kanan.
Memberikan nilai true atau
sukses ke parent jika semua
child nya true, memberikan
Sequence task nilai false/failed jika
minimalsalah satu child
bernilai false.

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.

THINKING WITH FUZZY LOGIC

You might also like