Is there a virtual pc which will run 3D games?

Just Another Guy

Distinguished
Mar 10, 2012
123
0
18,690
I can't seem to find much, but I'd like something where I'd be able to run games within the environment.

My reasoning is this - I'm getting to grips with the cheat engine, and I've been messing around in starforge. However, it's extremely irritating if I crash it, as I've got to start from scratch again.
I've looked into saving the states of running programs, but that weirdly seems to be impossible, so the next thing to try is run it through a virtual pc, as you can save the state of them.

I tried the windows one, but the game crashed on startup (wouldn't let me install the nvidia graphics drivers), and from what I've gathered, a lot of them do. Is there any which would run quite demanding games? (as in I have a quad core and this game uses 50% of processing and is graphics heavy too)
 
Solution
No free virtualization tools are going to allow you that kind of access to the GPU. There are some paid enterprise virtualization tools that might let you do that, eg. I think there is a product by Citrix that does include a feature called GPU passthrough that allows the VM direct access to the graphics card. Nvidia is working on something called VGX which allows for VMs to directly access a part or all of a GPU to do things like 3D graphics rendering, but it requires expensive specialized hardware, and is also aimed solely at enterprise users, and I'm not sure it's even out yet.

For the moment I think you are out of luck. If you want to run games, you're just going to have to do it in the native OS, unless you want to splash out big...

mbreslin1954

Distinguished
Virtual machines cannot get direct access to the video card, as that could deprive the host operating system of access. Someone has to be in control of the hardware, such as the video card, and that is the host operating system on which the virtual machine runs. In order to do 3D graphics, that program (game) and its operating system needs to control the card.
 
No free virtualization tools are going to allow you that kind of access to the GPU. There are some paid enterprise virtualization tools that might let you do that, eg. I think there is a product by Citrix that does include a feature called GPU passthrough that allows the VM direct access to the graphics card. Nvidia is working on something called VGX which allows for VMs to directly access a part or all of a GPU to do things like 3D graphics rendering, but it requires expensive specialized hardware, and is also aimed solely at enterprise users, and I'm not sure it's even out yet.

For the moment I think you are out of luck. If you want to run games, you're just going to have to do it in the native OS, unless you want to splash out big money for proprietary solutions that weren't designed with gaming in mind.
 
Solution

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710
Yes you can run games in a Windows VM !!! The technology to do this is called "VGA passthrough". Both Xen and KVM provide VGA passthrough, but you need to have Linux running as host OS, have a second graphics adapter, and your hardware must support VT-d (Intel) or AMD-V (AMD). Here are some guides on how to accomplish that:
http://www.overclock.net/t/1205216/guide-create-a-gaming-virtual-machine
http://forums.linuxmint.com/viewtopic.php?f=42&t=112013
https://bbs.archlinux.org/viewtopic.php?id=162768
 

Actually, that is incorrect. Most virtualization software nowadays allows access to hardware acceleration of the graphics card in Windows. VirtualBox, which runs on Windows, Linux, FreeBSD, whatever, is a good example.

I've never actually tried this, so how fast this is compared to native access I cannot say. Most people who are playing games want the ultimate performance that they can get from their computer; this is always going to mean a single, real install rather than a VM.
 

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710


You are correct that there are ways to access hardware acceleration. However, I do believe that using Xen or perhaps KVM with VGA passthrough gives gamers "bare metal" performance. At least my Windows VM under Xen does compare very well with bare metal Windows installations.

Here the 3D PassMark results for my Nvidia Quadro 2000 graphics card:
Windows VM on Xen with VGA passthrough - 1369
Average PassMark value for this graphics card - 1293

Here are the full Passmark results for my Windows VM on Xen: http://
 
The reason I say that a native install is always going to be better is not so much because of passthrough but because, inevitably, there will always be some resources - in particular memory - used by the host OS. So the ultimate performance is always going to come from a native install. But, for the OP's particular requirements, an install in any modern VM software should do the job (assuming that his CPU has the correct support and doesn't have to resort to emulation).

But Microsoft Virtual PC (which I assume is what he has tried) doesn't fall into the category of "modern VM software".
 

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710


1. A native install is not necessarily better than a VM. Yes, the host OS needs some resources, but if you use a modern 4, 6, or 8 core processor the difference to bare metal is neglectible. Xen for example employs some scheduling mechanism that gives the guest what it needs, up to the maximum number of VCPUs you specify. I've run DVD ripping under Linux while converting several hundred RAW photos with lots of edits, denoising, etc. in Lightroom on the Windows VM and both tasks performed incredibly fast. My Windows guest gets 10 VCPUs, my Linux host 2 VCPUs (using a 6-core i7 3930K CPU). Since Windows/Lightroom wasn't able to utilize the CPU resources, about 50% of all CPU resources went to Linux and DVD ripping. This test was actually the only way I could really make my CPU "sweat".

The most important criteria for gamers is GPU power. Since Xen or KVM can provide VGA passthrough, you get a dedicated graphics card for the Windows guest using the vendors own graphics driver under Windows - no emulation!

Memory is cheap nowadays. I have 32GB RAM and gave 28GB to Windows and 4GB to Linux. Under Linux I run all /temp etc folders in memory. Actually 2G would have been sufficient for Linux, if it weren't for my using Audacity that can really take up lots of RAM. So, 2GB are fine for Linux, 4GB are plenty, and only if you run special software that uses lots of RAM you may want to give it more. As for Windows (7 or 8), 4GB are pretty baseline, more is better. For gaming 6-8GB should be enough, though. Performance-wise the Windows VM doesn't take a noticable hit on memory speed.

Disk I/O: I use LVM for both Linux and Windows. Yes, my Windows VM runs on a LVM volume. To me this is the greatest thing since sliced bread. I can easily backup my entire Windows VM into a compressed image file. The backup process for a 70GB Windows image takes 7 minutes, to restore it takes 5 minutes. Note that I backup the entire image, not the files. I keep several backups, including a "golden copy", to be on the save side. Restoring the Windows VM from a backup couldn't be easier.
LVM supports snapshots. So while you run your Windows VM, you can take a snapshot copy and back it up. If Windows crashes, you can restore that snapshot. Important: It's best to make a backup copy of Windows while it isn't running, so you have a good copy of the Windows installation and all software while Windows isn't actually booted. This copy should be kept in a save place, just in case.
I believe the OP was looking for such a snapshot feature.

As for disk speed, I am very happy with the speed I get in the Windows VM. I use a SDD for the Windows "C:\" volume, and striped LVM drives for data. I could also use RAID together with LVM, but striped drives give me similar performance to RAID0, and LVM is more flexible than RAID. You can see in the Passmark results that I posted that my disk performance for the Windows VM compare well with bare metal performance (it looks identical).

I've been dual-booting Windows/Linux before, but my current Xen setup beats dual-booting a thousand times. It's so much more convenient. I do actually use both Linux and Windows simultanously. For example my entire CD collection resides on a Linux ext4 drive and I play music while editing photos under Windows and Lightroom etc. Actually everything except photo editing is done under Linux, and I can switch between both in an instance.

To sum it up: Using the right virtualization technology (currently this is Xen and KVM - both free and open source - and maybe VMware for enough $$$) you can get bare-metal like performance in a VM, and you can passthrough one or two graphics cards to the Windows guest for a virtual high performance Windows gaming VM. You can also take snapshots of VMs, including running VMs, and easily restore them. Actually you could also clone the Windows VM at intervalls and just boot into a cloned snapshot should the current Windows VM or game crash.

2. "But, for the OP's particular requirements, an install in any modern VM software should do the job..."

This statement is incorrect. As far as I know, there has been progress with for example VirtualBox to include better hardware support. But to the best of my knowledge only Xen and KVM, maybe VMware (?) ,are able to deliver native graphics acceleration in a Windows VM. All of them employ the same technology originally introduced into Xen: VGA passthrough.

VGA passthrough is a special kind of PCI passthrough taking into account the specific requirements of graphics cards.

To make it simple: None of the other "modern VM software" will allow you to run Windows with the graphics driver of the graphics card you are using under Windows. As for the "3D acceleration" advertised by various VM software vendors, this so far doesn't match bare metal performance. It's mostly Windows Aero support, or some OpenGL or similar support. This kind of graphics acceleration may work for some games, but it won't work for modern high-end games.

Aside from Linux and Wine, which works for a limited but growing number of Windows games, the only viable solution to running Windows games in a VM is using Xen or KVM.
 

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710


It may suffice, but is limited to OpenGL and Direct3D 8 or 9. It doesn't support DirectX or any vendor-specific acceleration features built into the proprietary drivers. See also aDirectX11 games.

It's absolutely not the same.
 

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710


No, VirtualBox does NOT support VGA passthrough, even with the extensions. And no, the options you listed most likely won't do for gamers and are not the best bets.

Yes, there are solutions to run Windows in a VM and get full graphics acceleration - see my previous posts. I'm writing this post from such a machine, and have been able to gather a little bit of experience with it, enough to write one of the tutorials I linked to above (the Linux Mint one).
 

gmuser

Distinguished
Feb 19, 2010
20
0
18,510
VMplayer supports 3D "passthrough", and allows decent performance for games.

BUT it still have drawbacks:
1) performance is slightly lower
2) only support DX9
3) in VM you see generic 3D card (think S3?) instead of NVidia

While #2 is still issue even with new "real" passthrough solutions like NVidia GRID + vmware vDGA, such vDGA solution supposedly solve #3 problem (by showing true nvidia card to your guest OS) and also supposedly closing performance gap in #1 (by offering all nvidia driver optimizations etc)

Example where this would make difference is in ability to install something that require NVidia card (like SteamOS).
 

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710


The way you describe it I don't believe you mean the same thing. Here is why:

1) performance is slightly lower: With Xen/KVM VGA passthrough the graphics performance difference is - if it exists at all - negligible, since the Windows guest has direct access to the graphics hardware. See below.

2) only support DX9: With Xen or KVM VGA passthrough you get all the options that the graphics card and the vendors' Windows driver support. My Nvidia Quadro 2000, for example, is detected by the Nvidia utility, which then downloads and installs the latest Nvidia (for Windows) driver for this card. There is absolutely no difference to installing the driver when running Windows on bare metal, or within a Xen VM with VGA passthrough.
What you write here clearly shows the difference between VGA passthrough with Xen / KVM and your experience with VMware. I'm not saying VMWare doesn't support VGA passthrough, but what you describe here is certainly not VGA passthrough.

3) When using Xen (or KVM), you see the Nvidia or AMD graphics card in the Windows VM's device list. The Windows VM is directly accessing the card. The downside is that you need a dedicated graphics card for your Windows guest. Another downside is that the Windows VM doesn't run in a window, but uses the dedicated graphics card for video output. You then need a second screen, or, if connected to the same screen as your Linux host, you need to switch between the screen ports.

I hope I made it clear.
 

gmuser

Distinguished
Feb 19, 2010
20
0
18,510


I did not work with Xen or KVM, but my reffering to what VMplayer does as "passtrough" is because speed you get in guest VM is practically same as speed of host GPU. It does have drawbacks that i listed, and that is reason for quotes around word "passthrough" that I used.

And VMware View with vDGA have #2 and #3 "fixed", meaning it should behave similar to what you described for Xen: it requires dedicated Nvidia GPU, it show NVidia driver, and support all DX versions like DX11 ... But I do not have experience with that one.

Major difference between VMware View and Workstation/Player is that View is "remote desktop" version, meaning VM server is running on other machine ( which BTW makes me wonder what is 3D performance over network.)

But my understanding is that both VMware and Citrix/Xen etc used same thing to achieve this, ie Nvidia GRID techniques, and thus share same things like:
- that is "remoting" technique that enables GPU virtualization on server for remote desktop/VM running on other PC
- it require full, dedicated, NVidia card on server for each remote VM
- it install on VM actual NVidia driver that support this stuff, so apps on guest OS see Nvidia card and can do DX11 etc
- it does not work on normal,local machine, hypervisors like VMware Player/Workstation


Now, since you mentioned that Xen is not same thing, I would be interested if maybe Xen/KVM support what you described on single, local machine, without "remote desktop" version? Meaning I can run VM on my Windows PC with GTX780 and in that VM my guest Windows OS will also see GTX780? In which case I would definitely go and try that ;p
 

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710
I have no practical experience with VMware, only read about it. I believe VMware users refer to PCI passthrough as "white box".

Both VMware and Citrix are competitors in remote computing where they use graphics card such as the Nvidia Grid models and thin clients/zero clients to provide virtual desktops to users without giving them an actual PC. This is mainly used in enterprise applications and at public institutions, and although it uses virtualisation, it doesn't use VGA passthrough but - as you pointed out correctly - GPU virtualisation, which is quite different.

Xen / KVM with VGA passthrough doesn't virtualise the hardware, just the opposite. Xen and KVM is capable of providing a memory management system (IOMMU) that allows Windows and the graphics card drivers to access the hardware without translating or emulating graphics directives. So, the graphics card driver inside the Windows VM does exactly the same as what it does when running on bare metal. The only tiny difference is that Xen / KVM use a special function of the CPU or chipset to handle the memory access so.

VGA passthrough under Xen works with many AMD graphics cards, but only very few Nvidia cards, namely the "Multi-OS" cards (some select Quadro cards starting with the Quadro 2000). The latest KVM using vfio-vga passthrough shows some success with other Nvidia cards. In short, if you want to give it try, you should first check the hardware if it supports VT-d or AMD-V (not only on paper - some vendors have broken motherboard BIOS) and whether or not the graphics card can be used for passthrough. Both Xen and KVM may offer patches for some specific cards.
 

gmuser

Distinguished
Feb 19, 2010
20
0
18,510


This is something that VMware Workstation or Player do not have yet.
Good news is that it does what I was asking for - showing real Nvidia/AMD card in 'local 'guest OS (where both host and guest are on same machine).
Bad news is that it still seems 'experimental' - probably less than 1% of PCs out there seems to satisfy those conditions.

I happen to have Quadro K5000, GTX780, AMD6950, VT-d CPU/board, but not in same PC ;\ My VT-d CPU is with GTX780 (so not supported video card), my Quadro K5000M is in notebook with IvyBridge CPU (so no VT-d), and my AMD6950 is on SandyBridge where both CPU/board do not support VT-d.

I found this link Xen_VGA_Passthrough, where it is nicely explained what it can do. I guess I'll have to wait bit more for that to become mainstream and available for most PCs - but still, it is ahead of where VMware is now ;p
 

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710


It's not that difficult - even I managed to get it work. Check my how-to here.
 

justin_dukkha

Honorable
Apr 2, 2014
62
0
10,640


I'm building a new machine, with Xeon 1231 v3, 16gb's ram, 240gb ssd and GIGABYTE GA-Z97-HD3 mobo.
I'm wanting to use it to create vm's for testing cad software for work and gaming if possible. I'm going to use it as a backup machine and for learning until I get a good understanding of virtualization. I thought my best option for performance would be a bare metal hypervisor. Am I right? Or what would you recommend or what questions should I ask my self to figure out best option. Thanks!
 

powerhouse32

Honorable
Jun 3, 2012
129
0
10,710
Yes, a bare metal hypervisor is a good start, or Linux with KVM. I tested both Xen and KVM and both perform beautifully as long as you got the right hardware. KVM lacks a little documentation, but the Arch Linux how-to I referred to in one of my earlier posts above gives plenty of information. As for Xen, you can try my how-to on the Linux Mint forum (see link in previous post of mine).

It might be a little pain in the neck to get it working, but it's worth the effort. I'm using Xen for over 2 years and currently I am running 2 VMs (Windows and another Linux VM for WordPress/web server). Good luck.