[PLUGIN] Savior

@dzarafata Okay I’m having my lunch break and will take a look into the sample project soon.

@dzarafata This is what I did to make it work as you expect… yYo2jxy.png (3065×710) (imgur.com)

But 3.1.0 does not have “Make SGUID” nodes so I suppose you will have to wait for me to backport v3.3.0 to Unreal 4.25.
Backporting to older engine versions is always complicated so I haven’t done this yet:

[USER=“434”]BrUnO XaVIeR[/USER] Thank You! I applied Your solution and it works.
I like it that I don’t have to couple objects both ways (Though I’ll probably use some hash table to store all actors with SGUIDs so I can fetch them in O(1)).
I’ll probably just move the project I’m working on to 4.26, as we planned to do it anyway.

I have a new problem now. I added a simple actor component with string variable to an actor I’m respawning and I cannot make it so variables stored inside the actor component will be restored after loading the game.

Variable is marked SaveGame. The component has SGUID generated with MakeSGUID (ResolvedName).
OnSaved is called in the component but OnLoaded or OnFinishRespawn is not.

I attach a new version of the example project with this new problem.
It’s using Savior 3.3.0 with ue 4.26 now
SaviorProblemExampleWithComponent.zip

PS: The previous problem was working fine with 4.25 and Savior 3.1.0 and without use of MakeSGUID. Just Find Actor by SGUID alone did the trick

I won’t be able to test this today, but I think I know why that happens and C++ changes will be required.
I will see later.

[USER=“434”]BrUnO XaVIeR[/USER] OK, not a problem. Just tag me once You got time to check it out, please.

PS: C++ is actually preferred over BP by me so that’s not a problem.

@dzarafata I took a quick look here at home, but couldn’t test properly yet.

I have included some 6 lines in C++ code that fixes this problem;
As a a side consequence of the fix, the manual unpacking call will also no longer be required to be used from ‘On Finish Respawn’ event (the plugin pretty much codes itself at this point).

So I have yet to test it more, but I will leave here this note to make sure no one end up unpacking data from respawned actors twice because of this:



Deserialized :: BP_TestSavableActorBPOnly_00000247000001FC00000269000001A9_BP_TestComponentWithText_0000026300000235000002860000022A
UNPACKED DATA for BP_TestSavableActorBPOnly_00000247000001FC00000269000001A9_BP_TestComponentWithText_0000026300000235000002860000022A :: {"Text":"WantedText"}


If you keep using the manual unpacking node, the property reflector is going to walk all properties and restore values twice.
So this will no longe be needed:

For these types of components, the setup should be something like this:

They are some weird archetype objects generated at runtime, so ‘Resolved Name’ would consider a component a different object every time you hit play, and that is not what you want in a case like this.
When tested properly, I will send updated source to Epic for review.

[USER=“434”]BrUnO XaVIeR[/USER] Super Cool!
Really appreciate it!
I guess I will move my project to 4.26 in meantime.

BTW, I have UObject that has another UObjects inside and only first “layer” seems to load.
Is nested UObjects loading supported?
if not, is it something planned for the future?

Edit: Nvm, It’s working ok, just had problems with some more complicated objects.

I have those enigmatic warnings. Would it be possible to make those message more verbose?
I have Deep Logs enabled and that’s all is displayed. No context or anything.


LogAutomationController: Warning: {S}:: AttributeValue_0 [D:\Build\++UE4\Sync\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp(1037)]
LogAutomationController: Warning: {S}:: AttributeValue_1 [D:\Build\++UE4\Sync\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp(1037)]
LogAutomationController: Warning: {S}:: AttributeValue_2 [D:\Build\++UE4\Sync\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp(1037)]
LogAutomationController: Warning: {S}:: AttributeValue_0 [D:\dev\projects\RTSGrzesia\Plugins\Savior\Source\Savior3\Private\Reflector.cpp(54)]
LogAutomationController: Warning: {S}:: AttributeValue_1 [D:\dev\projects\RTSGrzesia\Plugins\Savior\Source\Savior3\Private\Reflector.cpp(54)]
LogAutomationController: Warning: {S}:: AttributeValue_2 [D:\dev\projects\RTSGrzesia\Plugins\Savior\Source\Savior3\Private\Reflector.cpp(54)]

[USER=“434”]BrUnO XaVIeR[/USER] That warning is coming from Savior plugin (3.1.0):
it just logs object name as a warning.
Is it really a warning though, or just wrong Severity was used in this call?

Here is full call stack:

Could be a log I left there for break points and forgot to delete it :slight_smile:

Yes, it’s a breakpoint log (does nothing) I left on line 425 and forgot to delete it.
In SaveObjectHierarchy() function.

[USER=“434”]BrUnO XaVIeR[/USER] ok, thanks for Clarification!
Have a nice weekend.

I’ve added a character portrait (UTexture2D) to playerstate. I see the word “CharacterPortrait” in the save file but nothing appears in the playerstate after LoadActor. Should this work?

The plugin loads dynamic material parameters of root meshes, but not raw texture objects from references.

You can save them as a soft object reference and load the referenced object manually.

Can you possibly make the documentation in a google document? it’s really hard and distracting to follow as forum post.

Thanks Bruno. I’ve re-implemented using soft object reference …

UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, SaveGame)
TSoftObjectPtr<UTexture2D> CharacterPortrait;

The image appears as expected and I check that it’s not NULL right before SaveActor() but “CharacterPortrait” doesn’t appear in the save game file and is reported as NULL after LoadActor().
Is there anything I need to change in the slot, eg. Actor Scope?

Instead of saving it as an UObject pointer, save it as a struct value.
This one works without scope editing, it is saved as struct type:



UPROPERTY(Category="UI", meta=(AllowedClasses="Texture2D"), EditAnywhere, BlueprintReadWrite, SaveGame)
FSoftObjectPath Portrait;


Terrific!
Thanks Bruno

hi Bruno

i am having some difficulties implementing the savior plugin in my project. i think i don’t understand fully even after going throw all this forum messages, so i hope you can help me and clarify things for me.

i am using 4.25

  1. i am trying to do something simple : i have 2 levels. when i am in the first level i have an actor that stores some variables which can be changed . before i open level 2 i am saving this actor with the changes i made to him. i open level2 - this actor does not exist in level 2. when i go back from level 2 to level 1 i want to load my actor back but everything i do is just not working. what am i missing?i don’t want to save and load all the game or level only this actor.

  2. is it possible to save 2 different actor in the same slot?

thanks in advance

leo

[USER=“641905”]leo bar[/USER] you should download demo project and examine carefully the three demo levels and its blueprints.

You must have a fair general understanding of Unreal Engine and the main rules surrounding Actors / Components / Objects.

The easiest way to use the save system is storing your savable properties on Blueprints member of Game Mode group and use the “Save/Load Game Mode” nodes.

hi

  1. i have downloaded the demo project and examine it carefully!!!

  2. i have fair general understanding of Unreal Engine and the main rules surrounding Actors / Components / Objects

  3. i don’t want to use the Save/Load Game Mode (i wrote it in my question its not an option).

i only want to save and load one actor. noting i did made it work.

You just need a slot class,

then “New Slot Instance” -> “Save Actors of Class” -> “Write Slot to File”.

To load, “New Slot Instance” -> “Read Slot from File” -> “Load Actors of Class”.

The class must implement ‘SGUID’ property correctly.