EvolvingBehavior  0.2.0
 
Loading...
Searching...
No Matches
Troubleshooting

On this page, we try to provide some steps to troubleshoot common problems.

Crashes

If you are experiencing crashing, here are some possible troubleshooting steps and common causes:

The most common two causes of crashes directly related to EvolvingBehavior are: old/invalid save files, and incomplete or mis-configured Evolution settings.

Misconfigured Evolution Settings

  • Check the logs for warnings or errors:
  • If you are able to run and pause the experiment at the start before the crash, open the Output Log (Window -> Developer Tools -> Output Log). Search for "EvolvingBehavior."
  • After a crash, you can also find these logs in the folder "Saved -> Logs," which will allow you to check if there were warnings or errors before the crash.
  • If you see Warnings or Errors, look at what they say. Often they will tell you about some part of the program that is missing data.

If you don't see errors in the logs, you can still look through your EvolutionControl actors and LifeCycle actors for settings that are missing (objects set to "None," or missing internal information. Often, adding these missing pieces will resolve crashes.

Old or Invalid Save Files

If you know that your settings are correct and you were able to run successfully before, but are now crashing, it may be that your experiment's save file is out of date or corrupted. Resuming from a previous saved experiment requires that the settings, behavior trees, and actors be similar enough to copy data from the save file. So if you have upgraded your project or plugin version, or significantly changed your actors or settings, you may need to delete (or rename) the old save (or change your LifeCycle component to a different save name), and start a new experiment.

If neither of these resolves your crashes, you may want to try a simpler test case or map, or deleting and re-creating EvolutionControl actors. Your crashes could also be related to your project's code - check that your project runs correctly without EvolvingBehavior being used. Finally, if you are still experiencing crashes, you can submit a bug report to the EvolvingBehavior GitLab repository (https://gitlab.com/NPC-Dev/evolvingbehavior).

Hangs and Infinite Loops

If Unreal Engine is stuck, hanging, or in an infinite loop, a likely cause might be a Behavior Tree node that loops infinitely (or for a long time). The "Loop" node type is a common culprit - make sure you don't have Loop nodes that will run for a long time, or that could generate infinite or long loops, especially if they could nest within each other. If you have created other node types that may loop or take a long time to execute, try removing them as well, and see if the problem stops happening. Then, try to re-write them to prevent infinite or very long execution.

Nothing is Changing

If you don't see any changes or movement in your characters when running EvolvingBehavior, there are several possible causes. Here are some things to double-check:

  • Check that you have built a valid navigation mesh for your level, and that your AI character is set up to move properly on it (perhaps test with a simple, static behavior tree that includes only a "move to.")
  • Use the Unreal AI debugger to see that the behavior trees are actually running on your agent, and which nodes are running at any given time. If no tree is running, you might not be retrieving the trees properly when spawning your agents.
  • Check for misconfigurations or incomplete settings in the EvolutionControl Actor(s) or LifeCycle Actor(s) - see below for more detail.
  • Wait at least 10 generations (or longer!) to see whether the trees just need more time to generate a lucky combination of working nodes.

The below subsections expand on some of these possible issues:

Invalid or incomplete EvolvingBehavior settings

Double-check that your EvolutionControlActor and LifeCycle Actor have all their settings configured. Sometimes settings can get accidentally overwritten or deleted (such as when objects are copied or moved, etc.), so check that details of generated nodes, mutators, and other settings are all configured properly:

  • Check that you have a large enough initial population that at least one agent is likely to show some action (probably ~30-50 agents should be enough - assuming your behavior trees can show some activity with only a few valid nodes).
  • Check that you are providing behavior tree nodes that will cause the movement/action you expect. The initial behavior tree, extra node library, or generated nodes need to have your desired actions in them. By saving the resulting trees from each generation, you could inspect them to see whether at least some of them include nodes that will perform your desired action.
  • Check that your settings for mutation and parent selection have high enough probability of changing the trees, so you should expect to see changes within a reasonable number of generations.
  • Check that your initial population is diverse enough (add more mutators or generations in the initial population settings if you don't see a variety of trees in the first generation).

You can also search the logs for LogEvolvingBehavior to see if there are warnings or errors, but some settings misconfiguration issues may not show as errors.

Incorrect tags or not finding EvolutionControl Actors

If you see that your agents are not running a behavior tree, it may be that your code is failing to find the correct EvolutionControlActor to retrieve the behavior trees from. Double-check that your EvolutionControlActors have the correct tags (for their specific population), name, or references set up in the scene for how you are finding them to retrieve the trees.

Incorrect pathfinding settings

As noted above, you may want to check using a non-evolving agent that your level has properly configured pathfinding (nav mesh, agents set up to use it, no unexpected colliders or other issues preventing navigation).

The built-in Unreal AI debugger (https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/ArtificialIntelligence/AIDebugging/) may also help you find some issues with behavior trees and pathfinding.

Incomplete agent setup or fitness tracking

If you are occasionally seeing movement, but not often or not consistently, it may be that you are not tracking fitness correctly (or your fitness functions are not encouraging the behavior you prefer). You should check that your code is sending fitness updates for all agents, that the weights and fitness functions are giving reasonable values (i.e., no single component of fitness is overwhelming the others, higher fitness is being found for agents showing good behavior, etc.). You can add debug logging of individual fitness component updates, or check the output fitness log files for total fitness scores.

Unlucky random starting conditions

If all your settings are correct, but none of the NPCs are moving, it could just be that you got unlucky initial behavior tree population where none of the trees happen to have useful configurations of nodes. If you wait a few generations, some trees may end up improving - but, because all the fitnesses will be similar, this may not happen quickly or at all. Sometimes, you may be better off restarting the experiment once (or even multiple times) to try a new set of random starting conditions.