It’s super exciting to finally get the game shipped. I think it took about 6 or 7 months to get the game fully ported and working beautifully on the desktop. I ended up making a few changes/hacks to cocos2d-x. I guess that’s the power of open source software? Being able to change stuff when you need to is super nice.
Can you share your “changes/hacks” you made to the engine with us?
Oh sure. They’re really not all that fancy. Mostly stuff for the specific needs of my game. Here’s a few of the things I did.
I add the ability to freeze (pause) all actions. I use this whenever a kill is taking place.
I forced all the textures setting in CCTexture2D.cpp to default to GL_NEAREST.
I changed all the default save location of UserDefaults to conform with Steam’s expectations. Also made the mac and PC versions use the same user default code so that the save files are cross-platform compatible.
I stripped out TONS of systems I wasn’t using. Physics, cocos editor support, cocos audio, network, scripting and so much more. Made builds and the project very streamlined.
Upgraded GLFW to 3.1.2 for both PC and Mac.
There’s quite a lot more. Hard to remember everything. But because of the open source nature of Cocos2D-X, I was able to make it work differently when needed.
Rusty, congratulations! That’s an awesome accomplishment!
I’m about to release my first game to Steam as well, and I have a few questions for you, if you don’t mind.
My biggest question is how to get the Mac version onto Steam. I’ve watched Steam videos and have read everything I can find, but I haven’t seen details on how to find the files I need for deploying, where to put them, etc. The Windows version was easy, but the Mac … not so much.
Other questions:
what’s the purpose of the GL_NEAREST change?
can you tell me how you changed the default save location of UserDefaults and to what?
Along those lines, I think it might be nice if the Windows version wrote saved games out to somewhere other than %appdata%; did you happen to look at that as well?
I’ve updated GLFW on my Windows build, but haven’t worked on the Mac build yet, since I don’t even know where the files are.
1 - GL_NEAREST is used for NON anti-aliased rendering (e.g. Pixel Art). You can change the Texture2D constructor to set the default value for _antialiasEnabled to false (there’s also one in CCFontAtlas.cpp unless you’d like to keep anti-aliasing for text).
2 - You’ll probably want to look at the documentation, but I believe Steam prefers you use their cloud saves API going forward, but of course you should be able to technically save anywhere you like since Steam doesn’t really restrict much of anything, but rather just gives you the option for additional services and DRM checks. https://partner.steamgames.com/documentation/cloud
UserDefault.xml is saved to getWritablePath() as seen in CCUserDefaults.cpp.
Writable path defaults to `AppData/Local/[ProjectName] (Win32) if it can find/create it and is otherwise the path to the executable’s location.
My knowledge is only based on interfacing with Steam through Unity, so Rusty will probably have better information.
3 - AppData is sort of the standard, but you can follow the advice above or really you can just generate a full absolute path on your own (with an #if platform block) using windows API calls.
4 - GLFW is now updated to 3.2 in future versions (3.13+, I think it was added in 3.12)
Since you’re close to releasing I’m sure you’re “stuck” on whatever cocos2d-x version you’re using, but if you’re on 3.8 or later I would suggest creating a new branch in your source repo (or copying your project to another location) and try to upgrade to 3.12 and only if it takes more than a couple hours would I consider updating GLFW myself for the current version you’re using. Otherwise if you don’t need the extras in GLFW’s update then don’t bother for initial release, of course.
Wow! I admire you hehe!. Congratulations!!. The game looks great, It’s on my wishlist, I can’t purchase for now because I live in a country with exchange control but, I’ll do it whenever I can.
Thanks, Steve! I’m on version 3.10. My only real issue right now is that I’d like to be able to add crowd noise in the background and change its volume. I don’t think SimpleEngine will do what I need.
Tonight I’m going to experiment with LayerGradient to see if that’ll help my buttons not look so flat.
@dogwalker I think the only Mac file you need to deploy is the .app file? If you are still stuck, ask in the internal Steamworks forum. There are folks there who know a lot more about this than me.
@nivrig Not really sure about the latest versions. I expect 3.12 is pretty great? I’m still running 3.3 on this game. I ran into some issue with audio at the time, but that was quite a while ago!