游戏编程-如何避免重新发明轮子 [英] Game programming - How to avoid reinventing the wheel

查看:106
本文介绍了游戏编程-如何避免重新发明轮子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

摘要:

我可以编程一个厚 C中使用客户端"游戏,而无需重新发明 ,或者我应该咬一下 项目符号并使用某些库或SDK? 我是中级C程序员,不是 害怕使用指针,数据 结构,内存位置等 它会给我我所需的控制权 做一个伟大的厚客户端"游戏. 但是,我正在考虑避开 高级语言和框架 出于权力和控制,不是 易于使用.

Can I program a "thick client" game in C without reinventing wheels, or should I just bite the bullet and use some library or SDK? I'm a moderate C programmer and am not afraid to work with pointers, data structures, memory locations, etc. if it will give me the control I need to make a great "thick-client" game. However, I'm thinking of eschewing high-level languages & frameworks for the sake of power and control, not ease of use.

我有时会修改2D格斗/平台游戏作为副项目,这很有趣.我主要是Linux服务器端程序员,具有Python,Ruby和PHP的经验.我知道其中某些语言有出色的框架,例如 PyGame .我也知道人们在Air和.NET之类的东西上取得了成功...但是我有一些担忧:

I'm interesting in tinkering with a 2D fighting/platforming game as a side project sometime. I'm primarily a Linux server-side programmer with experience in Python, Ruby and PHP. I know that there are excellent frameworks in some of these languages, like PyGame. I am also aware of the success people have had with stuff like Air and .NET... but I have some concerns:

  • 性能:众所周知,脚本语言运行缓慢.如果我要制作实时游戏,我希望它尽可能快.
  • 巨大的二进制文件:使用.NET之类的框架或Ruby之类的脚本语言通常会导致产生您原本不需要的大型CLR或库.我要制作的游戏将变得既小又简单-我不希望它的CLR比游戏本身还要大!
  • 其他内容:老实说,如果我能更好地围绕自己的代码,我只是不喜欢继承一些大型游戏库的想法.
  • Performance: Scripting languages are notoriously slow. If I'm making a real-time game, I want it to be as snappy as possible.
  • Huge binaries: Using frameworks like .NET or scripting languages like Ruby often result in big CLRs or libraries that you wouldn't otherwise need. The game I want to make will be small and simple--I don't want its CLR to be bigger than the game itself!
  • Extra stuff: Honestly, I just don't like the idea of inheriting some big game library's baggage if I can wrap my head around my own code better.

我问这个问题是因为我知道我很容易患上未发明于这里"综合症.我一直想自己编程,而且我肯定会浪费很多时间.但是,这对我来说非常有效-例如,而不是使用 Rails (一个很大的网站带有ORM和GUI工具箱的项目框架),我使用了一些较小的Ruby工具,例如 rack 续集,它们完美地融合在一起.

I'm asking this question because I know I'm very susceptible to Not Invented Here Syndrome. I always want to program it myself, and I'm sure it wastes a lot of time. However, this works out for me remarkably often--for example, instead of using Rails (a very big web project framework with an ORM and GUI toolkit baked in), I used an array of smaller Ruby tools like rack and sequel that fit together beautifully.

那么,我请您,SO专家.我天真吗?这是我的看法:

So, I turn to you, SO experts. Am I being naive? Here's how I see it:

  • 使用C
    • 缺点
      • 可能会让我讨厌编程
      • 重塑车轮的高风险
      • 花了这么长时间使我失去兴趣的高风险
      • Use C
        • Cons
          • Will probably make me hate programming
          • High risk of reinventing wheels
          • High risk of it taking so long that I lose interest
          • 尝试过是的-大多数A-list游戏都是以C语言完成的(今天仍然如此吗?)
          • 对内存管理,速度,资产管理等的高度控制,我相信自己可以学会处理
          • 没有cru脚
          • 缺点
            • 可交付成果过大的风险
            • 游戏开发的各个方面都依赖于原始库的作者-如果没有我想要的功能,该怎么办?我必须自己对其进行编程,这还不错,但首先会破坏使用高级框架的目的
            • 绩效问题的高风险
            • Cons
              • Risk of oversized deliverable
              • Dependent on original library authors for all facets of game development--what if there isn't a feature I want? I'll have to program it myself, which isn't bad, but partially defeats the purpose of using a high-level framework in the first place
              • High risk of performance issues
              • 大大加快了开发时间
              • 维护起来可能更容易
              • 不要浪费时间重塑常见的范式

              我还可以添加到此列表中吗?这是纯粹的判断电话,还是有人可以帮我达成交易?欢迎提出建议.

              What else can I add to this list? Is it a pure judgment call, or can someone seal the deal for me? Book suggestions welcome.

              推荐答案

              我目前的想法是:

              • 如果您想学习编程,请从基本元素开始向上制作游戏引擎(甚至实现基本数据结构-列表,地图等).我曾经做过一次,虽然这是一次学习经历,但我犯了很多错误,而且我不会第二次这样做.但是,对于学习如何编程以及使事物变得很酷并看到结果的情况,我对此表示很高的评价.

              • If you want to learn to program, start making the game engine from the base elements upwards (even implementing basic data structures - lists, maps, etc). I've done this once, and while it was a learning experience, I made many mistakes, and I wouldn't do this a second time around. However for learning how to program as well as making something cool and seeing results I'd rate this highly.

              如果您想制作一款合适的游戏,请使用所需的任何库并自行设计所有游戏基础结构.这就是我现在正在做的事情,并且我正在使用所有不错的东西,例如STL,ATL/WTL,Boost,SQLite,DirectX等.到目前为止,我已经学到了很多有关中间/游戏逻辑方面的知识代码和设计.

              If you want to make a proper game, use whatever libraries that you want and design all of the game infrastructure yourself. This is what I'm doing now, and I'm using all of the nice things like STL, ATL/WTL, Boost, SQLite, DirectX, etc. So far I've learnt a lot about the middle/game logic aspect of the code and design.

              如果您只想与艺术家和其他人合作制作最终产品,请使用现有引擎之一(OGRE,Irrlicht,Nebula,Torque等),然后添加您的游戏逻辑和艺术.

              If you just want to make a game with artists and other people collaborating to create a finished product, use one of the existing engines (OGRE, Irrlicht, Nebula, Torque, etc) and just add in your game logic and art.

              我所学到的最后一点智慧是,不必担心这里没有发明"综合症.当我意识到其他库(例如STL,Boost,DirectX等)中的开发时间增加了一个数量级(或三个)工时时,远远超过了我在该部分上所能花费的时间游戏/引擎的名称.因此,自己实现这些事情的唯一原因就是想了解它们.

              One final bit of wisdom I've learnt is that don't worry about the Not Invented Here syndrome. As I've come to realise that other libraries (such as STL, Boost, DirectX, etc) have an order of magnitude (or three) more man-hours of development time in them, far more than I could ever spend on that portion of the game/engine. Therefore the only reason to implement these things yourself is if you want to learn about them.

              这篇关于游戏编程-如何避免重新发明轮子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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