Skip to content

ThinkEngine 2.1

deniseAngilica edited this page Jul 20, 2026 · 14 revisions

Welcome to the ThinkEngine Wiki!

ThinkEngine is a Unity asset that allows to integrate automated reasoning modules in a videogame or whatever other kind of software developed in Unity. ThinkEngine has been developed having the integration of declarative ASP modules in mind, but other types of automated reasoning can be wired (e.g., PDDL), with an effort which we are constantly working at making as light as possible.

Sample Games

Usage

How to add ThinkEngine to an existing project

For GitHub users:

Download and extract the file ThinkEnginePlugin.zip in the root folder of your Unity project (the one containing the Assets, Library, Packages, etc... folders).
Make sure that the dlv2 binary in the "Assets/StreamingAssets/ThinkEngineer/ThinkEngine/lib" folder has executability access rights.

Quick start

Scripts

The only scripting features you need to know about regard the ThinkEngineTrigger and the Action scripts. You can read about their usage at the relative sections: Programming custom triggers and Action (for Planner Brain only).

Available scripts for components

  • ThinkEngine works by wiring Brains to the game scene. There are two types of brains: Reactive brains and Planning brains;
  • Reactive brains work by wiring them to Sensors and Actuators;
  • How to wire Sensors: just add a Sensor Configuration script to a GameObject (or a Prefab) of choice; customize the Sensor Configuration by selecting which properties of the game object at hand need to be mapped to a sensor;
  • How to wire Actuators: just add an Actuator Configuration script to a GameObject (or a Prefab) of choice, and configure it by selecting which properties of the game object at hand need to be mapped to an actuator; one can also enforce a postcondition telling whether the action at hand must be executed (see below).
  • How to wire a Brain: select a GameObject or Prefab and add a Brain script (either Planner or Reactive);
  • You can now select in the Brain properties as many SensorConfiguration(s) and ActuatorConfiguration(s) (only for Reactive Brains) as you like;
  • If needed, one can generate the template of logical assertions showing how input sensors values and actions values are represented in a Brain;
  • The brain script will show you a predefined path in which to save one or more .asp files. .asp file declaratively specify the decision making logic of the brain at hand. All the .asp files matching the pattern in the ASP Files Pattern field will be executed together when a reasoning task is triggered;
  • In the Choose when to run the reasoner combo box, one can specify when a Brain activates, i.e. when reasoning is triggered (see below on how to program custom triggers).

You can give a look to the configuration demo available here. (for Reactive brains only)

A configuration demo for Planner Brains will be added soon.

Note: Prefabs should be placed in some folder located in "Assets/Resources/Prefabs". If you want to check the run-time generated ASP facts files, check the box Maintain fact file in the Brain component and access the "ThinkEngineFacts" in your "Temp" system folder by clicking the button Open Input Folder.

Programming custom triggers.

The ThinkEngine generates a C# script, named "Trigger", in the folder "Assets/ThinkEngineer/ThinkEngine/Scripts" (you can then move the script wherever you want). You can add to this script as many boolean functions (with no parameters) as you want. When configuring Actuators and Brains you will be provided with a drop-down list in which all those functions are listed: you can choose one of these as "reasoning task trigger" (for triggering brains' reasoning tasks) and "apply actuator trigger" (for triggering the actuators). Note that there is always a default trigger event: "When sensors are ready" for brains and "Always" for actuators.

You can find a detailed documentation and a video tutorial here.

How to cite ThinkEngine

If you want to mention the latest ThinkEngine:

Denise Angilica, Giovambattista Ianni, Francesco Pacenza, Jessica Zangari: Integrating ASP-Based Incremental Reasoning in the Videogame Development Workflow (Application Paper). PADL 2023: pp. 96-106

Denise Angilica, Giorgio Michele De Giorgio, Giovambattista Ianni: On the impact of sensors update in declarative AI for videogames. ICLP Workshops 2023

D. Angilica, G. Ianni, F. Pacenza: Declarative AI design in Unity using Answer Set Programming. IEEE Conference on Games (CoG) 2022: pp. 417-424.

Earlier ThinkEngine version (older mapping scheme, no planning, many less features) was reported in:

D. Angilica, G. Ianni, F. Pacenza: Tight Integration of Rule-Based Tools in Game Development. AI*IA 2019: pp. 3-17.

The Team

Core:

  • Giovambattista Ianni (Project coordinator, tweaking and fiddling)
  • Denise Angilica (Chief Code Maintainer)
  • Francesco Pacenza (Code and game development, ASP integration)

Developers:

*Giorgio Michele De Giorgio (sensors' reflection at design time - optimization)

Past and present student collaborators:

  • Fabio Barrese (Code development, porting to macOS, showcase games development and upgrade)
  • Antonio Pantaleone Carito (Frogger showcase game)
  • Salvatore Laiso (benchmarking engine)
  • Giuseppe Beltrano (showcase game development)
  • Emmanuel Scarriglia (early version of the testing engine)
  • Alessio Farfaglia (game development, testing and bugfixing)

Contact us

Feel free to reach us at thinkengine @ unical.it