Skip to content

Integration: Bot and Factions

Team discovery and attitude resolution is done in the AI Controller, but this functionality is separate from it, meaning that you don't need to modify the default AI Controller to modify how teams and attitudes are established.

The same applies for the Ninja Factions integration, which is another plugin capable of providing Teams (Factions) and Attitude Resolution, via their Atttiude Solver object. This means that by connecting this object with the Ninja Bot's Team Provider we'll be able to easily integrate these systems together.

Once the integration is completed, Bots will react to perceived targets based on the Faction setup established between both actors. Neat!

Integration Design

The integration between the Ninja Bot and Ninja Factions is quite straightforward and simply requires the implementation of an Adapter, a common Design Pattern used to integrate two things.

However, you don't need to create this class yourself, unless you have a reason to do so. The Ninja Bot plugin provides the necessary Adapter class that can be used with the Ninja Factions. Please read-on to see how to enable this integration.

Automatic Detection

The Ninja Bot plugin automatically detects the presence of the Ninja Factions plugin, as long as they are installed in the same level, as such:

  1. Both are installed as Marketplace plugins and are located in the usual Marketplace folder.
  2. Both are installed locally in the project's "/Plugins" folder.
  3. Both are installed locally in a subfolder within the project's "/Plugins" folder.

To maka sure the integration has been loaded successfuly, you can check your Console Log, filtering with the LogNinjaBot category. When your engine initializes, the following lines should show up, meaning the integration is ready for use.

Faction Integration Log

Use the Adapter Class

If the above criteria is met, all you need to do is select the appropriate Adapter Class, provided by the NinjaBotFactions integration module in the Ninja Bot plugin.

Setting the Team Provider