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 之间的资讯同步。


<<:  进实验室啦!

>>:  day6 阿伯出事啦 exception

Day03 - Gem-strip_attributes 介绍与应用

前言 当使用者输入资料时,若不小心输入跳脱字元 Escape Character,如 \n or \...

Day-06 如何不分大小写/自动引入

本期想介绍Android Studio上两个实用技巧,使程序撰写时能够事半功倍完成。 1. 代码提示...

Trouble with Distributed Systems (3-1) - Unreliable Clocks

不可靠的时钟 (Unreliable Clocks) 时钟对应用程序来说很重要,它可以回答以下问题:...

Day 27 Realm的练习-使用者注册系统(1/3)

上一篇是用userDefalt去做资料的新增跟删除,但之前说过,userDefalt有个问题是他只能...

Day23 ( 高级 ) 仙女棒 ( 光迹效果 )

仙女棒 ( 光迹效果 ) 教学原文参考:仙女棒 ( 光迹效果 ) 这篇文章会介绍,如何在 Scrat...