Unity3D是很棒的工具。但分享些柯老師已經建立了幾個小項目的經驗談,,到目前為止整個開發過程中,我們也看到Unity3D 要注意的部分。Unity3D引擎可以做幫助開發,但更多的是一但用開發過程中容易忽視的問題。
所以,我試圖打聽大的開發團隊的項目是如何工作的,
1)源代碼的版本控制
2)分離場景、遊戲和編輯器,盡量把大型遊戲切成越多小塊越好。
但最近花了很多時間看到unity 會議的所有影片,這裡
影片講的很多地方,是在分享他們在用 Unity3D 實際工作的經驗。
開發團隊Scalable 的PPT 投影片在此
資料來源: http://va.lent.in/so-how-do-teams-work-on-a-big-unity3d-project/
Unity tends to crash building a large project. That’s why they split the game into several projects: entry point project, assets projects, code project.
Entry point project is simple, contains minimum stuff to show loading screen or error screen. Loads asset bundles from asset projects and DLLs from code projects.
Content projects got their copy of DLLs, they are used to export assets to bundles and there are external tools to rebuild assets.
There’s no single source file in Unity projects.
That allows to build custom framework, use namespaces, custom compiler preprocessor and obfuscator (if needed).
But there are problems with this approach like some deeply derived from MonoBehavior classes not showing in Unity3D IDE, harder to debug, etc.
#if preprocessor instructions are used to exclude platform specific code.
Custom GUI with relative sizing and positioning of controls. Saved and loaded using ScriptableObjects.
A lot of external data handled by ScriptableObjects which are serializable, editable like Behaviors and not tied to a GameObject.
Unite 11: Postmortem – Smuggle Truck
ONE project to build for all platforms. I think the project is not large, so they don’t see Unity crash much.
There’s a Level Editor which was used by players to create levels which actually shipped with the release.
Asset Settings tool to configure assets importing parameters for every platform. For example, background textures could be half-size in iPhone builds to increase performance.
Platform Specific properties can be configured with special 1. Behaviors attached to objects. For example, you could specify object’s size depending on whether the project is compiled for iOS or PC.
Custom build process allows them to use the data from 3 and 4 to set needed properties and delete unused assets before the actual build. This ensures that assets from PC build will not go to iOS build increasing its size.
At the end of the presentation they advised to have 2 copies of the project for different build targets if you have a lot of assets. Because converting from PC formats to iOS formats takes a lot of time.
Update: recently they released Multiplatform Toolkit to the Asset Store.
Unite 11: Jagged Alliance Online Engineering for Large Web Player Game
Large games have different problems: automatic builds, light map baking which takes 4 days to complete.
Big monolithic project fails to build. (heh, been there done that)
The project is split in SEVERAL small projects: code libraries, asset project(s). This approach allows to share code between client and server. Unity3D .NET project uses 3.5 and can be referenced from 4.0 server code. Asset projects are compiled into assets bundles to be use with code.
Programmers don’t spend an hour a day waiting for assets to be imported.
Code projects are separate Visual Studio solutions kept outside of Unity3D Assets folder. It allows using namespaces (not for MonoBehaviors though). Also they use Unit Tests with modified SharpUnit framework. There are problems with built-in Unity3D classes.
Shared code between code projects and assets projects are separated in yet another project which is referenced by them as DLL libraries.
Separate VS projects are configured to build DLLs into Temp folder not to be loaded by Unity3D and causing names conflict with existing source files.
There’s an advanced automatic build system which executes light map baking and asset bundles exporting in parallel reducing average build time.
Unite 11: Creating a Browser-ready FPS MMO in Unity Slides
Yet again, nobody uses built-in Unity GUI system.
The game looks really cool q:
There’s a custom interface to build asset bundles.
They use ScriptableObjects which are saved to XML and later loaded from server.
Tools for artists is a key to success.
Unite 11: Intro to Editor Scripting, Unite 12: Advanced Editor Scripting, Unite 13: Advanced Editor Scripting — totally must see if you want to create your own editor tools. Describes how to create custom Behaviors inspectors, drawing dummies in 3D scene and even creating custom editor windows.
Unite 11: SHADOWGUN: Rendering Techniques and Optimization Challenges (PDF) — a lot of low-level details if you want to optimize your game for devices.
Conclusion
Now I have time to think what approach to use: single configurable project, many projects with source inside Unity3D Assets folder or many projects with DLLs in the final Unity3D project. At least this time I got the details.
If you want to improve your team workflow with Unity3D you must spend a day watching these videos one by one. There is a lot of interesting details and what to think about. There’s no silver bullet but there is real world experience which speakers gladly share with you.
團結趨於崩潰建設一個大型項目。這就是為什麼他們分開,比賽進入了幾個項目:入口點的項目,資產項目,代碼項目。
切入點的項目很簡單,包含最小的東西,以顯示加載屏幕或錯誤畫面。負荷資產包從代碼項目的資產項目和DLL。
內容項目得到的DLL的拷貝,它們被用於資產導出到束和有外部工具來重建資產。
有沒有在統一的項目沒有一個單一的源文件。
這使得構建定制的框架,使用命名空間,自定義編譯預處理和混淆器(如果需要)。
但也有問題,像一些從MonoBehavior類沒有顯示在Unity3D IDE深深衍生這種方法,難以調試,等等。
#如果預處理器指令來排除特定於平台的代碼。
自定義GUI相對大小和位置的控制。保存並使用ScriptableObjects加載。
很多通過ScriptableObjects這是可序列化的,可編輯樣行為,而不是依賴於一個遊戲對象處理的外部數據。
團結11:死後 – 走私卡車
一個項目建設的所有平台。我覺得這個項目並不大,所以他們沒有看到統一崩潰了。
還有這是用玩家創造,實際上附帶的版本級別關卡編輯器。
資產設置工具來配置資產導入參數為每個平台。例如,背景紋理可以是半角用於iPhone構建以提高性能。
特定於平台的屬性可以附加到對象的特殊1.行為進行配置。例如,您可以指定對象的大小取決於該項目是否被編譯為iOS或PC。
自定義構建過程使他們能夠使用的數據來自3和4的實際建造之前設置所需的屬性和刪除未使用的資產。這保證了從PC構建的資產不會去的iOS版本增加它的大小。
在演講結束時,他們建議有2份該項目針對不同的構建目標的,如果你有很多的資產。因為從PC格式轉換到iOS格式需要花費大量的時間。
更新:最近他們發布了多平台工具包的資源商店。
凝聚11:鐵血聯盟在線工程的大型網絡遊戲玩家
大型遊戲有不同的問題:自動構建,光映射烘焙這需要4天時間才能完成。
整體大項目構建失敗。 (嘿,在那裡做了)
該項目被分成幾個小項目:代碼庫,資產項目(S)。這種方法允許客戶端和服務器之間共享代碼。 Unity3D.NET項目採用3.5和從4.0服務器代碼中被引用。資產項目被編譯成資產包,以與代碼中使用。
程序員不用每天花一個小時等待資產需要進口。
代碼項目Unity3D Assets文件夾之外保持獨立的Visual Studio解決方案。它允許使用名稱空間(不適用於MonoBehaviors雖然)。此外,他們使用單元測試與修改SharpUnit框架。有問題內置Unity3D類。
代碼的項目和資產項目之間共享代碼是分開的卻是他們所引用的DLL庫的另一個項目。
獨立VS項目被配置來構建DLL文件到臨時文件夾不被Unity3D加載,並造成與現有的源文件名衝突。
還有它執行的光照貼圖烘焙及資產包出口平行平均縮短建造時間一項先進的自動生成系統。
凝聚11:創建一個瀏覽器準備的FPS網絡遊戲在Unity幻燈片
再次,沒有人使用內建的統一GUI系統。
遊戲看起來真的很酷問:
有一個自定義的接口來構建資產包。
他們利用其保存到XML和從服務器加載後ScriptableObjects。
工具藝術家是成功的關鍵。
凝聚11:簡介編輯腳本,攜手12:高級編輯器腳本,攜手13:高級編輯器腳本 – 完全必須看到,如果你想創建自己的編輯器工具。介紹如何創建自定義的行為督察,假人繪製三維場景中,甚至創建自定義編輯器窗口。
團結11:SHADOWGUN:渲染技術和優化的挑戰(PDF) – 很多低級別的細節,如果你想優化你的遊戲設備。
結論
現在我有時間去思考方式使用什麼:單一配置的項目,很多項目源裡面Unity3D Assets文件夾或多個項目,最終Unity3D項目的DLL。至少這一次我得到了詳細信息。
如果你想提高你的團隊的工作流程與Unity3D,你必須花一天的時間觀看這些影片一個接一個。有很多有趣的細節,什麼思考的問題。有沒有靈丹妙藥,但有實際經驗的揚聲器很樂意與大家分享。
使用Unity3D開發大型遊戲的秘訣?