Steam/Windows distribution, has anyone done it? What are the quirks and how did you do it?

I’m working on a game that I’d like to see on Steam sometime soon, but I’m having trouble getting my simple project running on someone else’s computer. Dependancy Walker lists a ton of missing Windows functions, but I’m pretty sure I’ve included all of the possible ones. Must not have I guess, but is there a better way of figuring out what you need?

My project doesn’t have dependencies on anything other than cocos. I basically take the Release.Win32 folder and zip it, and it works anywhere in my PC but I move it to someone else’s and it throws a missing DLL error on startup. I must have a dozen different mscv*.dlls included in the release too.

Has anyone tried to get their cocos2d-x project on another PC, and was there anything they didn’t find obvious? General tips like ‘cocos needs to be root permission’ or ‘cocos needs a 4 letter exe name’ or something else archaic like that?

After trying cocos compile -p win32 -m debug (still compiling for release as I type) it copied a bunch of dlls after compiling the debug version, so maybe that’s all I needed to do.

For everyone else missing or using a bad .cocos-project.json file, this is the bits I needed for mine to work:

{
    "win32_cfg": {
        "project_path": "proj.win32/",
        "sln_file": "GAMENAME_sln.sln",
        "project_name": "GAMENAME_proj",
        "build_cfg_path": "proj.win32"
    },
    "project_type": "cpp"
}

where my actual solution and project files where called those things. Unless the names and files lined up, cocos wouldn’t list the platform as being available to compile.

https://www.microsoft.com/en-ca/download/details.aspx?id=40784 is the Redistributable files I needed on the other laptop to run. Now I’m able to get the game running.

Seems like Magic Particles was a dependency that runs real slow in release mode, but that’s not a cocos problem, I don’t think.

Hope this helps someone else getting going.

Still don’t know what I’d need to do to get it to install those files on Steam but I assume it’s a checkbox on your Steam app settings.

@dogwalker deploys on Steam (all the time…lol)

Oh cool, hopefully @dogwalker has some advice for me! Maybe something he ran into when deploying to Steam/having someone on another PC run his game!

Thanks @slackmoehrle

Let me tell you, it’s a bit of a pain. :slight_smile:

At this point, I have sold two versions of my game on Steam, and am soon paying for the license to work on my third one, and it goes pretty well, but I have to admit, I’ve only now finally linked to the Steam SDK. So, really, that’s not necessary unless you want Steam features. I’m going to be looking into the Steam workshop and multiplayer if I can.

Also, I haven’t figured out how to deploy a Mac version on Steam yet, and I now have a Mac version working, so I’m going to have to decide whether to deploy on Steam or the Apple store.

Now, my development process may be a bit weird, too. I develop on my Mac for iOS (and working on a Mac version), but I develop on my Windows PC for Steam and the Windows version of my game.

So I’ll address the Windows version. I’m using Visual Studio 2015 and Cocos2d-x 3.16.
All in all, after creating the cocos project, things went pretty smoothly. In my day-to-day development, I just run within VS 2015. At some point, though, you’ll want to learn to package the game for Steam.

NOTE: I just discovered that they have changed the process since I started a few years ago! I manually edited files under “ContentBuilder/scripts” (see below), but now they’ve added a UI component to this.

First, download and unzip the steamworks sdk. Then look in the “tools” folder, that’s where you’ll be focusing. Steam has a good video that explains this much better than I can, but basically, you’ll:

  1. edit steam_appid.txt to have the steam appid of your game
  2. put all your deliverable files in “content/windows_content” (copy your project’s resources folders, dlls, and the exe here)
  3. set it up so that you can deliver all this to steam. That’s the part that’s changed. I had to manually edit script files, but now it’s simpler.

I know that’s not much help, but the point is that it involves:

  • downloading and expanding the steamworks sdk zip file
  • getting an “appid”
  • building your project in Visual Studio
  • copying your files from your VS release project folder to the content folder in the steamworks sdk folder
  • setting things up so that you can run a script or command to upload this build to Steam

I’ll tell you, it gets confusing on the depots, builds, etc. I don’t do it often enough to be an expert, I simply got it working and now just run the same script each time. I did change the appid and depot information for my second version.

2 Likes

Thanks for the detailed writeup @dogwalker, I actually just got Steam working in the last week or so and this would have been a nice help, I hope someone else can use it for the help too. It’s so overwhelming at first but the docs are pretty good.

It seems like the steam_appid.txt file is only good for debugging, and it’s safe to put in the release build. The steam client cleans it up after the game exits because of that.

The only thing that I’ve got different is the ContentRoot of the depot build script is pointed at my cocos project’s bin/release/win32 folder so I don’t even have to manually move files around. My project’s simple enough that there doesn’t seem to be any considerations on my end.

The script at Steam’s sdk\tools\ContentBuilder\run_build.bat manages the upload for me too so I don’t have to mess around with the app or depot build scripts. For anyone else, this is how mine look:

Depot build:

"DepotBuildConfig"
{
  // Set your assigned depot ID here
  "DepotID" "731421"

    // Set a root for all content.
    // All relative paths specified below (LocalPath in FileMapping entries, and FileExclusion paths)
    // will be resolved relative to this root.
    // If you don't define ContentRoot, then it will be assumed to be
    // the location of this script file, which probably isn't what you want
    "ContentRoot"	"<my cocos path>\bin\release\win32"

    // include all files recursivley
    "FileMapping"
    {
      // This can be a full path, or a path relative to ContentRoot
      "LocalPath" "*"

      // This is a path relative to the install folder of your game
      "DepotPath" "."

      // If LocalPath contains wildcards, setting this means that all
      // matching files within subdirectories of LocalPath will also
      // be included.
      "recursive" "1"
    }

  // but exclude all symbol files
  // This can be a full path, or a path relative to ContentRoot
  "FileExclusion" "*.pdb"
}

and my app build script:

"appbuild"
{
	"appid"	"731420"
	"desc" "Standard build option from app_build file" // description for this build
	"buildoutput" "..\output\" // build output folder for .log, .csm & .csd files, relative to location of this file
	"contentroot" "..\content\" // root content folder, relative to location of this file
	"setlive"	"beta" // branch to set live after successful build, non if empty
	"preview" "0" // to enable preview builds
	"local"	""	// set to flie path of local content server 
	
	"depots"
	{
		"731421" "depot_build_731421.vdf"
	}
}

awesome!! You’re ahead of me, LOL! And wow, I love your idea of pointing to the release folder, that’s great!

I hope you have tremendous success on Steam!

Hey, BTW, are you by any chance going to release a Mac version on Steam? I haven’t figured that out yet.

Good luck!

1 Like

Thanks man, I hope you are too! I know I’ve seen you around on here and it seems like you’ve already had some level of success too, it’s super cool.

I don’t have a Mac so I’ve never been able to get an iOS or Mac version of any of my games going. I don’t know much about the platform either but is there a specific issue you’re dealing with? I’d love to try to help you with it anyway!

Well, it’s been a while since I looked at it. At the moment, I’m focusing on getting more sounds working in my game, then working on some features and organizing. When I run the Mac version from xcode, it runs great, so I’m pretty sure I could release it on the Apple Store, but I think I’d rather try Steam, for the simple reason, that I’m hoping to get multiplayer working this year.

When I get back to the Mac, I’ll definitely hit you up, see if you have any suggestions. It’s more of a “how do I package the Mac for Steam” question.

I haven’t used any Steam features yet, but hope to look into the Workshop and multiplayer stuff. Glad you’re doing well, TankorSmash!

I’ve been thinking about getting Workshop support for my upcoming game too, if you figure out a way to get that going I’d love to hear it. I’ve been playing around with the Stats/Achievements stuff and it’s a little tricky because they use the async Callback and CallResults style. They’ve got it nicely set up but I’m not used to thinking in that way. You need to basically query all the stats from the server, then set the stat in Steam’s local memory, then publish the stat from the client to the wider Steam network.

In terms of packaging Steam on Mac, The run_build.bat file for Windows just contains the line

builder\steamcmd.exe +login "<USERNAME>" "<PASSWORD>" +run_app_build ..\scripts\app_build_731420.vdf +quit

and there’s a builder_osx folder, so you could probably get away with modifying it to (or running it manually from the terminal):

builder_osx\steamcmd.sh +login "<USERNAME>" "<PASSWORD>" +run_app_build ..\scripts\app_build_731420.vdf +quit

instead and it would run the same build files. No idea what you’d need to do on cocos2dx’s end to support Mac dev though!

Again, I’m just guessing, I’ve never messed around with it. If you do get it going, I’d love to hear about it!

1 Like

Will do! I hope to be working on Steam stuff by the end of May, and I’ll let you know. Thanks!

We just launched a Steam game but notice screen tearing when the game is in full screen mode. Anyone experience this?

Have you tried enabling VSync? I don’t know if it’s enabled by default.

The only weird thing is that you can’t use the glfw’s context or whatever from your own game, so it seems like the only way to use it is to change cocos’s source. If you’re able to figure it out, please let me know too.

Yes we tried enabling/disabling. Nothing works - only work around is make the game play in windowed mode.

Huh, I thought enabling VSync necessarily means that there can’t be screentearing. If you enable it, is the FPS still 60?

Maybe you’ve got a screenshader that performs worse in fullscreen mode?