Pygame 的网络支持

发布于 2024-07-30 20:52:31 字数 148 浏览 13 评论 0原文

我正在 pygame 中制作一个简单的多人经济游戏。 它由一定长度的轮组成,在轮的末端,数据被发送到中央服务器。 对数据进行一些快速计算,并将结果发送回玩家。 我的问题是我应该如何实现网络支持。 我一直在关注 Twisted 和 Pyro,如有任何建议或建议,我将不胜感激。

I am making a simple multiplayer economic game in pygame. It consists of turns of a certain length, at the end of which, data is sent to the central server. A few quick calculations are done on the data and the results are sent back to the players. My question is how I should implement the network support. I was looking at Twisted and at Pyro and any suggestions or advice would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

淡忘如思 2024-08-06 20:52:35

pygame.org 网站上有许多专门为与 PyGame 良好配合而定制的即插即用库。

其中包括 PodSixNet、PygLibs.net 和我自己的 Mastermind(冒着自我夸大的风险,轻量级、易于使用,并附带一个简单的教程)。

There are a number of plug-and-play libraries tailored specifically to work nicely with PyGame on the pygame.org website.

These include PodSixNet, PygLibs.net, and my own Mastermind (which is, at the risk of self-aggrandizement, lightweight, easy to use, and comes with a simple tutorial).

韵柒 2024-08-06 20:52:35

我并不反对 Twisted 和 PyRo,但是您要发送的那种简单消息不需要类似的东西,并且使用某种框架可能会变得过于复杂。 Pickle 一个对象并通过套接字发送它实际上是一个非常简单的操作,非常值得尝试,即使您最终使用更重量级的框架。 不要害怕网络!

I've nothing against Twisted and PyRo, but the sort of simple messages you're going to be sending don't require anything like that and might be overcomplicated by using some sort of framework. Pickling an object and sending it over a socket is actually a very easy operation and well worth trying, even if you do eventually go with a more heavyweight framework. Don't fear the network!

双手揣兜 2024-08-06 20:52:33

扭曲肯定是个好主意。 这里是集成twisted和pygame的示例代码。

Twisted would certainly be a good idea. Here is example code that integrates twisted and pygame.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文