我刚刚开始编程,并且用 XNA 做了一些事情。我创建了我的第一个 3D 游戏,类似于《我的世界》。
但很无聊。所以我决定看看网络,因为 msdn 上有一个教程。网站。事实证明,那里的代码仅适用于 XBox,我开始在互联网上查找更有用的东西,直到我遇到有人说 XNA 不支持我正在寻找的东西。
我正在认真考虑购买一本有关 XNA 4.0 的书(我讨厌花几个小时寻找教程),但在这样做之前,我想知道 PC 之间是否可以联网。如果不是,我应该尝试学习什么?
托管 DirectX?
C++ DirectX?
或者其他什么?
I have just started programing and i have done some stuff with XNA. i created my first 3d game similar to minecraft.
but its boring. so i decided to take a look at networking as there was a tutorial on the msdn. website. It turns out that the code there was only for the XBox and i started looking around the Internet to find something more useful until I cam across someone saying that XNA doesn't support what I am looking for.
I am seriously considering buying a book for XNA 4.0 (I hate looking for tutorials for hours) but before I do this, I want to know whether networking is possible between PCs. And if it is not, what should I try to learn?
Managed DirectX?
C++ DirectX?
or something else?
发布评论
评论(2)
XNA 提供对“LIVE”系统的访问 - 如“Xbox LIVE”和“Games for Windows - LIVE”。
在 Xbox 360 上您只能通过 XNA 网络系统。没有其他选择。
另一方面,在 Windows 上,只有与 Microsoft 达成协议,您才能使用 LIVE。因此,如果情况并非如此,您唯一的选择就是在 .NET 框架提供的功能之上实现您自己的网络(XNA 在 .NET 框架上运行)。对于网络游戏,您感兴趣的类位于 System.Net.Sockets 命名空间。
现在您可以打开一个套接字并开始发送数据。但是您可能想使用 UDP - 它具有良好的性能但不可靠 - 所以您可能最好使用像 Lidgren(或 Prix 提到的其他人之一)添加了一个可靠性层和一堆其他好东西。
XNA provides access to the "LIVE" system - as in "Xbox LIVE" and "Games for Windows - LIVE".
On the Xbox 360 you can only go through the XNA networking system. There are no other options.
On Windows, on the other hand, you can only use LIVE if you have an agreement with Microsoft. So if that is not the case, your only option is to implement your own networking on top of what the .NET framework provides (XNA runs on the .NET framework). For networked games the classes you are interested in are in the System.Net.Sockets namespace.
Now you could just open up a socket and start sending data. But you probably want to use UDP - which has good performance but is unreliable - so you're probably best off using a library like Lidgren (or one of the others Prix mentioned) to add a reliability layer and a bunch of other nice stuff.
你提到想找书。如果您决定购买一本书,我建议您购买这本书。
我旁边有 Learning XNA 3.0,它确实帮助我学到了很多东西。这家伙很棒。他的新副本看起来并没有那么不同,但差异足够大,以至于如果您第一次学习 Learning XNA 3.0,您会有点困惑。
...此外,您还可以在此处购买更便宜的产品。
You mention wanting to look for books. I recommend you get this book if you decide to buy one.
I have Learning XNA 3.0 sitting next to me and it really helped teach me a great deal. The guy is great. His new copy doesn't seem THAT different, but different enough such that if you're first learning from Learning XNA 3.0, you'll get a little tripped up.
... also, you can buy it cheaper here.