XNA 3.1 与 SDL
我已经尝试过这两种方法,尽管 XNA 3.1 更吸引我,因为它可以轻松地输出代码,而不必担心内存和垃圾清理以及所有的细节问题。您可以编写代码中有趣的部分(如果存在的话:D)。然而,XNA 限制了我,因为我无法将我用它编写的任何内容移植到 Linux 或 Mac OSX,即使如此,它也使得想要玩我的游戏的人必须下载 .NET 3.5 Redistributable 和 XNA 3.1 Redistributable,这是不应该发生的。我应该能够只放一些 DLL,而不是让我的玩家上网下载东西。即使这样,随着时间的推移,代码仍然会变得一团糟,因为 XNA 的“一个文件适合你的游戏”默认策略。
你认为哪个更胜一筹?
I've tried out both and although XNA 3.1 attracts me more because of the ease of being able to just spew code out and not having to worry about memory and garbage clean up and all the nitty gritty crap. You get to write the fun part of the code (if thats even existant :D). However XNA restricts me because I cannot port anything I write with it to Linux or Mac OSX, and even then it makes people who want to play my games have to download .NET 3.5 Redistributable and XNA 3.1 Redistributable which should just not happen. I should be able to just have some DLLs in there as opposed to making my gamers go online and download stuff. Even then there is still the fact that the code will become an absolute mess over time because of the whole "one file for your game" default policy with XNA.
Which do you think is superior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
实际上,这将取决于您使用 C++ 的经验水平,以及您是否确实认为无法移植代码是一个大问题。至于内存管理的东西...
当您使用 C++0x 标准中的一些新功能(例如 shared_ptr 和 unique_ptr、lambda 等)时,SDL 会变得更加容易。甚至 SDL 中需要原始指针的内容也是可行的,因为您只需使用 .get()功能在您的智能指针上,您的生活变得更加轻松。
简而言之:擅长 C++,如果您真的有兴趣将游戏轻松移植到其他系统,那么我会选择 SDL。如果您只真正了解 C# 并涉足 C++,并且仅在 Windows 和 Xbox 上运行游戏并不是什么大问题,那么一定要选择 XNA。
Really this is going to depend on your level of experience with C++ and if you really see not being able to port your code as a big problem. As for the memory management stuff...
SDL gets a lot easier when you use some of the new features in the C++0x standard such as shared_ptr and unique_ptr, lambdas etc. Even the things in the SDL that require raw pointers are doable as you just use the .get() function on your smart pointer and your life is much easier.
In short: Good at C++ and if you are really interested in easily porting your game to other Systems then I would go for SDL. If you only really know C# and dabble in C++ and it's not a huge deal to only have your game on Windows and Xbox then definitely go for XNA.
我个人更喜欢XNA。无论个人偏见如何,微软都知道如何制作一些相当卑鄙的软件开发工具。 XNA 非常无缝,尽管有其局限性,但仍然是一次美妙的体验。虽然缺乏可移植性令人沮丧,但至少你可以把它放在 xbox 上:)
“你的游戏一个文件”政策是什么意思?您可以像任何其他 VS 项目一样创建。
I personally prefer XNA. Regardless of personal bias, Microsoft knows how to make some pretty mean software dev tools. XNA is very seamless, and despite its limitations is a wonderful experience. Although the lack of portability is frustrating, at least you can put it on the xbox :)
What do you mean 'one file for your game' policy? You can create just like any other VS project.
从个人经验来看,XNA 相差甚远。能够——用你的话来说——“只是吐出代码”并快速地将东西组合在一起,这对游戏开发来说是一个巨大好处。
显然,我并不提倡将所有代码都“吐出”出来。但 C# 和 XNA 的好处在于,它们为您提供了选项,让您可以不那么小心地编写代码 - 然后您可以在适当的地方进行练习。
使用 C++ 和 SDL,您被迫“仔细”编写绝大多数代码。 (更不用说您会在某些时候犯错这一事实,而C++对此更加无情。)
您提到的一些问题(“游戏的一个文件”,需要.NET 3.5 可再发行版)实际上并不是 XNA 的问题 - 正如 Veered 和我自己在评论中所讨论的那样。此外,如果您使用 ClickOnce 分发游戏,那么它将为您处理 XNA 和 .NET Framework 的必要下载和安装。
如果您已经确定需要移植到 Linux 和 Mac,那么我仍然主张使用 C#(通过 Mono)作为开发语言 - 即使您必须在这些平台上使用 XNA 以外的语言。
XNA 和 C# 还有许多其他优点 - 相当快的编译时间、内容管道、Microsoft 的支持/更新、轻松移植到 Xbox 360 和 Windows Phone、编写良好的示例库, ETC。
From personal experience, far and away XNA. Being able to - to use your phrase - "just spew code out" and rapidly throw things together is a huge benefit in game development.
Obviously I do not advocate that all code is "spewed" out. But the nice thing about C# and XNA is that they give you the option to be less careful about how you code - which you can then exercise in places where it is appropriate.
With C++ and SDL you are forced to write the vast majority of your code "carefully". (Not to mention the fact that you will get it wrong at some point, and C++ is so much more unforgiving about this.)
Some of the problems you mention ("one file for your game", requring a .NET 3.5 redistributable) are not actually problems with XNA - as discussed by Veered and myself in comments. Also, if you use ClickOnce to distribute your games, then it will handle the necessary download and installation of XNA and the .NET Framework for you.
If you have identified a need to port to Linux and Mac, then I would still advocate using C# (via Mono) as a development language - even if you have to use something other than XNA on those platforms.
And there are a bunch of other nice things about XNA and C# - the considerably faster compile times, the content pipeline, the support/updates from Microsoft, the ease of porting to Xbox 360 and Windows Phone, the library of well-written examples, etc.
我投票给 XNA。
实际上,我是使用 SDL 开始游戏的。 NET + C#(涵盖您所描述的内存管理,同时保持 SDL 的真实性)一段时间后又开始学习 C#。因此,如果您确实喜欢 .Net 的好处,您可以检查一下。然而,当我发现 XNA 并尝试了一些小型测试游戏后,我决定将我的工作移植到 XNA 是值得的(因为无论如何我并不关心跨平台)。
我确实理解您所说的“单文件方法”的意思。尽管正如其他人提到的,这不是实际的最终结果,只是它呈现的方式就像“嘿,看看一切是多么容易,更新并绘制现在你有一个小家伙走来走去,从他的眼睛里射出火球!” XNA 中的东西感觉比 SDL 更加结构化,如果您愿意的话,可以更方便地掌握。 XNA 易于掌握并完成需要完成的工作,让您良好的编码实践在此过程中发挥作用。
My vote is for XNA.
I actually began my game using SDL.NET + C# (which covers the memory management that you described, while staying true to SDL) awhile back to learn C#. So if you do indeed like the perks of .Net you could check into that. However, once I discovered XNA and messed around with a few small test games I decided that porting my work over to XNA would be worth it (as I didn't care for cross platform anyhow).
I do understand what you mean when you say the 'one file approach'. Although as others mentioned, this isn't the actual end result, just the way it is presented to be like 'Hey look how easy everything is, update and draw now you got a little guy walkin around shooting fireballs out of his eyes!' Things in XNA feel much more structured than SDL, more hand holding if you will. XNA is easy to pick up and to get done what needs to get done, letting your good coding practices fall into play along the way.