A tutorial on saving world state with actors, instanced actors, Mass entities, Level Sequences, spawnable NPCs, GAS, State Tree, Chaos Destruction, and other things you make.
https://dev.epicgames.com/community/learning/tutorials/1mj4/unreal-engine-saving-world-state-with-actors-instanced-actors-and-mass
Hello, Thank You for making great work to handle Save System. Plugin inside the sample project - PersistenceUtils can be used in commercial products ? Thank You in Advance
@ZhiKangShao - thanks for the example code! I’ve been looking into the saving and restoring the state of GeometryCollectionComponents, so it was good to be able to compare.
I’m seeing some odd results when it determines which particles are broken, and wondered if you could provide any insight:
const TManagedArray<int32>& RestParents = GetParentArrayRest();
const int32 NumRestParents = RestParents.Num();
for (int32 i = 0; i < NumRestParents; ++i)
{
if (GetParent(i) != RestParents[i])
{
PersistedState.BrokenIndices.Add(i);
}
}
When I knock a small chunk out of the collection, leaving the majority of the collection in one piece, I would expect the collection of BrokenIndices to be relatively small. In practice, I’m seeing GetParent(i) return -1 for ALL particles as soon as the collection is disturbed.
In this scenario, if I iterate over the collection of particles from the physics proxy:
const TArray<Chaos::FPBDRigidClusteredParticleHandle*>& UnorderedParticleHandles = GetPhysicsProxy()->GetUnorderedParticles_Internal();
then most of the particles still have a valid parent - Parent() is not null - so I would consider them not broken, and this is the approach to broken/not broken that I took.
Am I misunderstanding what “broken” means in this case? Or maybe I’m missing something from my GeometryCollection setup? It appears to consider the whole collection as completely decomposed into the atomic particles, rather than restoring any intact parts of the structure.