So, while working on my new multiplayer VR game, using the steam platform for lobby and P2P networking, I ran into a rather large issue.
After some research, I came up with the following solution:
I could not test with just my own steam account, and you’re not allowed to login with two different accounts.
Using a smart piece of software called Sandboxie, you are able to run programs in a sandbox. Basically, that means you can run a program in it’s own isolated space. And yes, that means you can run Steam twice, with a different account logged in for each Steam instance.
The solution is not without pitfalls, so I’ll tell you how I did it:
- Make sure the second account is added under the Steamworks partner page dashboard, under “Users and Persmissions” / “Manage users”.
Without being added here, another user can not use steam integration with a game in progress!
- Download Sandboxie from https://www.sandboxie.com/DownloadSandboxie
- Install and start Sandboxie.
- Select “Sandbox” / “Create new Sandbox”. Call it SteamTest or similar as you can’t have spaces/special characters in the name.
- Now right click your new sandbox and select “Run sandboxed” / “Run Any Program”.
- Browse to your Steam installation folder (default is C:\Program Files (x86)\Steam)
- Select steam.exe
- Now Steam should launch. The normal commercials showing up might not show, presenting you with a black window. Just close it and move on.
- If you are still logged in, simply log out and log in with the second test user.
- Now make sure that your normal Steam is started as well, so you should see two steam icons in your task bar.
- Make sure you have a standalone build of your game, before continuing.
- Now run your game from Unity and make sure the Steam integration is working.
- This step important! If you just run your standalone executable, like you did steam, you will get an error, as it’s not run from the directory containing steam_appid.txt. You need to right click the standalone executable, and select “Run Sandboxed”.
- Now select your Steam sandbox and click “Run”.
- Presto! You can now test Steam P2P lobby and multiplayer on a single computer 😀
BTW: Do you need an easy Unity library for using Steam, make sure to check out Steamworks, from Heathen’s Systems 😀