[UnrealEngine] 淺談GameFeature Plugin

posted in: UnrealEngine, 開發日誌 | 22

GameFeaturePlugin,這個功能是5.0最大的變革之一,對程式相關職能的人而言,我覺得重要性甚至更勝於nanite跟lumen,因為相關機制會從根本性上的改變了我們程式碼的架構方式以及思考模式。

不知道這東西的人可以先看一下官方介紹:https://docs.unrealengine.com/……/game-features……/

以下就先來粗略的分享一些我目前對這功能的理解吧:

就他的設計理念看來,他是屬於DLC概念的實現,跟Patch不同,Patch需要蓋掉原本的內容,而DLC必須要做到「熱插拔」的機制。 就傳統UE4 project,我們要達到DLC的這項要求非常麻煩,因為我們只能對「Content-Only」plugin包出dlc包,而哪些dlc需要開啟或關閉則需要你在BaseGame中做出一些可以管理的設計。

在GameFeature Plugin機制出現後,我們總算不需要做這些勞力活了。 注:所謂的BaseGame,指的是${PROJECT_ROOT}/Source下面所有的module以及${PROJECT_ROOT}/Content所有的Asset。

有些人會困惑於我們建出的GameFeature Plugin沒辦法跨專案共用,但這個理解並沒有錯,基本上GameFeature Plugin需要依賴於BaseGame而存在,因此我們也可以理解成他是專屬於project的Plugin。若你的功能想要跨專案共用,你要寫的是一般的Plugin而不是GameFeature。

GameFeaturePlugin之間可以有相依關係,但一個大原則是不能做出循環參照(circular reference)的設計。 就實現面來看,我們做出來的GameFeature Plugin依賴的是BaseGame,而BaseGame則是依賴於Plugins\Experimental\ModularGameplay。

它本身是利用訂閱者模式,讓發佈者(GameFeature)主動的將設計的內容推送到目標Actor身上,並動態掛上該Actor需要的Component。 Lyra Game 中有一個ModularGameplayActors Plugin,裡面就是幫我們做出了各種跟 GameFrameworkComponentManager 訂閱的Actor。

BaseGame本身是不認得我們做的那堆GameFeature Plugin的,他只負責做訂閱的動作。因此當我們在設計GameFeature Plugin的時候,要特別注意這些Plugin要能夠自給自足。可以想像一下,我們總不能做出一個dlc然後把dlc拔掉後原本的遊戲就不能動吧?

22 Responses

  1. zoritoler imol

    I’d have to examine with you here. Which is not one thing I usually do! I take pleasure in reading a post that may make folks think. Additionally, thanks for permitting me to comment!

  2. slot maxwin

    Hey, you used to write wonderful, but the last few posts have been kinda boring?K I miss your great writings. Past several posts are just a little out of track! come on!

  3. slot telkom88

    I have read some excellent stuff here. Certainly price bookmarking for revisiting. I wonder how a lot attempt you set to make one of these excellent informative website.

  4. femipro

    Sweet blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Many thanks

  5. provadent review

    Heya i’m for the first time here. I found this board and I find It really useful & it helped me out much. I hope to give something back and help others like you helped me.

  6. Gelatin Trick

    I have recently started a site, the information you provide on this website has helped me tremendously. Thank you for all of your time & work. “Money is power, freedom, a cushion, the root of al evil, the sum of all blessings.” by Carl Sandburg.

  7. zaborna torilon

    I actually wanted to develop a small message in order to thank you for all of the fantastic suggestions you are showing on this website. My time-consuming internet search has finally been rewarded with high-quality ideas to write about with my friends and classmates. I would declare that many of us readers actually are unquestionably fortunate to dwell in a remarkable community with many perfect people with great secrets. I feel extremely blessed to have used your entire webpages and look forward to many more fabulous moments reading here. Thank you once more for everything.

Leave a Reply to provadent review Cancel reply

Your email address will not be published. Required fields are marked *