WorldPartition

World Partition

官方文档:

https://docs.unrealengine.com/5.0/zh-CN/world-partition-in-unreal-engine/

主要是服务于大世界,提供了自动数据管理和基于距离进行加载的关卡流送系统。每个关卡分为是不是 World Partition(下称为WP)的版本,我们可以通过:

1
2
3
4
UWorld* World = GEditor->GetEditorWorldContext().World();
if (World->IsPartitionedWorld())
{
}

来判断。

非WP关卡转换为WP关卡

LandscapeSpline

LandscapeSpline与World Partition相关。

核心函数: LandscapeEdModeSplineTools.cpp: BeginTool、AddControlPoint、AddSegment

WorldPartition中,特殊的 ALandscapeSplineActor 的Owner是空的,他是通过 LandscapeGuid 和 LandscapeActor 附着到一个 ALandscape 上的。Outer是这个UWorld.

非 WP 版本,是全部塞到一个 ALandscapeProxy 里面,一个 landscap e有一个 ALandscapeProxy,ALandscapeProxy 里面挂有 ULandscapeSplinesComponent,ULandscapeSplinesComponent, 里面有Segment数组和Control Point数组;

WP版本则是每个landscape可以挂上多个 ALandscapeSplineActor,每个 ALandscapeSplineActor 里面挂有 ULandscapeSplinesComponent。

WP-HLOD

还不太清楚 WP 版本的 HLOD 和正常的有什么区别,文档: https://docs.unrealengine.com/5.0/zh-CN/world-partition---hierarchical-level-of-detail-in-unreal-engine/

OFPA (One File Per Actor)

https://zhuanlan.zhihu.com/p/502063482

World Partition下默认开启,非 WP 关卡可以在这里打开:

蛋疼的事:无法对一个 OFPA 的 Actor 在编辑器下(连接了版本管理)直接更新。

Grid Cell

Runtime Grid 运行时网格,相当于对整个世界划分为一个个格子,每个格子就是 cell,通过 cell size 来控制。

可以对每个关卡中的物体的detail面板中编辑 World Partition 属性,写上对应属于的Grid的名字。

参考:

https://www.bilibili.com/video/BV1ik4y1A77p/?spm_id_from=333.337.top_right_bar_window_history.content.click&vd_source=bd08f0c74da1940eb8682f61aa471b24

https://zhuanlan.zhihu.com/p/537589944

https://zhuanlan.zhihu.com/p/502053365

https://zhuanlan.zhihu.com/p/675514420

https://zhuanlan.zhihu.com/p/610772419

https://zhuanlan.zhihu.com/p/541239006

Level Instance

每个 Level Instance 也有对应的 WorldSettings(对应 WorldSettings 面板,我们可以打开一个 Level Instance 序列化下来的 Level 来编辑),里头又有对应的 World Partition。

参考:

https://docs.unrealengine.com/5.3/zh-CN/level-instancing-in-unreal-engine/

https://zhuanlan.zhihu.com/p/502068030

Debug

Demp大世界场景信息

1
wp.Editor.DumpStreamingGenerationLog

5.3版本可以使用这个命令,输出一次WP的信息(也可以运行一次游戏或者cook的时候),输出结果会在 Saved\Logs\WorldPartition 里。

Grid调试

https://docs.unrealengine.com/5.3/zh-CN/world-partition-in-unreal-engine/