Difference between revisions of "Ai Overview"
(Created page with "== Ai Overview == This article is about helping to understand how the Ai in Shards Online works. Some Basics: The Artificial Intelligence for NPCs follows a general Ai Prin...") |
|||
Line 9: | Line 9: | ||
* Act | * Act | ||
− | The model of implementation is a Finite State Machine. [[https://en.wikipedia.org/wiki/Finite-state_machine Wikipedia Article Finite State Machine]] | + | The model of implementation is a Finite State Machine(FSM). [[https://en.wikipedia.org/wiki/Finite-state_machine Wikipedia Article Finite State Machine]] |
+ | |||
+ | To understand how an FSM would transition from one state (e.g. "Idle") to another state (e.g. "Combat") in Shards Online (SO) it is important to understand the first step: "Sense". | ||
+ | |||
+ | How does an NPC sense the world? | ||
+ | |||
+ | There are several ways: | ||
+ | ;Messages | ||
+ | :Messages using the <code>Sendmessage</code> function tell the NPC someone or something sent it a message. To understand Messages the NPC needs to have the appropriate [[EventHandlers]]. | ||
+ | ;Views | ||
+ | :Views are added to objects by using the <code>AddView</code> command. A view is basically a search function performed on a configurably regular basis which triggers an event if something matching that search function enters its range. | ||
+ | ;FindObjects | ||
+ | :The <code>FindObjects</code> function can be executed whenever an NPC needs to find something. | ||
Revision as of 20:12, 1 November 2016
Ai Overview
This article is about helping to understand how the Ai in Shards Online works.
Some Basics:
The Artificial Intelligence for NPCs follows a general Ai Principle which is the cycle of
- Sense
- Think
- Act
The model of implementation is a Finite State Machine(FSM). [Wikipedia Article Finite State Machine]
To understand how an FSM would transition from one state (e.g. "Idle") to another state (e.g. "Combat") in Shards Online (SO) it is important to understand the first step: "Sense".
How does an NPC sense the world?
There are several ways:
- Messages
- Messages using the
Sendmessage
function tell the NPC someone or something sent it a message. To understand Messages the NPC needs to have the appropriate EventHandlers. - Views
- Views are added to objects by using the
AddView
command. A view is basically a search function performed on a configurably regular basis which triggers an event if something matching that search function enters its range. - FindObjects
- The
FindObjects
function can be executed whenever an NPC needs to find something.