Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to summon pools for the spawn units. Consider defining custom groups that you save off as well. #48

Closed
cabarius opened this issue Apr 12, 2021 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@cabarius
Copy link
Owner

Important note to anyone spawning units into an area for modifying encounters and such... your units need to be registered into a "summonpool" (whatever you want, usually) if you want the game to handle loading/unloading/etc... the units, along with making sure you are spawning units into the game instance's main state. If you don't do this, you will need to manually handle loading/unloading units based on area the player is in. If you don't do this, you will end up with huge overhead loaded on every area load, which is especially easy to feel when you load a large map like Drezen/midnight fane.

Similar to the inventory lag when you have lots of items (think we currently have an extremely inefficient array handling process being used, though I haven't evaluated it in depth yet), adding/removing units when the currently "awake"/"active" units list is large becomes extreme (~4+ minutes to load the map)
I have no idea why they decided to use "summonPool" for literally all of the area unit handling.. but I guess they just extended it and didn't bother refactoring, which makes sense
It's a bit interesting to look in the summon pools blueprint folder and see hundreds of pools, for basically every encounter in the game though
Easy way to see exactly what encounters exist though, I guess... :slight_smile:
Example of the handling i'm talking about:

public void HandleUnitDeath(UnitEntityData entityData)
{
    foreach (SummonPool item in m_Pools.Values.ToTempList())
    {
        if (!item.Blueprint.DoNotRemoveDeadUnits)
        {
            item.Unregister(entityData);
        }
    }
}```
swizzlewizzleToday at 4:51 AM
Manual destruction can be done via value.MarkForDestroy(); or similar.. you will also want to set the unit entity data's IsInGame to false
@cabarius cabarius added the enhancement New feature or request label Apr 12, 2021
@cabarius cabarius modified the milestones: 1.1.10 or 1.2.0, 1.2.0 Apr 12, 2021
@xADDBx
Copy link
Collaborator

xADDBx commented Apr 21, 2023

This issue will be closed because it is older then a year. The here mentioned Bug/Feature might already fixed or implemented. If the bug still persists/the Feature is still requested please reopen the issue or create a new one.

@xADDBx xADDBx closed this as completed Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants