C ++游戏编程 - 爱或不信任? [英] C++ for Game Programming - Love or Distrust?

查看:123
本文介绍了C ++游戏编程 - 爱或不信任?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了提高游戏编程的效率,一些程序员不信任多个C ++特性。我的一个朋友声称了解游戏行业的工作原理,并会提出以下评论:

In the name of efficiency in game programming, some programmers do not trust several C++ features. One of my friends claims to understand how game industry works, and would come up with the following remarks:


  • 不要使用智能指针。

这些陈述中有多少是真实的? C ++功能已经设计保持效率。这种效率是否不足以进行游戏编程? 97%的游戏编程?

How much of these statements are true? C++ features have been designed keeping efficiency in mind. Is that efficiency not sufficient for game programming? For 97% of game programming?

C方式的思维似乎对游戏开发社区有很好的掌握。这是真的吗?

The C-way-of-thinking still seems to have a good grasp on the game development community. Is this true?

我在GDC 2009中观看了关于多核编程的谈论的另一个视频。他的演讲几乎完全面向单元编程,需要DMA传输在处理之前(简单指针访问将不能与Cell的SPE一起使用)。他不鼓励使用多态性,因为指针必须重新用于DMA传输。多么悲伤。这就像回到广场一。我不知道是否有一个优雅的解决方案来编程C ++多态性在Cell上。 DMA传输的主题是深奥的,我在这里没有太多的背景。

I watched another video of a talk on multi-core programming in GDC 2009. His talk was almost exclusively oriented towards Cell Programming, where DMA transfer is needed before processing (simple pointer access won't work with the SPE of Cell). He discouraged the use of polymorphism as the pointer has to be "re-based" for DMA transfer. How sad. It is like going back to the square one. I don't know if there is an elegant solution to program C++ polymorphism on the Cell. The topic of DMA transfer is esoteric and I do not have much background here.

我同意C ++对于想要一个小语言的程序员来说也不是很好,而不是读堆栈的书。模板也吓到了地狱的调试。

I agree that C++ has also not been very nice to programmers who want a small language to hack with, and not read stacks of books. Templates have also scared the hell out of debugging. Do you agree that C++ is too much feared by the gaming community?

推荐答案

看看,大多数你听到的一切任何人说编程的效率是神奇的思维和迷信。智能指针确实有性能成本;特别是如果你在内部循环中做了很多花哨的指针操作,它可能会有所不同。

Look, most everything you hear anyone say about efficiency in programming is magical thinking and superstition. Smart pointers do have a performance cost; especially if you're doing a lot of fancy pointer manipulations in an inner loop, it could make a difference.

也许。

但是当人们说这样的事情时,通常是一个人很久以前告诉他,X是真的,没有什么,但直觉背后的结果。现在,单元格/多态性问题听起来似乎真实 - 我敢打赌,这是对第一个说的人。但我还没有验证它。

But when people say things like that, it's usually the result of someone who told them long ago that X was true, without anything but intuition behind it. Now, the Cell/polymorphism issue sounds plausible — and I bet it did to the first guy who said it. But I haven't verified it.

你会听到关于C ++对操作系统的相同的事情:它太慢,它做你想要的东西做得不错。

You'll hear the very same things said about C++ for operating systems: that it is too slow, that it does things you want to do well, badly.

无论如何,我们完全在C ++中构建OS / 400(从v3r6 forward),裸机开启,并得到一个代码库是快速,高效,小。它需要一些工作;特别是从裸机工作,有一些引导问题,使用放置新的,那种东西。

None the less we built OS/400 (from v3r6 forward) entirely in C++, bare-metal on up, and got a code base that was fast, efficient, and small. It took some work; especially working from bare metal, there are some bootstrapping issues, use of placement new, that kind of thing.

C ++可能是一个问题,只是因为它太大了:I 现在重新阅读Stroustrup的护腕,这是非常吓人。但我不认为有什么内在的,说你不能在游戏编程中有效地使用C ++。

C++ can be a problem just because it's too damn big: I'm rereading Stroustrup's wristbreaker right now, and it's pretty intimidating. But I don't think there's anything inherent that says you can't use C++ in an effective way in game programming.

这篇关于C ++游戏编程 - 爱或不信任?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆