Unreal Engine 5與二維游戲設計

林華 主編、鐘景浩 副主編

  • 出版商: 清華大學
  • 出版日期: 2024-04-01
  • 定價: $654
  • 售價: 8.5$556
  • 語言: 簡體中文
  • ISBN: 7302660328
  • ISBN-13: 9787302660323
  • 相關分類: Unreal
  • 立即出貨

  • Unreal Engine 5與二維游戲設計-preview-1
  • Unreal Engine 5與二維游戲設計-preview-2
  • Unreal Engine 5與二維游戲設計-preview-3
Unreal Engine 5與二維游戲設計-preview-1

買這商品的人也買了...

相關主題

商品描述

本書主要講解使用 UE5(Unreal Engine 5)引擎開發 2D 游戲,介紹 UE5 製作 2D 內容所需要的全部技術知識。 全書內容包括:使用 UE5 開發 2D 游戲需要掌握的基礎知識(第 1 ~ 6 章),包括 UE5 的安裝、項目結構分析、界面佈局,也包括針對 2D 項目的特殊設置;2D 游戲項目實例(第 7 ~ 9 章),每章都是一個完整的 2D 游戲,從易到難地介紹 2D 內容製作的各技術方向;最後第 10 章介紹使用 UE5製作 2D 交互藝術作品,以及游戲之外的交互內容。書中的實例都提供配套的資源和源代碼。 本書適合 UE5 引擎的初學者、獨立游戲開發者和有興趣使用 UE5 引擎製作交互內容的讀者,也適合學校作為交互藝術設計、游戲開發等專業的初級課程。

目錄大綱

第 1 章? UE5 介紹 ………………… 1 

1.1 什麽是游戲引擎 ····························1 

1.1.1 實時渲染器 ································· 1 

1.1.2 物理引擎 ···································· 2 

1.1.3 人工智能引擎 ······························ 2 

1.1.4 網絡引擎 ···································· 3 

1.1.5 聲音渲染器 ································· 3 

1.1.6 腳本引擎 ···································· 4 

1.2 UE 的發展歷史 ·····························5 

1.2.1 第一代 UE ·································· 5 

1.2.2 UE2 ~ UE2.5 ······························ 6 

1.2.3 UE3 ·········································· 7 

1.2.4 UDK ········································· 8 

1.2.5 UE4 ·········································· 8 

1.2.6 Epic Games Store ·························11 

1.2.7 UE5 ·········································11 

1.3 UE 在其他領域的應用 ·················· 12 

1.3.1 建築設計、景觀設計、室內設計等設計行業 ···············12 

1.3.2 影視製作行業 ·····························13 

1.3.3 廣播行業 ···································13 

1.3.4 產品設計和製造領域 ····················14 

1.3.5 AI 駕駛、AI 訓練等領域 ···············14 

1.3.6 AR、VR 領域 ·····························15 

1.4 UE5 游戲引擎的功能 ··················· 15 

1.4.1 Lumen ······································16 

1.4.2 Nanite ·······································16 

1.4.3 Virtual Shadow maps ·····················16 

1.5 UE5 的特點································ 16 

1.5.1 高品質全功能 ·····························16 

1.5.2 工作流功能強大,耦合性低 ···········17 

1.5.3 頂級的視覺效果,最高端的圖形渲染技術 ·········17 

1.5.4 友好的社區,良好的文檔及技術支持 ·········18 

1.5.5 強大的跨平臺能力 ·······················18 

1.5.6 靈活的授權模式 ··························19 

1.6 使用 UE5 的軟件和硬件需求 ·········· 19 

1.6.1 安裝 UE5 的軟件需求 ···················19 

1.6.2 硬件需求 ···································20 

1.6.3 關於用筆記本電腦學習使用 UE5 ···21 

總結················································ 22 

問答················································ 22 

思考················································ 22 

練習················································ 22 

第 2 章? UE5 的安裝與使用 …… 23 

2.1 註冊 Epic 官方賬號 ······················ 23 

2.2 下載安裝 Epic Game Launcher ········ 25 

2.2.1 下載 Epic Game Launcher ··············25 

2.2.2 安裝 Epic Game Launcher ··············26 

2.2.3 登錄 Epic Game Launcher ··············26 

2.3 安裝 UE5··································· 27 

2.4 Epic Game Launcher 的主要功能 ····· 29 

2.4.1 News ········································29 

2.4.2 示例 ·········································29 

2.4.3 虛幻商城 ···································30 

2.4.4 庫 ············································31 

2.5 修改 Epic Game Launcher 設置 ········ 31 

2.5.1 修改 Epic Game Launcher 語言 ········31 

2.5.2 修改 Epic Game Launcher 緩存目錄 ··32 

總結················································ 32 

問答················································ 32 

思考················································ 32 

練習················································ 32 

第 3 章? 第一個 UE5 項目及項目結構分析 ………… 33 

3.1 開啟 UE5 項目瀏覽器 ··················· 33 

3.2 虛幻項目瀏覽器界面介紹 ·············· 34 

3.2.1 “最近打開的項目” ····················34 

3.2.2 “游戲”標簽 ·····························36 

3.2.3 “影視與現場活動”標簽 ··············37 

3.2.4 “建築”標簽 ·····························37 

3.2.5 “汽車、產品設計和製造”標簽 ·····38 

3.3 創建項目 ··································· 38 

3.3.1 選擇模板類型 ·····························38 

3.3.2 設置項目默認設置 ·······················39 

3.3.3 項目默認配置說明 ·······················39 

3.3.4 設置項目名稱和項目位置 ··············40 

3.4 UE5 項目結構分析 ······················ 42 

3.4.1 什麽是 UE5 項目 ·························42 

3.4.2 項目目錄結構 ·····························42 

3.5 改變 UE5 項目版本 ······················ 43 

3.5.1 查看引擎版本 ·····························43 

3.5.2 版本字符串不可用的情況 ··············44 

3.5.3 切換引擎版本 ·····························44 

3.6 UE5 插件管理····························· 45 

3.6.1 打開插件管理器 ··························45 

3.6.2 插件分類 ···································45 

3.6.3 uproject 文件控制插件功能 ············47 

3.7 編輯器設置 ································ 47 

3.7.1 改變編輯器默認語言 ····················47 

3.7.2 改變編輯器默認自動保存的行為 ·····49 

3.7.3 還原編輯器設置 ··························50 

總結················································ 50 

問答················································ 50 

思考················································ 50 

練習················································ 50 

第 4 章? UE5 引擎界面佈局與基礎操作 ……… 51 

4.1 UE5 界面佈局····························· 51 

4.1.1 UE5 默認界面佈局 ······················51 

4.1.2 UE5 自定義界面佈局 ···················52 

4.1.3 保存已調整好的佈局 ····················54 

4.1.4 讀取保存的佈局文件 ····················55 

4.1.5 加載默認佈局 ·····························55 

4.2 菜單 ········································· 55 

4.2.1 “文件”菜單 ·····························55 

4.2.2 “編輯”菜單 ·····························57 

4.2.3 “窗口”菜單 ·····························58 

4.2.4 “工具”菜單 ·····························59 

4.2.5 “構建”菜單 ·····························59 

4.2.6 “選擇”菜單 ·····························60 

4.2.7 “幫助”菜單 ·····························60 

4.3 工具欄 ······································ 60 

4.3.1 編輯器模式 ································61 

4.3.2 快速添加到項目按鈕 ····················61 

4.3.3 藍圖按鈕菜單 ·····························62 

4.3.4 過場動畫按鈕菜單 ·······················62 

4.3.5 播放控制按鈕 ·····························62 

4.3.6 平臺按鈕菜單 ·····························63 

4.4 視口面板 ··································· 63 

4.4.1 視口操作 ···································63 

4.4.2 視口的視圖類型 ··························65 

4.4.3 視口佈局 ···································65 

4.4.4 快速切換視圖類型 ·······················66 

4.4.5 視口顯示模式 ·····························66 

4.4.6 視圖中 Actor 的操作 ····················66 

4.5 大綱面板 ··································· 68 

4.5.1 對 Actor 進行重命名 ····················68 

4.5.2 通過名稱搜索物體 ·······················68 

4.5.3 通過文件夾管理項目結構 ··············68 

4.5.4 創建父子關系 ·····························69 

4.6 內容瀏覽器 ································ 69 

4.6.1 顯示內容瀏覽器 ··························70 

4.6.2 內容資源管理 ·····························70 

4.6.3 保存新建或修改過的資產 ··············70 

總結················································ 71 

問答················································ 71 

思考················································ 71 

練習················································ 72 

第 5 章? UE5 引擎 Paper2D 插件 ………… 73 

5.1 為什麽用 UE5 開發 2D 游戲 ··········· 73 

5.1.1 2D 游戲的發展 ···························73 

5.1.2 2D 游戲的優點 ···························74 

5.1.3 學習 2D 游戲開發的優點 ··············76 

5.1.4 使用 UE5 開發 2D 游戲的優點 ·······76 

5.2 Paper2D 插件介紹························ 77 

5.2.1 打開 Paper2D 插件 ·······················77 

5.2.2 Paper2D 插件提供的內容 ··············78 

5.2.3 Paper2D 插件提供的基礎材質 ········79 

5.3 Sprite ········································ 80 

5.3.1 UE5 中的 Sprite ··························80 

5.3.2 圖片與紋理 ································80 

5.3.3 創建 Sprite ·································82 

5.4 Sprite 設置 ································· 83 

5.4.1 Sprite 大小 ·································83 

5.4.2 自定義 Sprite 渲染形狀 ·················84 

5.4.3 自定義 Sprite 碰撞 ·······················85 

5.5 使用單張紋理創建多個 Sprite ········· 88 

5.6 圖像序列 ··································· 90 

5.7 瓦片與瓦片集 ····························· 93 

5.7.1 創建瓦片集 ································93 

5.7.2 設置瓦片碰撞區域 ·······················94 

5.7.3 使用瓦片集創建瓦片貼圖 ··············94 

總結················································ 96 

問答················································ 96 

思考················································ 96 

練習················································ 96 

第 6 章? UE5 2D 開發初始設置 ………97 

6.1 Sprite 模糊 ································· 97 

6.2 後處理自動曝光 ·························100 

6.2.1 通過後處理體角色關閉自動曝光 ··· 100 

6.2.2 通過視口工具菜單關閉自動曝光 ··· 102 

6.2.3 使用項目設置的自動曝光控制亮度 103 

6.3 導入 UE5 後的 Sprite 變色 ············103 

6.3.1 UE5 顏色矯正工具 ···················· 103 

6.3.2 顏色產生變化的原因 ·················· 106 

6.3.3 解決色彩改變 ··························· 106 

6.4 UE5 2D 攝影機設置 ····················109 

6.5 UE5 瓦片貼圖縫隙處理 ···············112 

6.6 Sprite 透明排序 ··························113 

6.6.1 2D 層捕捉 ······························· 113 

6.6.2 透明渲染順序 ··························· 114 

總結···············································115 

問答···············································115 

思考···············································115 

練習···············································115 

第 7 章? 用 UE5 開發《俄羅斯方塊》休閑游戲 ……116 

7.1 游戲玩法分析 ····························116 

7.1.1 簡單描述《俄羅斯方塊》玩法 ······ 117 

7.1.2 詳細總結《俄羅斯方塊》玩法 ······ 117 

7.2 創建項目 ··································117 

7.2.1 項目設置 ································· 117 

7.2.2 創建 2D 空關卡 ························ 118 

7.2.3 創建關鍵游戲藍圖 ····················· 118 

7.2.4 設置 UE5 使用新創建的玩法類 ····· 120 

7.2.5 創建游戲相關類 ························ 122 

7.2.6 導入資源 ································· 122 

7.3 裝飾場景 ··································124 

7.3.1 設置後處理自動曝光 ·················· 124 

7.3.2 設置色調映射器 ························ 124 

7.3.3 其他後處理設置 ························ 125 

7.3.4 添加背景音樂 ··························· 125 

7.4 設置攝影機 ·······························126 

7.4.1 設置玩家使用的 Pawn 角色 ········· 126 

7.4.2 添加玩家 Pawn 的攝影機組件 ····· 126 

7.4.3 設置攝影機組件參數 ·················· 127 

7.5 創建背景網格 ····························128 

7.5.1 添加網格到關卡 ························ 128 

7.5.2 為背景網格添加的長度和寬度 ······ 128 

7.5.3 創建背景方塊 ··························· 129 

7.6 BP_Grid 創建方塊 ······················135 

7.7 添加 BP_Tetris 自動下落功能 ········136 

7.7.1 添加預覽模型 ··························· 136 

7.7.2 讓 BP_Tetris 向下移動 ················ 137 

7.8 完成 BP_Tile 功能 ······················139 

7.8.1 設置 BP_Tile 的基礎組件和屬性 ··· 139 

7.8.2 BP_Tetris 的不同類型 ················· 139 

7.8.3 使用枚舉區分類型 ····················· 139 

7.8.4 為 BP_Tile 添加類型變量 ············ 140 

7.8.5 根據類型設置顏色 ····················· 140 

7.9 隨機生成不同類型的 BP_Tetris ······143 

7.9.1 添加 SetTetrisType 事件函數 ········· 143 

7.9.2 添加子角色組件 ························ 144 

7.9.3 根據類型設置 BP_Tile 顏色 ········· 145 

7.9.4 轉換圖表為函數 ························ 147 

7.9.5 根據類型設置 BP_Tile 位置 ········· 148 

7.9.6 BP_Grid 創建隨機類型的BP_Tetris ······· 150 

7.10 輸入設置 ································154 

7.10.1 設置“輸入” ························· 154 

7.10.2 藍圖響應“輸入”事件 ············· 154 

7.10.3 通過 BP_Tetris_PlayerPawn 控制BP_Tetris ··············· 156 

7.11 控制 Tetris 移動旋轉和加速 ·········160 

7.11.1 控制 Tetris 加速下落 ················· 160 

7.11.2 判斷 Tetris 是否結束 ················· 161 

7.11.3 BP_Tetris 降落到底部················ 163 

7.11.4 控制 BP_Tetris 左右移動 ············ 167 

7.11.5 控制 BP_Tetris 旋轉 ·················· 168 

7.12 BP_Tetris 落地後的相關邏輯········169 

7.12.1 管理 BP_Grid 中的 BP_Tile ········ 169 

7.12.2 往 BP_Grid 中添加 BP_Tile ········ 170 

7.12.3 檢查游戲是否結束 ··················· 170 

7.12.4 查找 BP_Grid 中 BP_Tile 滿了的行 ············ 171 

7.12.5 移除滿行的行中所有 BP_Tile ····· 172 

7.12.6 把刪除行之上的 Tile 順序下移 ···· 174 

7.12.7 實現方塊落下之後的所有邏輯 ···· 175 

7.12.8 完善方塊移動旋轉 ··················· 178 

7.13 細化完成游戲 ··························180 

7.13.1 添加得分記錄 ························· 180 

7.13.2 添加 UI ································· 184 

7.13.3 添加音效 ······························· 196 

7.14 打包為 Windows 平臺可執行文件 ············197 

7.14.1 設置 Windows 平臺打包環境 ······ 197 

7.14.2 Windows 平臺打包 ··················· 200 

總結···············································202 

問答···············································202 

思考···············································202 

練習···············································202 

第 8 章? 用 UE5 開發 2D 平臺游戲 …………203 

8.1 2D 平臺游戲介紹 ·······················203 

8.1.1 2D 平臺類游戲的優點 ················ 203 

8.1.2 2D 平臺類游戲代表作品 ············· 203 

8.2 創建 2D 平臺游戲項目 ·················204 

8.2.1 創建項目 ································· 205 

8.2.2 項目配置 ································· 205 

8.2.3 創建基礎游戲玩法類 ·················· 205 

8.3 實現 2D 平臺游戲角色 ·················207 

8.3.1 導入資源 ································· 207 

8.3.2 創建 Flipbooks 動畫 ··················· 209 

8.3.3 設置玩家圖像序列 ····················· 210 

8.3.4 添加玩家攝影機 ························ 210 

8.3.5 添加玩家基礎移動 ····················· 211 

8.4 使用精靈創建關卡 ······················217 

8.4.1 自定義捕捉間距 ························ 217 

8.4.2 設置精靈碰撞形狀 ····················· 218 

8.4.3 創建完整關卡 ··························· 220 

8.4.4 添加背景 ································· 221 

8.4.5 設置跳躍高度 ··························· 222 

8.5 使用瓦片地圖創建關卡 ················223 

8.5.1 使用瓦片製作地圖的優點 ············ 223 

8.5.2 創建瓦片集 ······························ 223 

8.5.3 創建瓦片貼圖 ··························· 224 

8.5.4 編輯瓦片貼圖 ··························· 224 

8.5.5 在關卡中使用瓦片貼圖 ··············· 226 

8.5.6 設置瓦片碰撞 ··························· 226 

8.5.7 設置背景方法 2 ························ 227 

8.6 創建可拾取金幣 ·························228 

8.6.1 創建金幣藍圖 ··························· 228 

8.6.2 準備精靈資源 ··························· 228 

8.6.3 設置金幣藍圖 ··························· 229 

8.6.4 創建金幣邏輯 ··························· 230 

8.7 設置藍圖類圖標 ·························232 

8.7.1 自定義藍圖 Icon ························ 232 

8.7.2 自定義關卡文件圖標 ·················· 232 

8.8 添加陷阱 ··································233 

8.8.1 創建設置陷阱藍圖 ····················· 233 

8.8.2 添加玩家受傷邏輯 ····················· 233 

8.8.3 陷阱觸發玩家受傷 ····················· 234 

8.8.4 處理玩家角色死亡 ····················· 235 

8.8.5 實現玩家受傷效果 ····················· 236 

8.9 添加移動平臺 ····························238 

8.9.1 創建設置平臺藍圖 ····················· 238 

8.9.2 設置移動目標 ··························· 240 

8.9.3 移動平臺 ································· 240 

8.9.4 設置 TimeLine 播放時間 ············· 242 

8.10 添加不可見死亡觸發器 ··············244 

8.10.1 添加設置死亡觸發器藍圖 ·········· 244 

8.10.2 設置角色死亡事件 ··················· 245 

8.10.3 在關卡中配置死亡觸發角色 ······· 245 

8.11 添加過關藍圖 ··························247 

8.11.1 創建過關藍圖 ························· 247 

8.11.2 準備過關藍圖圖像序列 ············· 247 

8.11.3 設置過關藍圖 ························· 248 

8.12 Game HUD ······························250 

8.12.1 創建 UI 藍圖 ·························· 250 

8.12.2 創建生命欄 ···························· 250 

8.12.3 完成生命欄邏輯 ······················ 253 

8.12.4 顯示游戲 UI ··························· 255 

8.12.5 添加金幣 UI ··························· 255 

8.12.6 完成金幣顯示 ························· 257 

8.13 移動平臺輸入 ··························260 

8.13.1 添加佈局輸入控制器 UI ············ 260 

8.13.2 添加控制器 UI 到視口 ·············· 263 

8.13.3 準備動作事件 ························· 264 

8.13.4 UI 觸發事件 ··························· 265 

8.14 Android 平臺游戲打包 ················269 

8.14.1 安裝 Android Studio ·················· 269 

8.14.2 安裝 Android SDK ···················· 271 

8.14.3 UE5 更新 Android SDK 版本 ······· 274 

8.14.4 項目打包配置 ························· 276 

8.14.5 處理打包錯誤 ························· 278 

8.14.6 安裝到真機 ···························· 280 

總結···············································282 

問答···············································282 

思考···············································282 

練習···············································282 

第 9 章? 在 UE5 中用 2D 骨骼動畫技術製作塔防游戲 …283 

9.1 2D 骨骼動畫簡介及製作方法 ········283 

9.2 SpineUnrealEngine 插件 ···············287 

9.2.1 下載 Spine Runtime 源代碼 ·········· 287 

9.2.2 編譯 Spine UE 插件 ···················· 288 

9.2.3 安裝 spineUE4 插件 ··················· 290 

9.3 準備項目資產 ····························291 

9.3.1 Spine 動畫介紹 ························· 291 

9.3.2 導入 spine 資產 ························· 291 

9.3.3 播放 Spine 動畫 ························ 293 

9.3.4 準備游戲資源並搭建背景關卡 ······ 300 

9.3.5 關閉流式紋理解決紋理模糊問題 ··· 302 

9.4 創建角色類 ·······························302 

9.4.1 創建玩家攝影機角色 ·················· 302 

9.4.2 設置角色基類 ··························· 303 

9.4.3 創建設置玩家英雄類 ·················· 304 

9.4.4 創建設置敵人類 ························ 306 

9.4.5 敵人向前移動 ··························· 307 

9.5 實現游戲攻擊邏輯 ······················308 

9.5.1 敵人攻擊玩家英雄 ····················· 308 

9.5.2 玩家英雄攻擊敵人 ····················· 312 

9.5.3 Enemy 生成器 ·························· 314 

9.6 添加金幣系統 ····························317 

9.6.1 在 BP_Player 中添加金幣 ············ 317 

9.6.2 創建 BP_Coin 金幣藍圖類 ··········· 317 

9.6.3 設置金幣響應單擊事件 ··············· 318 

9.6.4 設置金幣掉落 ··························· 319 

9.6.5 金幣生成器 ······························ 321 

9.7 購買放置英雄 ····························323 

9.7.1 HUD 顯示金幣 ························· 323 

9.7.2 創建購買英雄圖標 ····················· 325 

9.7.3 英雄角色生成點 ························ 329 

9.7.4 購買後顯示英雄圖標 ·················· 331 

9.7.5 管理角色生成點 ························ 333 

9.8 添加守護入口 ····························337 

總結···············································340 

問答···············································341 

思考···············································341 

練習···············································341 

第 10 章? 基於 UE5 的數字二維交互藝術設計 ………342 

10.1 數字二維交互藝術設計的概念 ·····342 

10.2 當代常見的交互藝術形式 ···········343 

10.3 UE5 如何製作交互藝術 ··············345 

10.4 基於 UE5 的數字二維交互藝術設計案例 ···········347 

總結···············································355 

思考···············································355 

練習···············································355