Managing AI

Last modified by KDearnley on 2023/07/31 14:06

Though you can fight a large number of demons in a map, the game is limited to 12 simultaneously active AI. To focus the combat on the players, SnapMap manages the AI by showing, hiding, and deleting them automatically. However, it does not automatically manage those AI that are placed in editor from the Demon category. The map author must manage these hand-placed demons manually by showing, hiding, and removing them through logic.

Therefore, unless it is important for the AI to remain active until they are killed, we recommend using spawners and the conductor, as these AI are automatically managed by the game.



Hand-placed demons always take priority over spawned demons which take priority over AI Conductor demons. This means that any hand-placed demons will appear immediately if there are fewer than 12 active AI, even if there is a queue of AI waiting to spawn from Spawners or Events. Conversely, if a demon is summoned from a Spawner, it will get placed at the end of the queue until the player kills enough demons to empty the queue. This makes hand-placed demons ideal for encounters such as boss fights, where the boss must spawn it at a specific time.



A recent addition allows hand-placed demons to be automatically managed by the game through the AI Conductor Managed property, which can be enabled on each placed demon. This property allows the AI Conductor to show and hide AI based on proximity to the player in order to keep only the 12 most-relevant AI active. Hand-placed demons that are hidden by the AI Conductor Managed property will be shown if the player backtracks into an area. Because they are hand-placed, these AI are given priority over other hidden AI and will be shown first. Hidden hand-placed AI can still have logic run on them such as show, kill or buff.

Auto-ManagedPlaceAI.PNG



View the example map named Patterns: Managing AI with map ID FG2GQBLM.

Placed Demon Models

Individually placed demons should be managed by the user by using the Hide, Show and Delete inputs. If you are placing more than 12 demons, you should start by setting the property Show on Start to false on any demon that should not be spawned immediately.

PatternsManagingAIShowonStart.PNG



Show the hidden when you want them to be shown. Player actions such as entering a trigger volume, entering a module or picking up an item could be used as inputs to show demons.

PatternsManagingAIShowDemons.PNG



A crucial part of managing placed demons includes deleting or hiding demons that are no longer relevant to the player. For instance, when a player exits a module, you should hide or delete any remaining AI so that they are no longer occupying one of the 12 slots available for active demons.

PatternsManagingAIDeleteDemons.PNG

Single Demon Spawners

The exact same gameplay can be created using a Single Demon Encounter spawn object instead of a placed demon. Map creators can still select exactly where demons should spawn, with the added benefits of allowing the AI conductor to manage demons and allowing the encounters to be spawned multiple times in the same map.



Setting the Spawn Location property to Encounter and Spawn Proximity to Explicit Location allows the Single Demon Encounter to act exactly the same way as a placed demon. When spawned, the selected demon will appear exactly where the Single Demon Encounter object is placed.

PatternsManagingAISingleSpawnLocation.PNG



Just like you would show a hidden placed demon, use the Spawn input to show demons as they are needed. You can spawn a Single Demon Encounter multiple times if desired.

PatternsManagingAISpawnDemons.PNG



Unlike placed demon models, the map creator does not have to manually delete or hide any remaining demons as the player moves through the map. The game will automatically hide demons when the player can no longer see them.

Custom Group Encounters

If you do not need to pick the exact spawn locations of every demon, using a Custom Group Encounter can greatly simplify the placement of demons. Populate the Custom Group Encounter list with the demons that you'd like to spawn. Set the Spawn Location property to Encounter and Spawn Proximity to Close Proximity to spawn the group near the Custom Group Encounter object.

PatternsManagingAIGroupSpawnLocation.PNG



Just like you would show a hidden placed demon or spawn a Single Demon Encounter, use the Spawn input to spawn the Group Encounter as it is needed. You can spawn a Custom Group Encounter multiple times if desired.

PatternsManagingAISpawnGroup.PNG



Since the group is spawned by the game, the game will manage the demons. Demons will be automatically hidden from the player, freeing up the 12 available slots for other active demons.

Tags: Basics