I left my desktop at school when I left when the campus got shut down, but I still wanted a way to ‘play warzone with the boys’. I experimented a bit and have found what as far as I can tell, is the cheapest way to set up a cloud machine game on Azure.
Costs/Savings for a cloud gaming machine breaks down like this:
- VM per hour pricing
- Switch to spot pricing
- Deallocate (stop from portal) when not in use
- Storage: monthly cost + disk operations cost
- Avoid managed disks: by default, VMs are provisioned with a 127 GB OS disk. If you make this an HDD, this runs up to ~5/month in fixed costs. And then expanding this or making a data disk for game data runs up your costs a lot more, and charges you even when you’re not using the machine. What’s more, you get charged for disk operations when it’s in use
- Store game data as a block blob and extract to the temp disk to avoid page blob charges and the associated disk operations costs. The temp disk also has almost 5x the performance of a premium SSD managed disk in my experience. Downloading/uploading is incredibly fast with 40 gigabit network interfaces installed on the VMs (although storage performance will bottleneck)
- Network costs: only outbound data is charged
- Make sure all storage and VM resources are in the same region
As you can see, most of the costs we save are in storage costs, but these are the most important because they’re monthly fixed costs that happen no matter how little you use the machine.
I tried for a while to get the new AMD Radeon based NV8as_v4 machines to work, but I ultimately couldn’t.
I’ve got my fixed costs to around $1.50/month, and variable costs to around $0.30 an hour. You can go even lower in certain situations, like having a Visual Studio (not community) subscription for Windows VMs at Linux pricing.
Here is a how-to guide on how to setup your own cloud gaming machine:
- Use Privacy.com and create a card for Azure with a monthly spend limit. If you screw up, Azure can easily charge you hundreds or thousands, and this prevents that.
- Creating the VM
- Size: NV6_Promo (preferred) or NV6
- Use Spot pricing – if you get kicked off it’ll be like your mom Microsoft doesn’t understand you can’t pause an online game
- OS: Windows 10
- On the disks page select HDD (it’s a tiny performance hit because it’s just Windows, not games that’s on this disk), and under advanced hit no to “use managed disk”
- Under management: disable all the monitoring stuff. Turn on auto shutdown.
- Double check all the settings on the confirmation page; sometimes setting one setting resets other settings for some reason
- Configure the VM for game streaming: RDP into the VM then do the following
- Download and install Nvidia Tesla M60 Windows 10 DCH drivers
- Download and install Virtual Audio Cable
- Download and install Parsec
- Go to cmd, then run
nvidia-smi, note the GPU ID (in the screenshot below it would be “00000000:00:03.0”)
nvidia-smi -g Your:GPU:ID:Here -dm 0
- Optional, but it’s a gaming PC so security isn’t the end of the world setup autologon:
- In Regedit go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, create two strings
DefaultPassword with the username and password of your VM.
- Create another string
AutoAdminLogon with the value of 1
- Create a key in
Personalization and inside that key create a DWORD called
NoLockScreen with the value of 1
- Restart the VM and connect with Parsec from your own PC
- Setup storing game data as a block blob
- In Azure portal, create a container for blobs. You may have to create a new storage account. While launching NV series VMs is restricted with some promotional subscriptions, such as the $200 trial, you can create the storage account on those subscriptions usually.
In the VM, download and install 7zip. Add the 7zip folder to your system PATH so Update: I’ve stopped bothering with 7zip because compressing game files doesn’t seem like it’s worth the effort with such abysmal compression ratios. I now just upload the game folder directly as a blob. The scripts below are for my old 7-zip solution, and can be easily modified to upload the game folder directly. To be honest, I also stopped bothering with scripts for this and just downloaded Azure Storage Explorer and do it through GUI since it only take a few clicks.
7z is accessible from the command line
- Download and extract AzCopy. Add it to the PATH.
upload.bat on the desktop:
7z u -t7z D:\games.7z D:\.\gamesFolder\* -mmt=6 -m0=lzma2
azcopy copy "D:\games.7z" "https://yourstorageaccount.blob.core.windows.net/yourblobcontainer/games.7z" --overwrite=true
download.bat on the desktop:
azcopy copy "https://yourstorageaccount.blob.core.windows.net/yourblobcontainer/games.7z" "D:\games.7z" --overwrite=true
7z x D:\games.7z -oD:\gamesFolder -aoa
download.bat to run at startup.
- Install your games at
upload.bat Btw you can add
-myx=9 -mqs=on -mx=9 -md=1536m to the 7zip command for more compression, but the first time you compress will take forever. This saves some money on long term storage though. What I did was run the first compression on a much cheaper VM and upload it
upload.bat anytime you update or install a new game. Probably have something trigger it through taskscheduler or something.
- The default OS Drive is 127 GB, which costs around $5.7/month because it’s a page blob. Let’s shrink that down.
- In the VM, go to disk management, and shrink Windows the partition down to something small, like around ~15-20 GB. 1 GB costs around $0.04/month, so you judge how much headroom you want to leave on the O.S. drive. If you’re really looking to save space, you can use the compact os feature in Windows 10 at a slight performance cost.
- Find the VHD in Azure portal, and hit “break lease” on it.
- Shrink the VHD. What I did was create a temporary VM, download it with Azure Storage Explorer because AzCopy didn’t work for VM storage accounts for some reason, and then shrink it with VHD resizer because the built in VHD tools in Windows only allows you to expand, not shrink VHDs. It was a massive PITA, and I would recommend you try this before resorting to that. Make sure you delete extra VMs including their managed disks if you create them!
And you’re ready to get playing! The most important part is make sure your machine is deallocated when you’re not using it. This means you gotta stop it through portal, simply shutting down the OS is not enough. Status in Azure should read “Stopped (deallocated)”.
In conclusion we
- Used Spot VMs
- Used a small non-managed ~20GB OS Drive
- Used block blob storage for game data
- Kept the VM off when we weren’t using it
That gets costs pretty damn low, the only way we can get lower is if someone figures out how to use the AMD based Nvv4 VMs.