Issues with Using Timers in Nakama

Scenario:

I am developing a session-based multiplayer game, so the battle calculations are handled on a separate server. For this reason, I do not plan to create a ‘Match API’, which means I cannot use the ‘ticket loop’ to broadcast messages to clients.

Questions:

  1. Can I use Go timer-related tools? For example, after the game matches players, they need to be transferred to the battle calculation server. This process requires confirmation from all 5 players and has a 15-second time limit. If the transfer is not completed within 15 seconds, it will be canceled, so I need to implement a 15-second countdown.

  2. Some peripheral features also require temporary, short-lived countdowns. If I cannot use certain Go timer functions, what methods can help me implement countdown tasks?

I would appreciate your advice.:wink:

Hi @a573369119,

Are you using a FleetManager (such as GameLift)?

It’s not clear to me why these timers wouldn’t be handled on the headless instance, can you give a more detailed breakdown of the steps involved in 1.?

I’m very glad to receive your reply.收到您的回复我非常高兴。:heart_eyes:

Currently, my timer is designed to work similarly to that in League of Legends (LOL): once players are matched, they are given a 15-second window to confirm (I intend to have Nakama handle this part).目前,我的计时器设计得与《英雄联盟(LOL)》中的计时器类似:一旦玩家匹配成功,他们将获得15秒的确认窗口(我打算让Nakama来处理这部分)。

I have implemented the Fleet Manager and am currently using it, though the way I have set it up may differ from what you envisioned.我已经实现了车队管理器,并且目前正在使用它,不过我的设置方式可能与你设想的有所不同。

  1. I plan to have the headless instances focus exclusively on the core game combat and not take on any additional operations. Only after players have fully confirmed their intention to engage in combat will they be sent to the combat service.我计划让无头实例专门专注于核心游戏战斗,不承担任何额外操作。只有在玩家完全确认他们的战斗意图后,才会将他们发送到战斗服务。

  2. The headless combat servers will concentrate on the combat phase, while Nakama will be responsible for matters outside the combat scenario:① Client-side combat flow:(Combat resource loading → Combat start → In-combat → Combat end → Return to main scene)② Headless server workflow example:(Accept player session → Combat start → In-combat → Combat end → Send back settlement data → Terminate session)无头战斗服务器将专注于战斗阶段,而Nakama将负责战斗场景之外的事务:①客户端战斗流程:(战斗资源加载→战斗开始→战斗中→战斗结束→返回主场景)②无头服务器工作流程示例:(接受玩家会话→战斗开始→战斗中→战斗结束→发回结算数据→终止会话