Geeks With Blogs
Jeff Ferguson Irritating other people since 1967

I have, for quite a while now, used virtualization technology for all of my development. Multiple versions of installed tools, beta development kits and specialized setups have made the maintenance of a single machine too complex to support everything needed for every project. It has been much easier to create a virtual machine for a project, install whatever is needed, work on it, and tear it down at the end. If an installation fails, or if CTP software has destabilized an operating system. then all that is needed is a rebuild of a virtual machine rather than an entire physical machine, which invariably has non-developer tools such as Office that would have to be reinstalled.

I have, up to this point, used Microsoft's Virtual PC 2007 for this work. It's available free-of-charge, it's clean, it's simple and it does its job well. I recently became interested in diving into some development with XNA 2.0, where I discovered a flaw with Virtual PC 2007: it's lack of support for Direct3D.

I have a laptop loaded 64-bit Vista Business, and, for my XNA 2.0 development, I created a virtual machine with Virtual PC 2007 that used Windows XP as its operating system. I loaded Visual Studio 2005 and XNA 2.0 and stared working with the tutorials, only to find that the "MyFirstGame" tutorial would not run. The XNA 2.0 engine threw an exception of type NoSuitableGraphicsDeviceException whenever I tried to run the sample code. As I dug into the issue, I discovered two things:

  • XNA 2.0 applications require an environment that supports Direct 3D.
  • The video driver emulated by Virtual PC 2007 does not support Direct 3D.

So much for Virtual PC 2007, at least for XNA 2.0 development.

I have had much better luck with VMWare Workstation 6.5, whose video subsystem does indeed support Direct 3D. The same code that was throwing the exception in my Virtual PC 2007 machine was running with no problems on my VMWare Workstation machine, and all is well.

I did have a bit of a hiccup, at least initially, with VMWare Workstation's networking support. I got it solved, but wanted to discuss the issue here for the benefit of anyone else running into the same problem. It is of special importants to anyone using XNA 2.0 to develop games for the Xbox 360. The issue is that you must run your XNA 2.0 virtual machine in VMWare Workstation's Bridged Networking mode. This is important for XNA 2.0 development, as your virtual machine and your Xbox 360 have to be on the same subnet if you want to create Xbox 360 games and move them to your 360. VMWare Workstaton's NAT Networking mode will put your virtual machine on a different subnet, which will prevent the virtual machine from connecting to your Xbox 360.

At first, I got NAT Networking to work, but not Bridged networking. With NAT Networking, my virtual machine could connect to the Internet, ping servers, and call up Web pages. With Bridged networking, I couldn't even get a DNS name resolution request to work. NAT worked well, until I tried to connect to my Xbox 360. Nothing worked, since, through NAT, my virtual machine was on a different subnet than my Xbox 360. Since the whole point of this exercise was to connect to my 360, I really needed Bridged networking to work.

After some research, I discovered VMWare's Virtual Network Editor, which maps virtual VMWare network adapters (which have names like VMnet0 and VMnet1) to physical network adapters on the host machine. By default, the virtual adapter VMnet0, which is use for VMWare's Bridged networking connection, is set to use the first physical adapter it can find. On my Vista host, the first available physical adapter is the Microsoft Loopback Adapter, which obviously is not going to provide an actual networking connection. I had to use the Virtual Network Editor to bind VMnet0 to the adapter to my physcal network card, and, once I did that, everything was fine, and I could connect to my Xbox 360 as well as browse the Internet from my virtual machine. The moral of the story is this: if you're having problems with VMWare Workstation virtual machines connecting to anything using Bridged Mode, consider using VMWare's Virtual Network Editor to bind VMnet0 to a specific adapter, instead of letting it pick whichever one it wants. The adapter it picks may not be valid.

Posted on Sunday, October 12, 2008 9:23 AM | Back to top

Comments on this post: Virtualization and XNA Development

# re: Virtualization and XNA Development
Requesting Gravatar...
Thanks a ton, Even though this is somewhat old, I was having a similar issue with connecting Visual Studio .NET 2003 to an XDK Original Xbox, Was using VMWare to run XP on a Vista x64, after countless hours messing with the network features, I started searching online and found this. I somehow managed to do everything but switch the VMnet0 bridge connecter, I felt like an idiot. Atleast you know that you helped one person with this ;).
Left by Markus G. on Mar 04, 2009 3:23 PM

# re: Virtualization and XNA Development
Requesting Gravatar...
I love what I do...
Left by jose apa on Mar 17, 2009 12:36 AM

# re: Virtualization and XNA Development
Requesting Gravatar...
Thanks Jeff!

I am hoping this will solve my problem trying to connect my Xbox 360 to my Windows 7 virtual machine on my mac. I am using parallels, but I am hoping they offer a similar solution. I'll let you know what happens.
Left by Nathan on Nov 12, 2010 10:48 AM

Your comment:
 (will show your gravatar)

Copyright © Jeff Ferguson | Powered by: