cloudnativegame / kruise-game-open-match-director Goto Github PK
View Code? Open in Web Editor NEWOpensource cloudnative game matching service for openkruisegame.
License: Apache License 2.0
Opensource cloudnative game matching service for openkruisegame.
License: Apache License 2.0
存在以下情况,进入匹配后对局(Match)信息需要反馈给玩家客户端或游戏大厅。例如,一个对局中存在多个队伍,每个队伍的对应的玩家ID情况需要在Assignment所表示,以便玩家客户端或游戏大厅watch Assignment时可以及时获取对应信息。然而,该类信息通常由匹配逻辑决定,匹配结果的产物是Match,因此需要一种协议,将Match中的extensions透传至Assignment。
Director会将match对象所有的extensions透传至Assignment. 因此对于开发者,在编写match function时,将希望被玩家客户端或游戏大厅的新增信息记录在match的extensions即可。
当存在玩家间允许异步进入房间,或是允许玩家退出补位的情况时,需要利用Open Match Backfill机制实现上述功能。
pb.Backfill{
SearchFields: &pb.SearchFields{
Tags: []string{"game.kruise.io/connected"},
},
Extensions: map[string]*anypb.Any{
"game.kruise.io/connection": any,
},
}
director fetch Match时若出现Backfill,则查看该Backfill是否已经分配过,若分配过,则将match的tickets assign 对应连接信息;若未分配过,则新分配gs给match的tickets。
当前director默认支持一种游戏的游戏服筛选。现在提出一种支持多个游戏的director方案,来支持集群中部署多种游戏服。
新增名为 game_name
的 profile,pool filter为string类型。例如,集群中存在三种游戏:football、basketball、tennis,director将生成以下profile:
p := []*pb.MatchProfile{
{
Name: "football",
Pools: []*pb.Pool{
{
Name: "game_name",
StringEqualsFilters: []*pb.StringEqualsFilter{
{
StringArg: "game_name",
Value: "football",
},
},
},
},
},
{
Name: "basketball",
Pools: []*pb.Pool{
{
Name: "game_name",
StringEqualsFilters: []*pb.StringEqualsFilter{
{
StringArg: "game_name",
Value: "basketball",
},
},
},
},
},
{
Name: "tennis",
Pools: []*pb.Pool{
{
Name: "game_name",
StringEqualsFilters: []*pb.StringEqualsFilter{
{
StringArg: "game_name",
Value: "tennis",
},
},
},
},
},
}
这里的game_name
对应在Kubernetes集群中的GameServerSet的名称。若希望返回正确结果,集群中应存在名为football、basketball、tennis的gss对象。
mmf 根据pool来筛选ticket与backfill
game frontend创建ticket时带上相应的searchField,例如希望匹配足球游戏时,ticket创建所示:
&pb.Ticket{
SearchFields: &pb.SearchFields{
StringArgs: map[string]string{
"game_name": "football",
},
},
}
为了尽可能降低网络延迟并优化玩家体验,大型多人在线对战(PvP)游戏经常采取在全球范围内部署服务器的做法。这种布局确保了玩家可以连接到地理位置邻近的节点,以获得更流畅的游戏过程。然而,为了丰富游戏的趣味性,在网络延迟允许的前提下,来自世界各地的玩家也应有机会加入到同一场对战中。这就将游戏内的匹配逻辑带入了一个全新的复杂性层级。
以往,OKG的director系统各自独立运行于每个服务器集群之中,专注于处理本地集群的匹配要求,同时仅限于指派各自集群内的服务器资源。不难看出,这种单一集群的模式由于局限于特定区域,无法满足跨区域游戏匹配需求,阻碍了全球化玩家互动的潜能。
如今要想跨越这个障碍,就必须对现有的游戏匹配架构进行全方位的更新,创建一个能够在全球范围内高效匹配玩家的模型。这种全域匹配系统的引进,不仅能够提供更好的玩家游戏体验,还能促进不同文化背景的玩家之间的交流,为游戏带来更加广泛的国际影响力。
方案架构图如下图所示
匹配过程如下:
为满足上述架构,kruise-game-open-match-director(OKG Director)需要进行全地域化改造:
-- slave-clusters
从集群(图中的region B、C所在集群)的kubeconfig以主集群open match同命名空间下的secret形式部署,主集群拿到从集群的访问权限。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.