UE4高级功能--初探超大无缝地图的实现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 布尔值来不使用世界原始转移特性。 

勾选Enable World Composition时,系统会自动扫描大地图所在文件夹,如果当大地图所在文件夹存在有其他地图的时候,系统会提示

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)中看到你项目中的所有关卡。关卡面板可以windows菜单的

levels里打开
 

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

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)中,加载完成后你可以观察一下关卡名字的颜色变化哦!可以通过拖拽的形式来建立关卡之间的父子关系。这里注意,子关卡存储的是相对位置!即相对于父关卡的位置,所以一旦你改变了父关卡的位置时,对应的所有子关卡的位置也会因此发生改变。

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

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

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时,可以通过下面这个按钮来打开世界组合窗口

Here, you can see the layout of your world.

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

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键会使得水平运动时使用关卡编辑器的捕捉设置功能。注意关卡位置存储为整数坐标,所以当需要精确的调整关卡瓦片(瓦片地图)位置的时候,你的关卡必须有整数范围大小。

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) 物体是用来计算关卡的大小的,可以在世界大纲试图中搜索找到他!

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

urrently, 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的值

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.

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

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 ,但是如果你想要使用它的话,需要取得一个证书认证才可以

World Origin Shifting 世界原点的偏移
The World Composition editor supports shifting of the world origin by some arbitrary amount. Shifting the world origin results in adding an offset vector to all registered Actors in the world. Each Actor has an ApplyWorldOffset function which can be overridden in the child classes to do additional things. In case you have created a new AActor derived class and store absolute position values in it, you have to override ApplyWorldOffset function to make it work correctly with world origin changes and shift your absolute values in it. Rendering and physics primitives will be shifted in parallel to Actors in game thread.

世界组成编辑器支持移动世界原点到任意位置。移动世界原点将会导致在世界中注册的所有Actor物体添加一个偏移量。每一个Actor物体都有一个ApplyWorldOffset ()函数,当添加一些其他的事情时,他会被在子类里重载。如果你已经创建了一个新的AActor派生类并且存储了它的绝对位置值,你必须重写applyworldoffset函数,使它与世界的原点的改变正常的变化。渲染和物理元素将被转移在平行于游戏中的线程的一个Actor物体中。

Big Worlds and Multiplayer  超大地图和多玩家
Right now world origin shifting is not supported in the multiplayer games. Here are two solutions that can be implemented for your specific needs:

Implement your own server solution. MMO licensees mostly do this.

Implement some layer between clients and unreal dedicated servers which will transform shifted absolute positions from the clients and route them to the right dedicated server, which only holds part of the world where client is.

However if you disable world origin, shifting you can run a tiled world with a dedicated server. Dedicated servers will load all distance dependent levels, and each connected client will work as usual loading only level that satisfy streaming distance settings. A server holds a list of visible levels for each client and filters Actor replication by this list.

目前为止,世界的原点偏移将不在多人游戏中支持。但是这里有两个解决方案,可以实现为您的特定需求:

实现你自己的服务器解决方案。网络游戏授权大多做这个。

实现客户和虚幻的专用服务器,将转移的绝对位置从客户和路由到正确的服务器之间的一些层,只能装的世界里,客户端部分。

Creating Landscape Levels  创建地形关卡
Right-clicking on a level tile, to summon the context menu, which has a Landscape Actor inside will bring an options for adding adjacent levels with landscape proxy Actors in them. This requires the adjacent levels landscapes have size equal to source Landscape size.

右键一个关卡瓦片,召唤一个有着Landscape Actor 地形物体的上下文菜单,将会给你提供一个增添相邻的关卡的选项并在其中有一个代表性的actor物体。这需要相邻的关卡地形的大小一致。

Tiled Landscape Import  瓦片地形的载入
In the Levels panel toolbar you can find an option for importing tiled landscape. Tiled landscapes are created from a tiled heightmap, where each heightmap tile will represent a level with a landscape Actor in it. Tiled heightmaps/weightmaps can be exported from an application like World Machine. Adjacent heightmaps tiles should share border vertices ("Share edge vertices" in World Machine). And, each tile resolution should follow the recommendations from this page Creating Landscapes.

在关卡工具栏中,你可以找到一个载入瓦片地形的选项。瓦片地形从一个瓦片高度图中创建,每一个高度图瓦片将会代表一个有地形的关卡。瓦片地形高度图可以被一些其他的工具到处,比如worldmachine。相邻的瓦片高度图应该分享边界最高点(在worldmachine中叫做”"Share edge vertices"“), 并且每一个瓦片地图高度图的分辨率最好和这一章节创建地形Creating Landscapes.匹配。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/432175.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

inside uboot (二) 启动流程

1. S3C6410 启动流程 1). 6410上电后,首先执行片内iROM的程序(BL0),初始化时钟和看门狗等外围器件。 2). 然后把flash中头4K(BL1)的内容加载到片内的SRAM中执行。 3). 在SRAM中执行的BL1,初始…

你理解我的意思么?

在最近一次的电话会议里, 某leader前后说了十来句, "你理解我的意思么?". 说实话, 有些我都没理解, 不过我听到的大家的答复都是"理解!", "明白!". Leader问这样的问题, 期望是得到对方给你反馈, 结果大部分人不会直接对上级说, "是的,我不…

inside uboot (三) 异常向量表

1. 异常向量表概述 从上面的地址映射来看,中断向量表的地址为0xD0037400,因此如果我们想在SRAM中,也就是BL1中处理异常的话, 就需要把我们的异常向量表拷贝到这个地址上。或者我们可以在链接脚本中直接指定代码的地址。 如果在主…

有关GNU GCC的基本内容整理

一、GCC简介 GCC(GNU Compiler Collection,GNU编译器集合)是一套由GNU工程开发的支持多种编程语言的编译器。GCC是自由软件发展过程中的著名例子,由自由软件基金会 以GPL协议发布。当年Richard Stallman 刚开始写作 GCC 的时候&am…

[UE4]C++静态加载问题:ConstructorHelpers::FClassFinder()和FObjectFinder()

相关内容&#xff1a; C实现动态加载的问题&#xff1a;LoadClass<T>()和LoadObject<T>() http://aigo.iteye.com/blog/2281558C实现动态加载UObject&#xff1a;StaticLoadObject()&#xff1b;以Texture和Material为例 http://aigo.iteye.com/blog/2268056 这…

inside uboot (五) DRAM的构成

DRAM(Dynamic Random Access Memory)&#xff0c;即动态随机存取存储器. 1. Storage Cell 如上图&#xff0c;一个DRAM的基本存储单元由4个部分组成。 Storage Capacitor&#xff0c;即存储电容&#xff0c;它通过存储在其中的电荷的多和少&#xff0c;或者说电容两端电压差的…

使用json-lib进行Java和JSON之间的转换

转自http://www.cnblogs.com/mailingfeng/archive/2012/01/18/2325707.html 1. json-lib是一个java类库&#xff0c;提供将Java对象&#xff0c;包括beans, maps, collections, java arrays and XML等转换成JSON&#xff0c;或者反向转换的功能。 2. json-lib 主页 &#xff1a…

inside uboot (六) DRAM芯片的控制线及时序

Clock &#xff08;差分信号&#xff0c;CLK和nCLK&#xff09;为时钟信号 &#xff08;同一个rank共用&#xff09; CKE 时钟信号使能 &#xff08;同一个rank共用&#xff09; RAS 为行选…

MVC — 初步理解IIS工作流程

声明&#xff1a;本文只是自己的总结和积累。IIS7.x 目录 IIS流程及组成部分ASP.NET流程及组成部分IIS与ASP.NET MVC一、IIS流程及组成部分  1、Http.SYS&#xff1a;负责监听HTTP请求&#xff08;它不属于IIS范畴&#xff0c;但是和IIS联系紧密&#xff09; Http.SYS和IIS是…

卷积积分这样学!

卷积积分是一种数学运算&#xff0c;那么既然是数学运算&#xff0c;那么就得有数学的特性——定义、性质、定理。 本文将从卷积积分的理论、案例、求解方法、知识图谱四方面介绍卷积积分&#xff01; 一、【理论】卷积积分的理论 卷积积分定义&#xff1a; 卷积图解01 卷积…

世界地图并不是世界的真实样貌!甚至误差非常大

现在所用的世界地图并不是世界的真实样貌&#xff0c;甚至误差大的离谱。 地球属于三维球体&#xff0c;想完整地表现到二维平面上是不可能的&#xff0c;必须牺牲一些真实属性。因为三维降到二维肯定存在扭曲失真&#xff0c;这是维度差异所决定的&#xff0c;不可避免。 我们…

error MSB6006: cmd.exe exited with code 3

利用vs2012和qt5.5.1&#xff0c;在编译例子时发生如下错误&#xff1a; C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(172,5): error MSB6006: “cmd.exe”已退出&#xff0c;代码为 3。 图片如下&#xff1a; 解决办法如下&#x…

数学天才用5万字让你读懂:微积分!

前面接连发了三篇麦克斯韦方程组的文章&#xff08;积分篇、微分篇和电磁波篇&#xff09;&#xff0c;从理论上来说&#xff0c;讲麦克斯韦方程组不讲微积分是不行的&#xff0c;因为人家本来就是一组积分方程和一组微分方程。 但是&#xff0c;为了让更多人&#xff0c;尤其是…

指定一个actor对pawn不可见

1. 把一个staticmesh作成一个actor 2. 给actor添加一个tag 3. 在pawn的beginPlay里面查找这个actor&#xff0c;并设置actor的owner为pawn&#xff0c;然后调用set owner no see

oracle中DECODE与CASE的用法区别

对于CASE与DECODE其实并没有太多的区别&#xff0c;他们都是用来实现逻辑判断。Oracle的DECODE函数功能很强&#xff0c;灵活运用的话可以避免多次扫描&#xff0c;从而提高查询的性能。而CASE是9i以后提供的语法&#xff0c;这个语法更加的灵活&#xff0c;提供了IF THEN ELSE…

计算曲线的长度

若一条平面曲线可表达成标准方程 那么它的长度就是&#xff1a; 其中a、b为x的上下限。 若平面曲线可表达成参数方程 那么它的长度就是&#xff1a;

MATLAB 求曲线长度

1. 求曲线长度积分公式 2. 已知曲线方程 3. 已知系数&#xff0c;曲线方程为 y 0.0001 * x 0.0005 * x 20 4. 已知曲线的x的起点和终点 -90.78 &#xff0c;90.78 5. matlab中定义曲线方程 >> syms x; >> y 20 0.0005 * x ^ 2 0.0001 * x ^ 3; 6. matlab中…

C++调用matlab dll

1. 编写matlab函数 2. 命令行输入 mex -setup 选择 mex -setup C 3. 命令行输入 mbuild -setup 选择 mex -setup C -client MBUILD 4. 命令行输入 mcc -W cpplib:add -T link:lib add.m -C 第一个add为生成的dll名称&#xff0c;第二个add为m文件名称&#xff0c;m文…