GMCloud and GameMaker Part 1: Registering your Game
This tutorial describes how to set up GMCloud with your GameMaker Studio 2 game and get started accessing GMCloud services such as cloud saves.
Step 1: Register for an Account
Go to https://gmcloud.org/ and register for a user account. Once an account is obtained, go to Settings and turn on GameDev mode
Step 2: Create a New Game
Once GameDev mode is on, a new GameDev page appears on the menu. In the GameDev page, you will be able to create a new game listing on GMCloud.
Fill in the relevant details to create your new game
Step 3: Find your API token
Upon completing the creation of the new game, you’re taken to the Game’s page (you can also access this page by clicking on your game, as they show up in your GameDev page).
On the page, you’ll find a list of your API Tokens.
The page shows three pieces of information:
- Game ID: this is the unique ID of your game on GMCloud, it’s also part of the URL people can use to access the game’s details page. This ID stays with your game for ever and can’t be changed unless you create a new game.
- Token ID & Token Secret: this is the access credentials your game can use to authenticate itself when communicating with GMCloud. You can generate multiple tokens, or revoke
Think about API tokens like usernames and passwords. Just like you’d enter a username and password into a login page to prove that you’re the owner of the accoun, the game enters its username and password when accessing GMCloud’s servers. Except, being a piece of software, the game has no problems entering a very long password.
We’ll need these three pieces of information once we set things up on the GameMaker side of things.
Step 4: Import the GMCloud extension into your project
Go to the YoYo Games marketplace, locate and acquire the free GMCloud extension, and add it to your account. Then Download it and Import it into your project from My Library in GMS2.
When importing, either select all items to import, or if you’re not interested in the demos, import just the Scripts>gmcloud and Objects>gmcloud_core resources, leaving out anything that has “gmcloud_demo” in its name.
Step 5: Paste in your secrets
Open up the Objects>gmcloud_core>gmcloud_handler object, in the Create event, at the top of the code you will see an area for your secrets (Game ID, Token ID, and Token Secret) that you acquired in an earlier step. Paste those in now.
Security Warning: If someone were to disassemble your game, or use some kind of memory watcher program, they may be able to easily extract these secrets. Once they have these secrets, it would be possible for them to make a program that masquerades as your game. The current method of storing the secrets as variables isn’t hugely secure, and security-minded game developers may wish to implement something more obfuscated. However it could be argued that any determined hacker would be able to bypass these measures. It is down to the individual game developer to decide on an appropriate security method for storing their secrets.
On the flip side, a hacker that manages to acquire these secrets, would only have access to the read-only portions of GMCloud services, such as reading the game config. It would not be possible to read or write to player data without also acquiring that player’s access tokens.
Step 6: Spawn an instance of gmcloud_handler
The gmcloud_handler is the only object you need to add to your game. It should be a persistent object, and there should only be one in existence at any time. The object handles interaction with GMCloud for you, and the gmcloud scripts all run in the context of gmcloud_handler.
Drag gmcloud_handler to your init room, or use any means appropriate to make it exist in your game before using an GMCloud features.
Once gmcloud_handler exists in your game with your secrets loaded into it, you can now use functions to access GMCloud services.
Ok! You’re now set up to use GMCloud, head on to Part 2 to see how to grab your game configs.