Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

非常好,刚刚开始学习。希望作者能给1-2个基础的例子深入学习 #30

Closed
zjz91010 opened this issue Jul 28, 2023 · 4 comments

Comments

@zjz91010
Copy link

例子如:
斗地主
麻将
战斗类

学习结合框架实际项目中使用

@kercylan98
Copy link
Owner

kercylan98 commented Jul 29, 2023

你好,感谢你的关注,在 minotaur 里基本大多数功能都是可以拿出来单独使用的,大多数的内容目前都有中文的注释,相关文档也可以在 https://pkg.go.dev/github.com/kercylan98/minotaur 查询到。

关于你提到的基础例子,我将在近期考虑实现并新增,感谢你的提出。

  • 扑克类游戏,目前在 game/poker 包中提供了大量的用于扑克牌玩法的函数,包括了牌型检查、牌堆、最优牌型组合等功能,也提供了很多内置的常见牌型检查函数。但是很遗憾,目前缺少范例测试,不过我将会开始补充,由于现在更新进度很快,或许很快就能看到。
  • 麻将类游戏,迄今为止其实还没有考虑过麻将类游戏的实现,不过麻将类游戏主要也是各种牌型的组合,或许扑克类的 game/poker 包应该也能解决?不过应该可以将这类牌型、组合的内容抽离到单独的包里做成通用功能。
  • 战斗类,这是目前这个仓库比较缺乏的内容,由于战斗类型多种多样,而且涉及面广泛,我也一直在考虑该怎样实现会比较合适,目前能够涉及到完整的战斗系统的实现暂时没有,不过一些相关的包应该能帮助到你:
    • 基于 2D 的 AOI 实现 game/aoi
    • A* 算法的寻路包 utils/geometry/astar
    • 网格寻路 utils/geometry/navmesh
    • 2D 服务端移动 component/components/moving2d.go

补充:

@kercylan98
Copy link
Owner

目前我创建了另一个仓库:https://github.com/kercylan98/minotaur-example ,在这个仓库中当前简单的实现了基于 WebSocket 的基础服务端,使用 Protobuf 作为通讯协议,包含了三个基础协议,心跳、获取服务器事件和登录的简单实现。后续完整用例我也将继续添加在该仓库中。

@kercylan98
Copy link
Owner

斗地主相关逻辑 https://github.com/kercylan98/minotaur-example/blob/master/game/services/landlords/landlords.go
我认为麻将与斗地主应该类似,而战斗方面。这个需要较为详细的需求

@kercylan98
Copy link
Owner

关于牌型的检测、生成可以参考以下包的测试用例:
https://github.com/kercylan98/minotaur/tree/master/utils/combination

回合制切换的实现可参考:
https://github.com/kercylan98/minotaur-example/blob/master/game/services/landlords/landlords.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants