UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能--初探超大无缝地图的实现LevelStream

前言


     好吧,这次总结的还是UE4,在这里要向CE3的朋友们道一声歉,因为本人水品有限,对于CE3的探索学习陷入了一个非常大的瓶颈,暂时抽不出一块儿大的单独的时间去解决,另外,自己也有一点小小的私念,就是期盼Cryteck官方能够推出新的版本,至少能完善一下现在的文档,所以只能暂时把CE3搁置下来,但是我并不会放弃CE3,CE3对我来说,绝对是个非常大的挑战,我不会轻易放弃他的。

   好了回归正题,先来简单说一下写这篇文章的背景吧,这两天我试着看了一下UE4官方提供的实例“2014功能介绍”,在里面发现一个疑惑,在GDC_Demo这个场景的关卡蓝图部分,发现了一个没听说的玩意儿----“子蓝图”,这个实例中,有三个地图,感觉像是嵌套在了一起组成了一个大地图,于是带着这样的疑惑,就去群里问了一下,得到了“LevelStream”的信息,再然后,就去官方文档搜索,发现有专门这么一部分,于是,这篇文章便应运而生了!好吧,先从对官方文档的翻译总结说起!

               UE4高级功能-初探超大无缝map的实现LevelStream



LevelStream 实现超大无缝地图--官方文档学习


The Level Streaming feature makes it possible to load and unload map files into memory as well as toggle their visibility all during play. This makes it possible to have worlds broken up into smaller chunks so that only the relevant parts of the world are taking up resources and being rendered at any point. If done properly, this allows for the creation of very large, seamless levels that can make the player feel as if they are playing within a world that dwarfs them in size.  

关卡流(LevelStreaming)使得我们在游戏运行的整个过程中动态的加载、卸载地图,这样以来,使得通过“把大地图分成许多小的部分,只有与当前状态有关的地图部分资源加载”的思路来创建无缝超大地图成为了可能。


 

World Composition User Guide  世界组合使用指南


On this page:这页将会涉及
  • Overview概述
  • Activating World Composition 激活世界组合功能
  • Levels Hierarchy 关卡层级关系
  • Levels Composition关卡组合
    • Layers层
    • Minimap小地图
    • UI KeyUI交互与提示
  • Level Details层详细信息
    • Tile Settings瓦片设置
    • LOD SettingsLOD设置
  • World Origin Shifting 世界原点
  • Big Worlds and Multiplayer 超大世界和多玩家
  • Creating Landscape Levels 创建地形关卡
    • Tiled Landscape Import 导入瓦片地形


Overview 概述:  

World Composition has been designed to simplify managing large worlds. One of the goals is to avoid using a persistent level to store streaming information as it becomes a bottleneck when a team of level designers want to work on levels simultaneously. The persistent level does not store any streaming information and instead scans a folder and treats all found levels as streaming levels. Each streaming level has information stored in the package header, which World Composition can read without loading the level into memory. Initially, all levels except the persistent level are unloaded in World Composition. You can load or unload any part of the world manually at any time.

World Composition relies on a world origin shifting feature which, when used with distance based level streaming, allows you to create worlds which are not limited to the WORLD_MAX constant value hard-coded into the engine.

世界组合(World Composition)这个功能的设计是为了简化对大地图管理。目标之一是,不至于因为只能使用一个持续的关卡来存储流数据,而使得“当关卡设计团队想要水平工作同时设计关卡“这样的想法成为瓶颈、不可能的想法。持续的关卡不存储任何信息流,相反,只会一次性扫描整个文件夹并且找到所有的关卡作为关卡流。每个关卡流的信息存储在包的头部,这些信息可以被世界组合(World Composition)功能来直接读取而不用提前把这些蓝图存放到内存中。最开始的时候,除了持续关卡其他所有的关卡都会存储在世界组合(World Composition)中,你可以在任何时刻加载或者卸载世界任何的一部分。 世界的组成(World Composition)依赖于世界原始的转移特性,当通过使用基于距离的关卡流,允许你可以创建出不局限于引擎中设定好的世界最大值 WORLD_MAX constant这个常量。

Activating World Composition 激活“世界组合”功能

World Composition managed worlds can be activated by switching on Enable World Composition flag in World Settings.

You can also disable world origin shifting by switching off Enable World Origin Rebasing flag in World Settings.

被”世界组合“(World Composition)管理的世界可以通过勾选在世界设置中的Enable World Composition布尔值。

当然你也可以通过不勾选世界设置中的Enable World Origin Rebasing 布尔值来不使用世界原始转移特性。 

UE4高级功能-初探超大无缝map的实现LevelStreamUE4高级功能-初探超大无缝map的实现LevelStream
小技巧: (1)勾选Enable World Composition时,系统会自动扫描大地图所在文件夹,如果当大地图所在文件夹存在有其他地图的时候,系统会提示 UE4高级功能-初探超大无缝map的实现LevelStream
如果没有其他地图的话,就不会提醒。 (2)选择继续后 UE4高级功能-初探超大无缝map的实现LevelStream

Levels Hierarchy 关卡的层次

After you have activated World Composition, all the levels in your project will be visible in the Levels window. To open this window, click on theWindows menu, and then select Levels.

The entries in the Levels window represent your world hierarchy.

当你激活了世界组合的命令后,你可以在关卡面板(英文:Level)中看到你项目中的所有关卡。关卡面板可以这样打开

UE4高级功能-初探超大无缝map的实现LevelStream

在关卡窗口的条目代表你的世界的层次结构。

UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能-初探超大无缝map的实现LevelStream

The level with its name in blue text is the current level. Currently loaded levels will have their names in white text, while levels that are unloaded have grayed-out names.

To load a level in the world composition, just double-click its name. Using drag-and-drop, you can establish relationships between individual levels. Child levels store position relative to the parent level, so when you change the parent level's position all child levels will recalculate their position accordingly.

In the Levels window, you can lock and save levels, as well as open the Level Blueprint for each level, with buttons to the right of the level name.

窗口中名字为蓝色的关卡是当前的关卡,当前加载的关卡(如图中:SmallMap1)的名字为白色,卸载了的关卡(图中:SmallMap2)的名字为灰色。

只需要通过在窗口中双击关卡的名字你就可以把它加载到世界组合( world composition)中,加载完成后你可以观察一下关卡名字的颜色变化哦!可以通过拖拽的形式来建立关卡之间的父子关系。这里注意,子关卡存储的是相对位置!即相对于父关卡的位置,所以一旦你改变了父关卡的位置时,对应的所有子关卡的位置也会因此发生改变。

在关卡窗口中,你可以锁定或者保存关卡,也可以直接打开每一个关卡的关卡蓝图。

UE4高级功能-初探超大无缝map的实现LevelStream

这里注意一下吧,一旦加载了一个地图后,可以观察到永久性关卡有许多属性发生了变化:

UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能-初探超大无缝map的实现LevelStream

 

但是显然,他们之间是有距离的,并没有重合

Levels Composition  关卡组合:

When Enable World Composition is on, there is a button to open World Composition at the top of the Levels window.

当勾选了Enable World Composition时,可以通过下面这个按钮来打开世界组合窗口

UE4高级功能-初探超大无缝map的实现LevelStream

 

Here, you can see the layout of your world.

在这里,你可以看到你的世界的布局

UE4高级功能-初探超大无缝map的实现LevelStream

 

Layers 层

 

By default, all levels are assigned to an Uncategorized layer. Layers hold information about streaming distances, so levels assigned to a particular layer will inherit that streaming distance. Levels assigned to a layer with streaming distance disabled will be excluded from distance streaming, and can instead be controlled using Blueprints.

You can create new layers by clicking the + button to the right of the existing layer names. Each level can only be assigned to one layer at a time.

Layers can not be deleted or edited, so if you would like to change streaming distance settings, create a new layer with your desired settings and assign levels to it. Layers which have no assigned levels will be deleted automatically the next time you open a level.

You can filter your levels by layer by clicking on the layer name above the minimap. You can toggle multiple layers by using Control+Mouse Click. When there are no layers toggled on, no filtering is performed.

      默认情况下,所有的关卡被分配到 未分类(Uncategorized )这一层。各个层都保存了关卡流的距离信息,所以被分配到一个特定的层的关卡会继承这个关卡流的距离信息。分配层的流媒体远程禁用将被排除在距离流水平,并可控制使用的蓝图。被分派到一个禁用了关卡流距离的层中将会排除掉关卡流距离的影响,并且可以被蓝图所控制。

 

    可以通过点击已经存在的层的名字右边的+按钮来创建新的层,记住,每一个关卡同一时刻只能被指定到一个层。

    特别注意!层不能被删除或编辑的,所以如果你想改变关卡流的距离设置,用你需要的设计来创建一个新的层,并且给它分配对应的关卡。没有指定关卡的层将会在你下一次你打开关卡的时候被自动删除。

    你可以通过层来过滤关卡,方法是在小地图上单击层的名字。您可以通过Ctrl+Mouse单击切换多个层。当没有层打开的时候,不会存在过滤。


 

Minimap 小地图

Each level except the persistent level has an image and position in the world, which are displayed in the minimap. The image of the level is updated every time content in the level is changed. This map allows you to preview your world from the top and arrange the position of levels by dragging them. When dragging levels, they will snap to the edges of other levels. Holding the Control key will cause the level movement to use the Level Editor's snapping settings. Note that level position is stored as integer coordinates, so for exact matching of adjacent level tiles, your levels must have integer bounds sizes.

除了永久的关卡,其他所有的关卡都会在小地图中有一个图片和一个在世界中的位置。当关卡里面的内容发生改变时关卡的这张图片也会更新。小地图允许你在顶视图预览你的世界,并且通过拖拽各个关卡来设定他们的位置。当拖动关卡的时候,他们将会捕捉在其他关卡的边缘。按住Control键会使得水平运动时使用关卡编辑器的捕捉设置功能。注意关卡位置存储为整数坐标,所以当需要精确的调整关卡瓦片(瓦片地图)位置的时候,你的关卡必须有整数范围大小。

UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能-初探超大无缝map的实现LevelStream

 

Levels based on Landscape Actors have snapping based on the base landscape component size. This is done to enable seamless editing between Landscape Actors in different levels. 

基于 Landscape Actors 地形物体的关卡的边缘是基于父类landscape 地形组件的尺寸的。这样做是为了在不同Landscape Actors地形物体不层次间无缝启用编辑。

All Landscape Actors will have tranformations disabled in the Editor Viewport to ensure that the landscape can not be moved by an arbitrary amount and lose its ability to be aligned with other landscape levels.

所有的Landscape Actors地形物体都可以在编辑器试图中禁用transform的属性,来确保l地形andscape 不能通过任意量来移动并且也不能被和其他关卡中的地形landscape 对齐。

 

The first time a level is loaded in World Composition, a new Level Bounds Actor is automatically created in the level. The Level Bounds Actor is used to calculate the size of the level.

By default, the Level Bounds Actor automatically resizes to include all Actors found in the level. However, some Actors, like skyboxes, can have very large bounding boxes, which will result in overly large level tiles in the world minimap. If you have Actors like this that you do not want to include in the level bounds calculations, you can disable automatic level bounds calculations and set a fixed size for the Level Bounds Actor.

一个关卡在第一次被加载到世界组合World Composition时,一个新的叫做关卡边界(Level Bounds Actor)的物体 将会被自动在这个关卡中创建。 关卡边界物体(Level Bounds Actor) 物体是用来计算关卡的大小的,可以在世界大纲试图中搜索找到他!

默认情况下,关卡边界物体会自动调整当前关卡中的所有物体的大小。然而,一些物体,比如天空盒,可以有一个非常大的边界盒子,这将导致在世界地图中存在过大的瓦片关卡。如果你有一些这样的不想要被关卡边界计算的物体,你可以禁止自动关卡边界计算并且给关卡边界物体设置一个固定大小的值。

UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能-初探超大无缝map的实现LevelStream

 

Currently, realtime must be enabled in the viewports for the Level Bounds Actor to function.

目前来说,realtime 必须在视图中启用 Level Bounds Actor这样才会起到作用。

 

The minimap has a yellow square indicating the safe edit area. The safe edit area's size is equal to the WORLD_MAX contant in the engine. Levels outside of this area will be hidden automatically, and their level images will reflect this. World Composition tries to keep levels you are working on close to the Editor world origin. This feature is called "focusing" and may shift the current world origin to a new position if you begin editing a level outside of the safe edit area. Shifted levels still preserve their Actors' original transformations when they are saved, so saving a level that is currently shifted will not change the Actors' absolute positions.

小地图上有一个黄色的正方形区域,表示这里是安全编辑区域。安全编辑区域的大小等于引擎中的world_max常数。本区外的关卡将被自动隐藏,他们的关卡图像反映了这个。世界组成World Composition试图保持你正在编辑的关卡接近引擎编辑器世界的原点。这一特性称为“聚焦”,如果你开始在安全编辑区域外编辑一个关卡可能会改变目前的世界原点到一个新的位置,转移关卡仍然保持他们的物体的原始transform属性,当他们被保存了时,因此保存一个正在转移的关卡并不会改变物体的绝对位置。

UI Key  UI的值

UE4高级功能-初探超大无缝map的实现LevelStream

 

Number
数字
Status Bar
状态栏
Description
描述
1 Layers 
Click on a layer name to toggle filtering by that layer, or click on the + to create a new layer.
点击层名字可以切换层,+号新建一个层
2 WORLD_MAX
常量WORLD_MAX
Bar indicating the scale of the WORLD_MAX constant.
显示WORLD_MAX 常亮的值
3 World Origin
世界原点
Current position of the world origin.
当前世界的原点坐标
4 Current Level
当前的层
Name of the current level.
当前层的名字
5 Mouse Cursor Position
鼠标指针的位置
Current world position of the mouse cursor.
当前鼠标指针所在的世界位置
6 Marquee Selection
选框
Size of the marquee selection box in the world units.
在世界单元的选框的大小
7 World Size
世界的大小
Size of the world, calculated as the sum of all level bounding boxes.
世界的大小,这个值时所有关卡中绑定的盒子大小的总数

 

 

Level Details

 

To see the details for any level in the Level window, select it and then click on the magnifying glass icon in the toolbar. This will summon theLevel Details window, where you can also swap between available levels' information with a dropdown menu.

如果想要查看关卡窗口里面任意关卡的详细信息,选择他,点击就行了。注意,这里还有一个小技巧,就是可以在关卡详细信息窗口中可以切换到其他关卡,点击上面那个下拉框即可。

UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能-初探超大无缝map的实现LevelStream

UE4高级功能-初探超大无缝map的实现LevelStream

 

Tile Settings  瓦片设置

Setting
设置
Description
描述
Package Name
包的名字
Package name of the selected level. This information is read-only.
当前选择的关卡的包的名字,这里的信息是只读的。
Parent Package Name
父包的名字
Package name of the parent level. If the level has specified a parent, its position becomes relative to the parent level.
父类包名,如果当前关卡有一个指定的父类,他的位置就会变成与父类的相对位置
Position
位置
Level offset from the zero world origin, stored as an integer 2D vector. All Actors in the level will be shifted by this value when the level is added to the world (becomes visible), and shifted back when the level is removed from the world (hidden).
关卡相对于世界原点0的偏移量,使用一个2维数组存储的。关卡中所有的物体将会通过这个值移动,当关卡被加载到世界中,当关卡被卸载时,会回到原来的位置。
Absolute Position
绝对位置
Absolute position of the level. This is the same as Position when the level has no parent. This information is read-only.
关卡的绝对位置。当关卡没有父物体的时候,他和Position时一样的,这个值也是只读的。
Z Order
Z方向上的顺序
Defines Z sorting order of the level tile in the minimap. This can be useful when there are several overlapping tiles and you want to sort them in a specific order.
这个值定义了在小地图上瓦片关卡的顺序,当小地图中有很多关卡瓦片重叠的时候,把他们整理到一个正确的顺序是非常有用的。

LOD Settings 细节设置(Levels of Detail)

Each level in the world composition can have up to 4 LOD streaming levels. LOD streaming levels are similar to mesh LOD. Depending on streaming distance settings streaming level will be replaced with corresponding LOD level. LOD levels automatically discovered by World Composition using pattern _LOD#. Where number should be from 1 to 4. LOD levels can be created manually or with automatic LOD map generator which requires Simplygon.

世界组合中的每一个关卡都可以拥有最多4个LOD关卡流,LOD关卡流和普通的LOD网格很相似。根据流距离的设置关卡流将会被相应的LOD关卡所取代。LOD关卡会通过世界组合中使用的LOD# 来被查询到。

这个数值的取值范围时1--4.LOD关卡可以被手动创建,或者使用LOD地图生成器来自动创建,注意,后者需要Simplygon技术。

Unreal Engine 4 ships with a Simplygon integration, but you will need a license from Simplygon to use it.

虚幻四引擎整合了Simplygon ,但是如果你想要使用它的话,需要取得一个证书认证才可以

Setting
设置
Description
描述
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow
上一篇:javascript – 基于继承的组合,是一种更好的方法,可以在不借助继承的情况下向视图添加其他功能


下一篇:java Beanutils.copyProperties( )用法