Jump to content
Sign in to follow this  
Blackheart_Six

Dynamic Despawn/Respawn

Recommended Posts

I have a pretty good system to spawn random patrols using the scenario framework. I get a random number/type of units to spawn when you enter the 1000m Area. And they will select a random set of waypoints to patrol. 

 

The issue is each area you enter it spawns the AI. After a while the world is full of AI, with no way to remove them unless you kill everyone of them. 

 

What I need is a trigger/method to de-spawn the AI when you leave the area. 

 

I am using all the scenario framework components. Can't figure out what would be the equivalent of activate/deactivate trigger. 

Share this post


Link to post
Share on other sites

Tell me more about using the scenario framework to spawn random patrols...

Share this post


Link to post
Share on other sites

THANK YOU BI! You listened.
 

In the current experimental version they have implemented a "Dynamic Despawn" for each level, Area, Layer, and slot.

 

Works really well so far. Very fast on the despawn action. Still testing and learning setups. I'll post more as I work with it.

 

Also the wiki for scenario framework has been updated and expanded. Lots of good information in there.

 

Share this post


Link to post
Share on other sites

With the advent of Dynamic Despawn in the SF, I'll cover options of that function here. It definitely saves resources during play and allows the mission make to load the world with AI. The AI will now despawn and not being counted against your AI budget according to GM.

From the wiki...

Quote

Dynamic Spawn/Despawn

This system works on Areas that are then handling their hierarchy and its purpose is to save performance by having spawned only things that need to be spawned.

There is a continuous check that is being triggered every 4 seconds in default (can be adjusted on GameMode component called SCR_GameModeCombatOpsManager) for all the Areas that have Dynamic Spawn/Despawn enabled. Furthermore, when Dynamic Spawn is initiated, it is spawning its children with slight delays between them in order to avoid huge stutters when a lot of different things are spawned at once, so upon successful Dynamic Spawn initiation, it can take few seconds for the Area to completely spawn (depending on the complexity of each Area setup).

Each Area has a range that is then compared to the distance from player characters. If just one player is within a range, Area will spawn all of its content that has Activation Type SAME_AS_PARENT set in workbench or this activation was changed in runtime via ScenarioFrameworkAction.

Runtime change is the case for QRF units in CombatOps on Arland Scenario where they are initially not spawned with the Area but via trigger. Once the trigger spawns these units, it also changes the Activation Type to SAME_AS_PARENT so when said Area would despawn and then spawn again, it will spawn these units as well.

On layers that are under the Area, there is an option to "Exclude from Dynamic Despawn" which if set to true will prevent said layer to despawn once it is spawned. This is used for example for Spawn Points, where we want to spawn them, but then we are not dynamically despawning them using this system.

Furthermore, all of the Slots that are spawning vehicles are set in a way that once someone gets inside of them, it will "Exclude" them from the Dynamic Despawn as well to prevent vehicle deletion upon moving away from Area range.

Slots and AI Slots retain their position where their spawned entity was located before Spawn/Despawn, so for example AI units that moved to different position will get their position saved and once respawned, they will be spawned on their previously saved position. If AI units are killed, their bodies will remain there for the GarbageCollector to handle and for the vehicles, it will remove their wreck and destroyed wreck will not be spawned again.

 

Additionally...
 

Quote

Prepare Area From Dynamic Despawn

It adds target Area into the Dynamic Spawn/Despawn during runtime.

Getter - Supposed to be a GetArea (see Getters)

Stay Spawned - If set to false, area will be despawned upon activation of this action

Dynamic Despawn Range - How close at least player character must be in order to trigger dynamic spawn/despawn
 

Remove Area From Dynamic Despawn

It removes target Area from the Dynamic Spawn/Despawn during runtime.

Getter - Supposed to be a GetArea (see Getters)

Stay Spawned - If set to false, area will be despawned upon activation of this action

 

Share this post


Link to post
Share on other sites

Couple of tips...

Turn off Dynamic Despawn in the Game Mode when you first start placing layers. Dynamic Despawn may interfere with your setup and testing leaving you to think there is a problem.

Turn it on once you have your items place, and fully tested.

Considerations when using is the Area.et sphere and it's size. The default radius is 750m. It is adjustable.

But make it too small and the AI will spawn in FOV. So it is best to have a large radius but you have to watch overlapping areas, and flight. Flying into multiple overlapping areas causing a large amount of AI to spawn suddenly will cause the game to stutter as all the AI spawn in.
 

Share this post


Link to post
Share on other sites
On 11/29/2023 at 4:14 AM, Blackheart_Six said:

 

Turn off Dynamic Despawn in the Game Mode when you first start placing layers. Dynamic Despawn may interfere with your setup and testing leaving you to think there is a problem.

Turn it on once you have your items place, and fully tested.
 

Thank you so much for this comment.  I could not figure out why my patrol would not spawn in once I walked into the area.  Dynamic despawn was turned off by default in the game mode.

Share this post


Link to post
Share on other sites

Currently, v1.1.0.42, all you need to turn the spawn-despawn ON is here:

NTPpIxM.png

Source: https://community.bistudio.com/wiki/Arma_Reforger:Scenario_Framework#Dynamic_Spawn/Despawn_2

 

Critical:

  • If you're running a Coop/PvE/CombatOps mission, in your World Editor, through the Hierarchy column area, click on the GameModeSF and then right-click over its property called SCR_GameModeSF. Click on Change Class and select SCR_GameModeCombatOpsManager and turn on the Dynamic Despawn;
  • If you're running another kind of mission, probably you should leave the original component and only turn on the Dynamic Despawn checkbox;

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×