Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 months ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
我正在考虑使用 Pygame 和 Pyglet 来开发一个小型 2D 射击游戏,在查看了源代码和一些教程后,我选择了 Pyglet。 我对结果非常满意。
Pyglet 立即工作并且使用起来很愉快,并且概念上非常干净。 对我来说,它确实有一种Pythonic的感觉:你可以很快地得到一个简单易读的例子,并且它使用装饰器来处理事件,效果很好。 它也没有强制特定的程序结构,这使我可以轻松地混合 Pymunk 的物理建模(http://code.google.com/p/pymunk/)。
虽然它基于 OpenGL 并且您可以使用这些功能来实现特殊效果,但我在不了解它们的情况下也能做得很好。
它还可以与 py2exe 和 py2app 配合使用,这一点很重要,因为很多人没有安装 Python 解释器。
不利的一面是,由于它较新,因此网络上有关它的信息较少,可供查看的示例游戏也较少。
此外,它与以前的版本相比发生了很大的变化,因此一些教程现在已经过时了(有“新样式事件循环”
和 Sprite 类作为主要添加。)
我建议下载示例(其中包含一个名为 Astraea 的漂亮 Asteroids 克隆)并看看您是否喜欢这种风格。
I was considering both Pygame and Pyglet for a small 2D shooter, and after looking at source code and some tutorials went with Pyglet. I was very happy with the results.
Pyglet worked immediately and was enjoyable to work with, and conceptually very clean. It certainly had a Pythonic feel to me: you could get a straightforward and readable example going very quickly, and it uses decorators to good effect for event handling. It also didn't force a particular program structure, which made it easy for me to mix in the physics modelling of Pymunk (http://code.google.com/p/pymunk/).
While it is based on OpenGL and you can use those features for special effects, I was able to do just fine without any knowledge of them.
It also works well with py2exe and py2app, which is important because a lot of people do not have a Python interpreter installed.
On the downside, there is less information about it on the web because it is newer, as well as fewer sample games to look at.
Also, it changed quite a bit from previous versions, so some of the tutorials which are there are now out of date (there is the "new style event loop"
and the Sprite class as major additions.)
I would recommend downloading the examples (there is a nice Asteroids clone called Astraea included) and seeing if you like the style.
许可证:
库依赖项:
社区:
受众:
我还发现了有关 pyglet-users 邮件的讨论列表:从 pygame+pyopengl 到 pyglet
免责声明:我还没有使用过,只尝试了一些教程;-)
License:
Library dependencies:
Community:
Audience:
I found also this discussion on pyglet-users mailing list: from pygame+pyopengl to pyglet
Disclaimer: I did not use either yet, only tried some tutorials ;-)
如果您从不打算在游戏本身中绘制任何矢量图形或基元,而只是坚持从磁盘加载图像,那么 Pyglet 就很好(对于 2D 游戏)。 它也更干净,因为不需要编写自己的游戏循环,也不必担心速度、时间和响应能力。
然而,如果您必须动态生成图形,然后将它们保存为变量或文件,那么 pyglet 就会变得相当复杂,因为您必须开始处理低级 OpenGL 函数。 在这些场景中,pygame 凭借其软件渲染和 Surface 类更加用户友好。 或者您可以使用 Python 成像库并将其与 pyglet 连接。
显然,对于 3D 游戏,无论如何你都必须使用 OpenGL 函数,在这种情况下,我推荐 pyglet 而不是 pygame + PyOpenGL。
Pyglet is good (for 2D games) if you never intend to draw any vector graphics or primitives within the game itself, and just stick to loading images from disk. It's also much cleaner because there's no need to write your own game loop and have to worry about speed and timing and responsiveness.
However, if you ever have to generate graphics on-the-fly, and then save them, either as a variable or as a file, then pyglet becomes considerably more complicated because you start having to muck around with the low-level OpenGL functions. In those scenarios, pygame is much more user-friendly, with its software rendering and Surface class. Or you could use Python Imaging Library and interface it with pyglet.
Obviously, for 3D games, you are going to have to muck around with OpenGL functions anyway, in which case I recommend pyglet over pygame + PyOpenGL.
我想补充一点,有一个快速的精灵库 Rabbyt 它可能是 Pyglet 的一个很好的补充。
I would like to add that there is a fast sprite library Rabbyt which may be a good complement for Pyglet.
在查看了 pygame 和 pyglet 后,我发现 pyglet 更容易上手,并且能够在几天内编写一个简单的突破式游戏。
Having looked at both pygame and pyglet I found pyglet easier to pick up and was able to write a simple breakout style game within a few days.