modl.ai
Manually start an observation loop

You can choose between an automatic or manual start for observation loops. If your game requires time to perform logic before the test begins, you should start the observation loop manually. For anything else, choose automatic observation.

An observation loop uses the plugin to gather and send observations to the brain. The brain replies with commands which the plugin completes. This process repeats throughout a test run.

Turn off automatic observation

By default, modl automatically starts the observation loop when your game starts in the platform. To turn off automatic observation, go to the PluginConfiguration window and deselect Auto Start Observation Loop.

Start and stop an observation loop from your code

The PluginManager world subsystem controls observation loops. To start an observation loop, use the following code example:

#if WITH_MODLAI
const UWorld* world = GetWorld();
if (UModlPluginManager* pluginManager = world->GetSubsystem<UModlPluginManager>(); IsValid(pluginManager))
{
pluginManager->StartObservationLoop();
}
#endif

To stop the observation loop, use the following code example:

#if WITH_MODLAI
const UWorld* world = GetWorld();
if (UModlPluginManager* pluginManager = world->GetSubsystem<UModlPluginManager>(); IsValid(pluginManager))
{
pluginManager->StopObservationLoop();
}
#endif

Start and stop an observation loop with blueprints

You can also use blueprints to start and stop the observation loop.

To start an observation loop, use the following blueprint configuration:

To stop an observation loop, use the following blueprint configuration: