So, going through the World Partition stream brought up more questions than it solved.
With Cells constantly being loaded/unloaded, how do we now save the state of the game, especially with multiple layers etc?
It would be quite annoying to have to track all actors and their state whenever a cell is loaded/unloaded, especially given that an actor might move from one cell to another.
Thank you Yaeko
I would also like to know the answer to this question. Is there some special setup we need to do to Save and Load stuff in the World Partition and Data Layers?
For example, what if I move an actor from one data layer to another during gameplay, and I want to save which data layer he is currently in, as well as its position in the world?
I have code in my save plugin now to save/load the state of data layers themselves.
But cannot access proxy actors that later load/unload the actual actors, outside the Editor I think all the API they built is private.
This still is a big issue to me, since there is zero documentation regarding this.
Without some event that fires when a cell will become unloaded, I have no way of figuring out the stuff that needs to be collected for a future save-file.
EDIT: I mean, yes… i can just figure something out in terms of workaround, but tis dumb that no one thought about loading/saving with World Partition.
EDIT: DataLayer documentation is wrong too, the nodes dont exist in the engine. ( Get Actors from Data Layer)
Guess I wont be using world partition then, or Data Layers, in its current state its unusable, due to the lack of tools to “deal with it”.
PS: Thanks bruno, but I dont use plugins at all - nothing against them, but I like to know whats going on because I built it myself
Did anything change in that regard?
Are there events now to bind to on cell load / unload?
No idea, didnt check again, just went with the old level-system instead.
While it’s not optimal for large amounts of items, the simple solution I found for items I want to save is to uncheck “Spatially Loaded” under World Partition category in the details panel. This seems to make the items persistent so that they can be referenced when re-loading the level. Hope this helps!
technically, there would be a way to control Data Layers like levels, but many of the relevant nodes are only in the documentation, they dont exist in the engine.
only some of them can be found, and only after turning off context sensitivity - its a complete mess.
I have zero clue on how any of this is supposed to work, when the nodes cant be accessed.
EDIT: I mean, I am aware that some things dont work in a Function for example, but where are these nodes supposed to be used - especially the missing ones, like “get actors from data layer”… which is what could be easily used to save stuff.
I also checked YouTube already, couldnt find a single video explaining this, they all just go over “how to add data layer to the list”.
I was digging into this recently, all the functions you would need to set this up are still not part of a publicly exposed API. I’m hoping someone adds this soon as it wouldn’t be much work, i’d rather not have to resort to creating a source build just to add some API macros and mark things public.
Also having a way to correctly move items either between different cell sublevels or into the persistent level would be useful
that explains my findings (or the lack thereof), I guess.
Meh, maybe 5.1 will have them public.
Let me know if you find any useful resources on this as it’s becoming a bottleneck in my project for various different features. I’ve been looking for good solutions for a while now.
On EndPlay there is a parameter with an enum passed through as to the reason why the actor has been ended, EEndPlayReason::RemovedFromWorld is one of those reasons. I haven’t gone down the train of thought to apply this to solving this problem so maybe there is a solution here.
Though I would still prefer to just be able to get a OnCellUnloaded/Loaded callback from the world partition subsystem or something similar and be able to get a list of all actors within that cell.
It´s Editor only, not runtime.
For “GetActorsFromDataLayer” you are using the “DataLayerEditorSubsystem”…
While for the BP-Nodes which are available, you are just using the “DataLayerSubsystem” (without Editor) ^^
Check those links for the difference:
I don´t know why they are editor-only, because it would be a high performance-boost, if you could add actors to data layers at runtime…
5.2 has just been released and as far as I can tell you still cannot access actors in a data layer or find actors by data layer in Blueprint.
I just went looking to see how you can access these nodes and I can’t find a blueprint I can use these nodes in.
So, data-layers are still kinda “useless” aside from streaming in/out backrund elements for a game?
meh, hopefully the (existing) nodes will become accessible soon.
Or are we missing something?
Is it just the documentation that has flaws?
I would just levarage gameplay tags. Path of least resistence.
You can likely have the datalayer name automatically populate as a gamplay tag.
Then you can select all the actors with that gameplay tag…
You may need to work at it a bit to make it feasible, but it should be easier than waiting forever for a fix you won’t get…
but the problem isnt located at “knowing which actor”, its the “when”. (It is more a world-partition problem than the datalayers themselves.)
But yes, your input should work.
That said, all of this could be automated by the engine, if it would tell us when it loads/unloads a cell.
Without digging into the source yourself that isn’t likely to happen soon.
You can probably make a custom plugin to expose this functionality after examining how the stuff is loaded/unloaded - assuming it is at all accessible/kept track of.
If it isn’t, the issue is far more complex as youd need to add a system to keep track of it.
The gameplay tags ideally cut to the second situation ignoring the digging and just flat out assume that nothing is kept track of.
I’d probably add an oncreate event to flag the gameplay tag in some creative way whenever the actor is loaded.
Sruff loads over async (i hope ffs?) however, so its not like a “race condition” is going to be able to tell you what data layer loaded what.
Youd have to query the data layer name from the actor loading on creation, or something around those lines…
Naming data layers the same as landscape tiles and or whatever the actor “stands” on which loads along with the data layer could be a quick way to figure out where the actor was first instantiated for instance.
It would basically require just 1 additional invisible mesh that you can do a single line trace down to every so often until it actually exists - get a name back, and disable the trace system.
Clunky af. But its a start towards something…
You guys should check out the Valley of the ancient, I’ve been looking for answers about making a call back when unloading and activating data layers and stumbled upon how they made the loading screen on the transitioning to the dark world.
I’m still wrapping my head around it, So I can’t say for sure this is the answer but It’s a good start.
Now that I’ve been working on data layers, I’ve also created an Actor that tracks other actors of interest within that data layer. I used that to handle every query that I needed. It’s a matter of passing and receiving data from that actor.
I’ve only started using data layers, I’m still trying to learn it. So this might not be the answer but I hope this helps.