在游戏开发中使用杂波
我是一个相对较新的开发人员,我希望学习 C++。我有使用 java、javascript、actionscript 和 python 进行编码的经验,但我想要足够快的速度来执行一些高性能 2D 和 3D 游戏。
当我最终学习基础知识(控制结构、类等)时,我想开发一个 2D 游戏。我探索了各种 2D 图形库(cairo、sdl、openframeworks、clutter),但 clutter 似乎对于加速图形和矢量绘图来说是最优化的。
混乱是否适合 2D 游戏?我意识到它与其他库不同,它维护自己的场景图,但我过去开发过一个 Flash 游戏,所以我应该习惯这一点。
有什么我应该注意的性能问题吗?有没有其他人有过处理杂乱的繁重图形的经验?
I'm a relatively new developer, and I'm looking to learn C++. I've had experience coding in java, javascript, actionscript, and python, but I want something fast enough to do some high performance 2D and 3D games.
When I eventually learn the basics (control structures, classes, etc) I'd like to develop a 2D game. I've explored various libraries for 2D graphics (cairo, sdl, openframeworks, clutter) but clutter seemed to be the most optimised for accelerated graphics and vector drawing.
Would clutter be a good fit for a 2D game? I realise that it maintains its own scenegraph unlike other libraries, but I've developed a flash game in the past, so I should be used to that.
Are there any performance issues I should be aware of? Has anyone else had experience doing heavy graphics with clutter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经使用 Clutter 完成了很多嵌入式系统工作,现在正在用它做一个桌面项目。对于基于桌面的 2D 游戏来说,它可能会很棒,但有一些注意事项:
也就是说,你可以用它做一些令人惊奇的事情。我真的很喜欢使用它,一旦你了解了如何做,与 C++ 的混合和匹配就会很有趣。
此外,还有一个名为 GUADEC 的非常摇滚的开源会议,Clutter 的人们都在那里聚会。如果您于 2011 年 7 月带着一款非常有趣的基于 Clutter 的游戏出现在柏林,人们会给您买很多饮料。
I've done a lot of embedded systems work using Clutter, and am now doing a desktop project with it. It would probably be great for a desktop-based 2D game, with certain caveats:
That said, you can do amazing things with it. I really enjoy working with it, and once you understand how to do it, mixing-and-matching with C++ is a lot of fun.
Also, there's a really rockin' open-source conference called GUADEC where the Clutter folks hang. If you were to show up there in July 2011 in Berlin with a really fun Clutter-based game, people would buy you lots of drinks.
我必须承认我以前从未听说过 Clutter,可能是因为它不是 Windows 库,而且大多数游戏开发人员都在 Windows 平台上工作。同样,大多数游戏开发者(甚至独立/业余爱好者)也不会考虑 Cairo 或 Openframeworks。到目前为止,更常见的是使用 SDL,尽管它没有完全硬件加速,因此对于现代游戏来说不是一个好的选择。 SFML 是一种越来越受欢迎的替代方案,但现在大多数游戏开发者可能都在推出自己的替代方案OpenGL 渲染位于 SDL 等之上。
从外观上看,Clutter可能是一个不错的选择,而且它看起来功能齐全。但有时较大框架的问题是它们变得有点像围墙花园,很难集成您可能需要的额外部分 - 例如,我不知道输入的效果如何。
使用不太知名的引擎的另一个问题是,如果您访问 https://gamedev.stackexchange.com/ 或 < a href="http://www.gamedev.net" rel="nofollow noreferrer">http://www.gamedev.net 并提出问题,社区将无法提供那么多帮助,因为他们不熟悉您正在使用的技术。您必须在成本与使用不受欢迎但实际上非常有能力的库所带来的潜在收益之间进行权衡。 (以及这些其他人知道你不知道的事情的可能性......)
I must admit I've never heard of Clutter before, probably because it's not a Windows library and the majority of games developers work on Windows platforms. Similarly, most game developers (even indie/hobbyist ones) are not considering Cairo, or Openframeworks either. More common by far would be the use of SDL, although that is not fully hardware accelerated and thus not a good choice for modern games. SFML is an alternative that is growing in popularity, but most game developers these days are probably rolling their own OpenGL rendering on top of something like SDL.
By the looks of it, Clutter might be a good choice, and it certainly seems fully-featured. But sometimes the problem with the larger frameworks is that they become a bit of a walled garden and it's hard to integrate extra bits that you might need - for example, I don't know how well the input might work.
The other problem with using a less well-known engine is that if you go to https://gamedev.stackexchange.com/ or http://www.gamedev.net and ask questions, the community won't be able to help as much since they are not familiar with the technology you're using. You have to balance the cost of that against the potential gains that come from using an unpopular but actually very competent library. (As well as the possibility that these other guys know something you don't...)
Clutter 相对较新,目前使用它的应用程序并不多。尤其是游戏。因此,您将很难找到有游戏经验的人。
也就是说,杂乱确实有一些有趣的功能,使其看起来引人注目,我什至声称,对于许多类型的游戏,内部场景图甚至可以成为游戏开发人员的优势。
我想向您推荐另一个有趣的 2D 游戏图形选择:诺基亚的 Qt。
虽然它主要是一个通用 GUI 工具包,但它所占的比例并不是每个游戏开发人员都会首先意识到的地方。事实上,它有一个成熟的 OpenGL 绘图后端,可用于绘制任何小部件,并使用任何 Qt 的画布绘制操作。
一旦您开始明确使用 QGLWidget,事情就会变得疯狂,它不仅强制执行 GL 绘图模式(这不是默认模式),而且还允许您在同一上下文中将自己的 GL 绘图与 Qt 的绘图操作混合。您不仅可以使用简单易用的高级绘图操作以及强大的事件队列和高效的输入处理,还可以使用它们。此外,您可以在未来自由地构建更高级、低级的图形。
请参阅此示例。请注意,您可以将本机 GL 绘图与 Qt 的 Painter 功能自由混合(如果您处理 GL 矩阵堆栈)。
Clutter is relatively new and there are not many applications that use it right now. Especially games. So you will have a hard time finding somebody who has experience with it for gaming purposes.
That said, clutter indeed has some interesting features that make it look compelling for the purpose, and I would even claim that for many types of gameplay the internal scene graph can even be an advantage to the game developer.
I would like to propose you another interesting option for 2D game graphics: Qt from Nokia.
While it is primarily a general-purpose GUI toolkit, it has nice proportions not every game developer would be aware of in first place. In fact, it has a fully-fledged OpenGL drawing backend which can be used to draw any widget, and to use any of Qt's canvas drawing operations.
Things go crazy as soon as you start to explicitely using a QGLWidget, which not only enforces GL drawing mode (which is not the default), but also allows you to mix your own GL drawings with Qt's drawing operations in the same context. You gain the possibility to not only use simple-to-use, high level drawing operations paired with a powerful event queue and efficient input handling; furthermore you keep the freedom to build-in more advanced, low level graphics in the future.
See this example. Note that you can mix native GL drawing freely with Qt's Painter functionality (if you take care of the GL matrix stack).