UE4高級功能-初探超大無縫map的實現LevelStream


UE4高級功能--初探超大無縫地圖的實現LevelStream

前言


     好吧,這次總結的還是UE4,在這里要向CE3的朋友們道一聲歉,因為本人水品有限,對於CE3的探索學習陷入了一個非常大的瓶頸,暫時抽不出一塊兒大的單獨的時間去解決,另外,自己也有一點小小的私念,就是期盼Cryteck官方能夠推出新的版本,至少能完善一下現在的文檔,所以只能暫時把CE3擱置下來,但是我並不會放棄CE3,CE3對我來說,絕對是個非常大的挑戰,我不會輕易放棄他的。

   好了回歸正題,先來簡單說一下寫這篇文章的背景吧,這兩天我試着看了一下UE4官方提供的實例“2014功能介紹”,在里面發現一個疑惑,在GDC_Demo這個場景的關卡藍圖部分,發現了一個沒聽說的玩意兒----“子藍圖”,這個實例中,有三個地圖,感覺像是嵌套在了一起組成了一個大地圖,於是帶着這樣的疑惑,就去群里問了一下,得到了“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 布爾值來不使用世界原始轉移特性。 


小技巧:
(1)勾選 Enable World Composition時,系統會自動掃描大地圖所在文件夾,如果當大地圖所在文件夾存在有其他地圖的時候,系統會提示

如果沒有其他地圖的話,就不會提醒。
(2)選擇繼續后


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)中看到你項目中的所有關卡。關卡面板可以這樣打開


關卡窗口的條目代表你的世界的層次結構



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) 物體是用來計算關卡的大小的,可以在世界大綱試圖中搜索找到他!

默認情況下,關卡邊界物體會自動調整當前關卡中的所有物體的大小。然而,一些物體,比如天空盒,可以有一個非常大的邊界盒子,這將導致在世界地圖中存在過大的瓦片關卡。如果你有一些這樣的不想要被關卡邊界計算的物體,你可以禁止自動關卡邊界計算並且給關卡邊界物體設置一個固定大小的值。



 

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


 

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.

如果想要查看關卡窗口里面任意關卡的詳細信息,選擇他,點擊就行了。注意,這里還有一個小技巧,就是可以在關卡詳細信息窗口中可以切換到其他關卡,點擊上面那個下拉框即可。




 

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM