有没有办法在进行 XNA 开发时验证代码是否可以在 360 上运行?
我正在 XNA 上开发一款休闲游戏,打算部署到 Xbox 360。我几周内无法使用硬件,而且截止日期很紧,所以我想测试一下有一些东西(Boo 和一些自定义库)可以在 360 上正常工作。如果不能,我需要尽快解决它们,因此测试这一点非常重要。
有了这个解释,有没有一种方法可以让我在实际部署到 360 之前进入某种“模拟器”,在 .NET Compact Framework for 360 上运行代码?
I'm working on a casual game on XNA with the intention of deploying to the Xbox 360. I'm not going to have access to hardware for a few weeks and I'm on a tight deadline, so I'd like to test that a few things -- Boo and a few custom libraries -- will work properly on the 360. If they don't, I need to work around them sooner rather than later, so testing this is quite important.
With that explained, is there a way I can go into a 'simulator' of sorts to run code on the .NET Compact Framework for 360 before actually deploying to the 360?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
好吧,您可以尝试为 Windows 智能手机编写一个快速应用程序,并在模拟器中运行它。 显然,这不适用于 XNA 特定代码; 但对于 Boo 或您在模拟器上使用的任何运行时库,它们应该在 Xbox 上运行。
对于您自己编写的 XNA 代码,只需针对 Xbox 360 目标进行编译即可。
Well, you could try writing a quick app for a Windows Smartphone, and run it in an emulator. Obviously, this won't work for XNA specific code; but for any runtime libraries that Boo or whatever you're using work on the emulator, they should work on the Xbox.
For the XNA code you write yourself, just compile it against the Xbox 360 target.
正如创伤小马所说。 只需将主游戏程序集加载到 Visual Studio 中并尝试编译它即可。 如果您尝试引用 360 附带的程序集之外的程序集,则不会。
As TraumaPony said. Simply load the main game assembly in to Visual Studio and try to compile it. It won't if you try to make a reference to an assembly outside the those that ship with the 360.
除了确保库编译到 360 上之外,您还需要考虑项目的对象分配配置文件。 由于紧凑框架使用不同的垃圾收集器,因此它对常量分配更加敏感。 当它进行收集时,它需要遍历整个对象图,而不是桌面收集器使用代的方式。 因此,您需要确保在运行时新建尽可能少的对象:-)
Aside from making sure that the libraries compile onto the 360, you will need to think about your project's object allocation profile. Since the compact framework uses a different garbage collector, it's much more sensitive to constant allocations. When it does a collection, it needs to walk the entire object graph instead of how the desktop collector uses generations. So you will want to make sure that you're newing up as few objects as possible during runtime :-)
这里的关键是要了解只有 .Net 代码才能在 Xbox 360 上运行,因此您想要使用的任何自定义库必须是 .Net 程序集。 第二件需要了解的事情是 Xbox 正在运行紧凑框架,因此任何未包含在其中的内容都将无法工作。 通过像上面的帖子一样编译 360 的项目来测试这一点很容易。
老实说,我快速浏览了 Boo,并无法分辨出它内置了什么,所以我不确定它是否能工作。 我也不明白在 XNA 内部使用 Boo 的意义,但这不是您真正要问的。
The key thing here is to understand that only .Net code will run on the Xbox 360, so any custom library you want to use must be a .Net assembly. The second thing to understand is that the Xbox is running the compact framework, so anything that isn't included in that won't work. This is easy enough to test against by compiling the project for the 360 like the above post.
To be honest, I took a quick look at Boo, and couldn't tell what it was built in, so I'm not sure if it will work. I also don't understand the point of using Boo inside of XNA, but that's not what you're really asking.