Digging through the code in `UWorldPartitionLevelStreamingPolicy::DrawRuntimeCellsDetails` it is clear how to get the number of world partition cells in a given state but is there any way to know how many cells have been requested to load based on the current streaming sources? I am looking to add some editor / diagnostic tools and thought this might be useful to expose if it were possible.
Any advice would be appreciated!
Hello,
I apologize for the delay. There’s a CVar, wp.Runtime.ToggleDrawRuntimeHash2D, which can be used to visualize the state of the streaming cells around the streaming sources.
Thanks,
Ryan
I’ve gotten my hands dirty pretty deep into world partition and I don’t think it is even possible to query for the loaded cell count ahead of time without adding some functions of your own.
For instance, I added a UWorldPartitionSubsystem::IsStreamingCompleted overload, that takes a function parameter for another purpose, but you could do similar to call back into your code with each cell where you can just count them.
bool UWorldPartitionSubsystem::IsStreamingCompleted(EWorldPartitionRuntimeCellState QueryState, const TArray<FWorldPartitionStreamingQuerySource>& QuerySources, bool bExactState, TFunctionRef<void(const UWorldPartitionRuntimeCell* Cell)> CellCallback) const
Any notion of “how many cells need to be loaded” type query will need to provide a query source anyways, so I think this would be the appropriate path to adding such a query.
Edit:
Out of the box, you can use the for each functions of the world partition. Almost forgot about those.
I’ve done some visualization of the cells for our NetImGui debugger to get more insight into the system than what is normally surfaced. There’s a lot it’s doing under the hood.
[Image Removed]This is gathered and consolidated like so
`WorldPartitionSubsystem->ForEachWorldPartition([&](UWorldPartition* WorldPartition)
{
if (IsValid(WorldPartition->RuntimeHash))
{
WorldPartition->RuntimeHash->ForEachStreamingCells([&](const UWorldPartitionRuntimeCell* Cell)
{
// count your cells or whatever
return true;
});
return true;
}
return true;
});`
We’ve been looking to improve debugging and diagnostic tools for a while now. It’s honestly been on our roadmap since the 5.0 release; however, we’ve had to prioritize many other things. We definitely hope to address this sooner rather than later, though. I’ll bring this up to the team.
p.s. Epic employees will be out of the office for the next couple of weeks (6/30 - 7/11) and won’t be able to respond during that period.
-Ryan
So that is not exactly what I am looking for, I currently use that debug view quite often and its incredibly helpful, but is there anywhere in code where it is easy to get (or calculate) how many cells have been marked to stream in? The debug view shows how many are active once they are done loading, but it doesn’t show how many will stream in when starting from an empty map.
I dug just far enough into the system to notice that my request isn’t a trivial one, but I am hoping it is possible to calculate.
Thanks Jeremy! Yea this looks really promising, I can definitely dig in to this a bit further and this is really helpful.