top of page

AI

The AI behavior is specifically designed to extend the editor and engine to implement artificial intelligence for object instances, for games built in Construct 3 and Construct 2.


The AI behavior supports the implementation of computer bots in games that simulate player-like behaviors. The intelligence percentage of a game bot is adjustable, which you can set as the difficulty to compete with them.


The AI behavior supports procedural learning, so your enemy bots can learn as they play. The AI behavior has a set of complete and mathematically balanced artificial intelligence algorithms, designed from scratch for Construct's architecture, thus complete and efficient, and most importantly, blazing fast.


The AI behavior implements artificial intelligence for object instances, which is useful for game application bots and artificially intelligent object instances.

PlayFab API v2.png

Introduction

Step 1.png

The Construct Master Collection has plugins that extends the editor and engine features of both Construct 3 and Construct 2.


Please click here to learn more about Game.

Features


The AI behavior is specifically designed to extend the editor and engine to implement artificial intelligence for object instances, for games built in Construct 3 and Construct 2.


The AI behavior supports the implementation of computer bots in games that simulate player-like behaviors. The intelligence percentage of a game bot is adjustable, which you can set as the difficulty to compete with them.

The AI behavior supports procedural learning, so your enemy bots can learn as they play. The AI behavior has a set of complete and mathematically balanced artificial intelligence algorithms, designed from scratch for Construct's architecture, thus complete and efficient, and most importantly, blazing fast.


The AI behavior implements artificial intelligence for object instances, which is useful for game application bots and artificially intelligent object instances.


Here are some of the game features of the game plugin:

  • Artificial Intelligence for game bot instances.

  • Intelligence report decision making.

  • Intelligence option decision making.

  • Decision methods

    • Percentage

    • Scale

    • Highest

    • Lowest

  • Direct or inverse bias of values on reports, for intelligence report decisions.

  • Decision processing tools

  • Decision reading tools

  • Function based design of decision making event creation.

  • Expression based decision making support in event creation.

  • Light and efficient artificial intelligence algorithms.

  • Mathematically balanced algorithms.

  • Designed from scratch with customized algorithms for Construct 3 and Construct 2, with the event sheet.

  • Adjustable instance intelligence, variable for game bot difficulty.

  • Artificial intelligence tools for data comparisons and flipping.

  • Complete data checking, processing, reading and retrieval using conditions and expressions.

  • Scalable with the Construct 3 and Construct 2 engines, supporting thousands of objects and object instances with no performance overhead.

  • Performance tested, blazing fast and efficient, with no performance overhead.

  • Well maintained and fully tested for production release.

For more information about game project features, please click here to read the introductory lessons to Game.


Platform Integration


Here are some of the platforms that are natively supported:

  • All platforms supported by Construct 3.

  • All platforms supported by Construct 2.

  • Web

  • Mobile Web

  • Desktop

  • Android

  • iOS


Build Support


Here are some of the supported build options:

  • Web

  • Desktop

    • NW.js

    • Windows (WebView2)

    • macOS (WKWebView)

  • Mobile

  • Construct 3 Build Service

  • Facebook Instant Games

  • Playable Ad

  • Construct Arcade


Editor Features


Here are some of the features in the Construct editor:

  • Construct 3

  • Construct 2

Introduction
Features

How to use?

It is easy to use the AI behavior, you will only need to follow the steps below.

1. The first step is to add any world object in your Construct 3 or Construct 2 project. Then place a world object instance in a layout.

  • Object in Construct 3 or Construct 2 is an entity you can see in your project bar, specifically in the Object types folder.


2. The second step is to click the Edit Behaviors button in the newly added object's properties. This will launch the Object behaviors dialog of the currently selected world object instance.



3. The third step is to click the Add new behavior button in the newly launched Object behaviors dialog.



4. Finally, add the AI behavior, to include its features in the currently selected object and its object instances.



5. You can also set the new plugin properties of the object instances.

  • Intelligence - is a percentage value from 0 to 100. It determines the intelligence of an instance, or accuracy in making decisions. An instance's decision accuracy varies from ​​its intelligence.

For more information about the AI behavior's properties, please refer to the Properties Section far below to learn more.

Instructions
Documentation

Documentation

For learning purposes, it is recommend to read the introduction tutorial to easily and quickly grasp the concept of the Artificial Intelligence behavior's decision-making based intelligence algorithm.



References:



Related Plugins


  • Self Function - is a plugin that implements functions on objects and its instances, for easy instance method calls and sub-classing. This is to extend the object's features and create behaviors using only the event sheet, without having to write JavaScript or an addon. It is a useful feature to use with the AI behavior.

ACEs

Actions, Conditions & Expressions

Actions

The following action groups:

  • Decision Making

  • Option Decision

  • Intel Report Decision

Decision Making

  • Decide - Make a decision, results are outputted on the expressions "CurrentDecision" and "CurrentDecisionVal".

    • Name - The name of the decision.


  • Create Decision - Create the blueprint of the decision, with the algorithm and method value to be used.

    • Name - The name of the decision.

    • Decision Type - The decision type in which the AI algorithm is run, either an Intelligence Report Decision or an Option Decision.

    • Decision Method - The value in which is to be interpreted and used. "Percentage" is preferable since it's scalable.


  • Set Intelligence - Set the object instance's intelligence. From '0' of absolute randomness, to '100' of absolute accuracy.

    • Percentage - Numerical value from '0' to '100', representing a percentage.


Option Decision

  • Set Option - Add or overwrite an option into the specified option decision's options list.

    • Decision Name - The name of the option decision.

    • Option Name - The name of the option.

    • Value - The value of the option.


  • Remove Option - Remove an option from the specified option decision's options list.

    • Decision Name - The name of the option decision.

    • Option Name - The name of the option.


Intel Report Decision

  • Set Report - Add or overwrite a report into the specified intelligence report decision's reports list.

    • Decision Name - The name of the intelligence report decision.

    • Report Name - The name of the report.

    • Value - The value of the report factor.

    • Bias - The feedback of the value towards the AI algorithm. Whether it's positive or negative.


  • Remove Report - Remove a report from the specified intelligence report decision's reports list.

    • Decision Name - The name of the intelligence report decision.

    • Option Name - The name of the report.

Conditions

The following condition groups:

  • Decision Making

  • Option Decision

  • Intel Report Decision

Decision Making

  • On Decision - Triggers when the specified decision is fired.

    • Decision Name - The name of the decision.

  • On Any Decision - Triggers when a decision is fired.

  • Is Decision Type - Check whether it is an "Intelligence Report Decision" or an "Option Decision".

    • Decision Type - Select the decision type to check.


Option Decision

  • Is Selected - Check the name of the currently selected option.

    • Option Name - The name of the option on the current option decision.


  • Compare Value - Compares the data of an option from the current option decision.

    • Option Name - The name of the option on the current option decision.

    • Option Data - The data of the option to compare.

    • Comparison - Select the way to compare the values.

    • Value - Enter the value to be compared.


  • For Each Option - Loops through all the options from the current option decision.

    • Decision Name - The name of the option decision.


Intel Report Decision

  • Compare Intel Percentage - Compares the intelligence percentage concluded from the current intelligence report decision gathered from the reports.

    • Comparison - Select the way to compare the values.

    • Value - Enter the value to be compared.


  • Compare Report - Compares the data of a report from the current intelligence report decision.

    • Report Name - The name of the report.

    • Report Data - The data of the report to compare.

    • Comparison - Select the way to compare the values.

    • Value - Enter the value to be compared.


  • For Each Report - Loops through all the reports from the current intelligence report decision.

    • Decision Name - The name of the decision.


  • Is Smart Decision - Checks if the current concluded intelligence report is a smart decision based on the gathered reports. Less than 50 is non-smart, greater than 50 is smart and exact 50 is undecided.

    • Analysis - The analysis to compare. Less than 50 is non-smart, greater than 50 is smart and exact 50 is undecided.


  • Is Positive Report - Checks if the specified report of the current concluded intelligence report is a positive feedback.

    • Report Name - The name of the report.

Expressions

The following expression groups:

  • Decision Making

  • Option Decision

  • Intel Report Decision

  • Option Decision : Advanced

  • Intel Report Advanced

  • Tools

Decision Making

  • Decide - Call for a decision, while also returning the current decision value. Returns the 'selected option' for an option decision or the 'intelligence percentage' for an intelligence report decision. Empty ("") if none.

    • DecisionName - The name of the decision.


  • Intelligence - Returns the intelligence of the object instance. A percentage value from 0 (random) to 100 (accurate).

  • CurDecision - Returns the current decision name from the recent Decision action or expression call. Empty ("") if none.

  • CurDecisionVal - Returns the current decision value. Returns the 'selected option' for an option decision or the 'intelligence percentage' for an intelligence report decision. Empty ("") if none.

  • DecisionType - Returns the decision type of the specified decision. Either "Report" or "Option". Empty ("") if none.

    • DecisionName - The name of the decision.


  • DecisionMethod - Returns the decision method of the specified decision. Either "Percentage", "Scale", "Highest" or "Lowest". Empty ("") if none.

    • DecisionName - The name of the decision.


Option Decision

  • SelectedOption - Returns the selected option from the recent option decision call of the specified option decision. Empty ("") if none.

    • DecisionName - The name of the option decision.


  • LoopOptionName - Returns the current option name from the "For Each Option" loop.

  • OptionPerceivedValue - Returns the perceived value of the option after applying the intelligence algorithm. (-1) if none.

    • DecisionName - The name of the option decision.

    • OptionName - The name of the option.


Intel Report Decision

  • IntelDecisionPercentage - Returns the output intelligence percentage of an intelligence report decision, based on the decision analysis. (-1) if none.

    • DecisionName - The name of the intelligence report decision.


  • LoopReportName - Returns the current report name from the "For Each Report" loop.

  • ReportBias - Returns the feedback bias of the report, either "Direct" meaning positive or "Inverse" meaning negative. Empty ("") if none.

    • DecisionName - The name of the intelligence report decision.

    • ReportName - The name of the report.


Option Decision : Advanced

  • OptionRank - Returns the rank of an option after the decision is made, starts from 0 (which is the selected option). (-1) if none.

    • DecisionName - The name of the option decision.

    • OptionName - The name of the option.


  • OptionPerceivedIntelligence - Returns the perceived intelligence percentage of the option after applying the intelligence algorithm. (-1) if none.

    • DecisionName - The name of the option decision.

    • OptionName - The name of the option.


  • OptionOriginalValue - Returns the option's value before applying the intelligence algorithm. (-1) empty if none.

    • DecisionName - The name of the option decision.

    • OptionName - The name of the option.


  • OptionDecisionMedian - Returns the option decision's median after applying the intelligence algorithm. (-1) if none.

    • DecisionName - The name of the option decision.


Intel Report Decision : Advanced

  • ReportPerceivedValue - Returns the perceived value of the report after applying the intelligence algorithm. (-1) if none.

    • DecisionName - The name of the intelligence report decision.

    • ReportName - The name of the report.


  • ReportPerceivedIntelligence - Returns the perceived intelligence of the report after applying the intelligence algorithm. (-1) if none.

    • DecisionName - The name of the intelligence report decision.

    • ReportName - The name of the report.


  • ReportOriginalValue - Returns the report's value before applying the intelligence algorthm. (-1) if none.

    • DecisionName - The name of the intelligence report decision.

    • ReportName - The name of the report.


  • ReportDecisionMedian - Returns the intelligence report decision's median after applying the intelligence algorithm. (-1) if none.

    • DecisionName - The name of the intelligence report decision.


Tools

  • ComparePercentage - Returns the resulting comparison percentage of 2 opposing values, the first value being the base of comparison.

    • CompareFrom - The percentage to compare the value from. From 0 to 100.

    • CompareTo - The percentage to compare the value to. From 0 to 100.


  • InversePercentage - Returns the inverse value of the percentage. Example, 100 would return as 0.

    • Percentage - The percentage to inverse.

Object   Properties

Plugin Properties

The following property groups:

  • Default

Default

  • Intelligence - Intelligence percentage of the object instance. Value from '0' to '100', from random to accurate.

Properties
Showcase

Showcase

The AI behavior has a game demo project that shows how the addon is used. This project shows how to program a bot for your game, that can adapt to a player's behavior while having its own self made decisions.





Fight Bot


The Artificial Intelligence behavior demo project is a 1 vs 1 archery game. It consists of a Player, which is the blue circle fighter, and a computer Bot, which is the red circle fighter.

Programming a bot for this type of game, requires sensors and behaviors, which can be done in various ways using built-in features and events.



The hardest task in the game bot design process, is the assigning of sensors and processing of the behavior's raw data. This is where the AI behavior comes in, by inputting the collected data and using the outputs to develop procedural scenarios, you can make a great working game bot with intelligent player-like features, efficiently.

The intelligent result is achieved by the behavior by making the decisions for the bot instance, and what's left for the game developer is just to setup the sensors and program the scenarios of the output data.

Usually, without the AI behavior, this process would take thousands of events. With it, this can be done as little as 10 events, depending on the amount of sensors and the complexity of the behaviors and scenarios.

Artificial intelligence is in theory, self sustaining, ideally if properly done, the more factors inputted the more intelligent, responsive and adaptive the instance becomes. And at some point, even one (1) flawed factor would be negligible and eventually the instance becoming self-reliant.

The AI behavior allows easy implementation of player-like game bot features into game applications, efficiently with less events and optimally fast.

For more information, please kindly check the demo projects in the bottom-most section of the documentation page.




Performance Rating


The AI behavior is light, efficient, full packed and blazing fast. It's tested effective and performant, even on low-end devices. A complete game demo with around 100+ decision factors, only used 0.2% of CPU usage. And 0.8% to 1.0% of CPU usage when 6x throttled, every tick! Hence, very efficient for large projects, for all target platforms and devices.





Demo CPU Utilization


The demo project's CPU utilization benchmark tests, in both Construct 3 and Construct 2.


Construct 3 runtime

The Fight Bot demo project only allocates about 0.2 % of the CPU with c3runtime and worker mode on the Construct 3 editor.



Construct 2 runtime

The Fight Bot demo project only allocates about 0.2 % of the CPU with c2runtime on the Construct 2 Editor.




Game Demo Project - Throttle Test


Throttling the browser's performance 6 times, also only increased from 0.2% to 1.0% CPU usage, which barely had any performance impact.

This AI behavior should also work great on low end devices for mobile and gaming consoles.



Game Projects

Game Projects 

Instructions Kit

Specifications

  • Instructions - The game project contains instructions and steps on how to use the addon and its features.

  • Action, Conditions and Expressions - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks on the recommended ways of using the addon.

Supporters

Only

bottom of page