iT邦幫忙

2021 iThome 鐵人賽

DAY 13
0
Software Development

徵坦補! 新手可! Open-Match 配對框架系列 第 13

Day13 補位策略 Backfill

在不同遊戲的類型可以用不同的條件配對成團,以下為常見配對後可以接受補位的情境:

  • 在一場遊戲中,有一名遊戲玩家離開了遊戲,為了保持遊戲平衡與樂趣,配對系統會將新進玩家配對至本局遊戲
  • 像 APEX 大逃殺類型的遊戲,配對的過程是由按下配對後,開始等待共計 60 名玩家才能出發,若等待過程中有玩家取消等待,則會增加一個待捕空缺,伺服器會將人數補滿 60 人後才開始遊戲
  • 擁有巨大世界觀的線上 MMORPG 遊戲,為了豐富社交行為與玩家互動,會希望玩家盡可能的,填滿現有的遊戲伺服器。只有在現有伺服器已滿的情況下,才會而外加開新伺服器,但由於每個伺服器再有玩家離線時,都會產生 backfill,因此玩家來來去去時產生一個動態平衡
  • 同樣是多人配對遊戲,在有一名遊戲玩家離開後,可以透過現有遊戲玩家,邀請其好友加入遊戲的方式,產生補位的效果,而這時系統的自動補位應該取消

Backfill 流程

  1. Player 1 creates a Ticket (T1).

  2. Director calls Backend.FetchMatches with a MatchProfile.

  3. MMF runs QueryBackfills and QueryTickets using the MatchProfile. It returns T1.

  4. MMF constructs a new Backfill (B1) and returns a Match containing ticket T1 and Backfill B1. The Backfill should be created with field AllocateGameServer set to true, so the game server orchestrator (e.g.: Agones) knows it has to create a new Game Server. The Director handles making calls to create the Game Server.

  5. Director starts allocating a Game Server with Backfill B1 information.

  6. Player 2 creates a Ticket (T2).

  7. Director calls Backend.FetchMatches.

  8. MMF runs QueryBackfills and QueryTickets using the MatchProfile. They return B1 and T2 accordingly.

  9. MMF determines B1 could be used based on data set on B1 by the last run of the MMF (e.g. a number of open slots). T2 and B1 form a new Match.

  10. When the Game Server has started, it begins polling Open Match to acknowledge the backfill with Frontend.AcknowledgeBackfill using the backfill’s ID (B1.ID) and supplies connection information for the server, to be returned as the Assignment data of the tickets T1 and T2. The Game Server also receives the ticket data of the tickets that were assigned so that any data supplied on the ticket (e.g. player IDs) may be used by the game server.

由上述流程可以看到一個重點,MMF 是讓我們可以使用 backfill 機制的主要角色,想要使用 backfill,我們勢必要在我們的 MMF 上,實作出符合補位機制的邏輯。而另一個需要注意的重點是,遊戲伺服器必須持續的向 Frontend,確認是否有需要補位的情況,透過使用 Frontend.AcknowledgeBackfill 接口,達成 Open-Match 與 Game Server 之間的資訊同步。


上一篇
Day12 同步狀態控制 Synchronizer
下一篇
Day14 Example of Backfill
系列文
徵坦補! 新手可! Open-Match 配對框架30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言