Java多人卡牌游戏AI集成
我使用 QuickServer 库开发了一款多玩家客户端/服务器版本的王牌纸牌游戏。它适用于 4 名人类玩家。但是当我完成AI播放器时,我没有找到将其集成到服务器中的方法:我应该为每个播放器创建一个单独的线程吗?
我希望我的问题很清楚。任何建议将不胜感激。
I have developed a Multi-player Client/Server Variation of Trumps Card Game using QuickServer library. It works well with 4 human players. But when I finished the AI player, I didn't find a way to integrate it into the server: Should I create a separate thread for each player?
I hope my question is clear. Any suggestions would be highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
服务器就应该只是服务器。在这种情况下,它会向客户端更新发生了什么以及接下来会发生什么。
如果是我,我会拥有一个 AIClientPlayer,它会传递给客户端,并在客户端发出信号执行操作时使用您精美的 AI 逻辑执行操作。
A server should just be a server. In this case, it updates the clients as to what happened and what happens next.
If it were me, I would have a AIClientPlayer, which gets passed a client, and acts using your fancy AI logic when the client signals it to act.