Creating custom AI
The process of creating custom AI is relatively straightforward, especially if you're comfortable with the actor system introduced in the previous chapter.
There are two parts of each actor; its IActor
implementation and the AI entity definition.
Registering an AI actor implementation
AI actors typically use the same IActor
implementation as the player, or at least a shared derivation.
In C#
Registering an AI actor in C# is very similar to how we did it in Chapter 5, Creating Custom Actors. Essentially, all we have to do is derive from CryEngine.AIActor
instead of CryEngine.Actor
.
The AIActor
class derives directly from Actor
, and therefore does not sacrifice any of its callbacks and members. However, it has to be explicitly implemented in order to make CryENGINE treat this actor as if it is controlled by AI.
public class MyCSharpAIActor : CryEngine.AIActor { }
You should now be able to place your entity from the AI category in the Entity browser, within Sandbox:
In C++
As with...