GameMaker Studio 2 (GMS2) features a lot of tools and tricks to help along with your game development. Even the most experienced users out there might have missed or overlooked some of the more subtle or "hidden" features available. We'll be spending some time in this tech blog exploring some of these features, and who knows... maybe we'll open your eyes to some new ways of doing things and help improve your workflow!
The first feature we're going to discuss is the use of Sprite Palettes. This feature is mainly useful for those of you that are making retro-styled games with limited palettes, and permits you to set a specific colour palette all sprites in that project can then use.
To start with, you'll need to create a sprite with the palette of colours that you want to use. For this example we'll be using this lovely 16 colour palette from GameMaker Studio 2 user Endesga (you can find this and more palettes of all types from the Lospec site):
You need to import the palette sprite into GameMaker Studio 2 as a new sprite and then open it in the Image Editor. Here we'll be changing the default colour swatches to use the new palette colours. To do this, you need to double click the colour swatch you want to change to open the Colour Picker and then use
CTRL/CMD and left-click on the sprite image to select the colour to use, before clicking "OK" to store it. The GIF below shows how this works for all the colours in the palette:
With that done, we need to apply it to our sprites!
If you make a new sprite now and then open it in the Image Editor, you can click on the "hamburger" menu above the colour swatches to get the following two options:
We want to use the first option, which permits us to import the colour swatches from a previously-created sprite - in this case the Palette sprite:
Of course, we could also stay in the Palette sprite and use the "Copy Colours To Sprite" option to apply the colour swatches to our other sprites.
And that's it! you can now import or copy the defined palette quickly and easily into all your sprites and ensure that you will always use those exact colours when drawing.
This next feature can be found in the Room Editor from the "Rooms" menu at the top of the IDE. The Convert Image to Tilemap menu item permits you to take any image and have GMS2 convert it into a sprite, tileset and tilemap for you:
To use this feature you'll need an image file with the tile elements that you want to use (for example, a mock-up image that your artist has sent you), something like this:
Once you have your image, you'd create a room in GameMaker Studio 2 that is the size you require and then open the "Room" menu and select "Convert Image to Tilemap". This will open a file explorer where you can select the image to use and, once selected, it'll open a window where you can set up the properties of the tileset that will be created from the image, including the name of the sprite, the name of the tileset and the layer that you want the tilemap to be generated on:
When you're happy, you can click the Generate Map button and GMS2 will take the image and generate all the required resources for you. It'll even take care to ensure that there are no duplicate tiles created for sections of the source image which are repeated!
This next feature is a genuine time-saver and is incredibly useful, especially when you are targeting mobile platforms. It's the Project Images Generator, available from the Tools menu at the top of the IDE. What this does is take an Icon image and a Splash Screen image and then generate very nearly all the icons and splash screens for all the available platforms at all the required sizes and apply them for you in Game Options, which for platforms with lots of icons, like iOS or Android, is a real chore to do manually. (The exception here is that it will not generate images for Android's Adaptive Icons - you will still need to click the button to generate them, but even that is made quicker and easier by this tool.)
To use this tool, you should have high resolution images of the two resources, for example a 1024x1024px icon and a 1920x1080px splash screen. You would then open the Project Image Generator and add these images into it:
You can then select how each image is generated from the following options:
Keep Aspect Ratio: This will try to maintain the aspect ratio of the base image when generating new images, padding the edges with the given border colour where necessary (in general, this should always be used for icons).
Crop To Fit: This will crop the source images to fit the destination, trimming the edges along the horizontal or vertical axis as required for the size of the output.
Stretch: This will stretch (or squash) the source image to fit the output resolution
In general, the best results are achieved using the "Keep Aspect Ratio" option, but you can experiment to see what suits your source images best. Once you have set everything up, click the Generate button and GameMaker Studio 2 will create all the required images for each of the licensed platforms for you. Thanks to this tool, you now have extra time to go get a coffee or play with your pet!
The next "hidden" feature we're going to talk about is the bookmark system. Bookmarks allow you to mark any GameMaker Studio 2 window that you will need to come back to repeatedly with a hot-key combination to skip back to that window at any time, making them a powerful tool for helping with workspace navigation.
To set a bookmark, simply make sure the window you want is in focus and then use the keys
Shift + CTRL/CMD + [any number key 1 - 9]. This will set the bookmark to the chosen number and add a little banner to the window to show it:
To navigate back to the bookmark later on, you use the key combination
CTRL/CMD + [the matching number key] and the IDE will take you back to the marked window (or open it for you).
To remove the bookmark, you return to the window and then simply repeat the same
Shift + CTRL/CMD + [the matching number key] hot-key combination used to set the bookmark originally. You can also change the bookmark by simply pressing
Shift + CTRL/CMD + [a different number key].
Our last feature for this blog post is one that can be very handy when you have a lot of images that you want to import as sprites, as it greatly reduces the amount of time required to make them. Simply open a file explorer window and then select all the images you want to use and drag them onto the IDE then drop them, and GameMaker Studio 2 will automatically create a new sprite for each image, using the original file name of the image as the new sprite's name.
If you want to create sprites with multiple frames of animation you can still do this, but you will need to do some prep-work first (or have your artist do it!). This involves preparing all your images as a single sprite strip, with the frames in consecutive order, much like the image shown below:
Now, when you save your sprite, you must append the name with the text
N is the number of frames in the sprite. For example, the sprite strip shown above is called
UI_Button_GooglePlay_strip6.png. Preparing all your sprites in this way means that when you drop them onto GameMaker Studio 2 they will be correctly converted into sprites with multiple frames, as shown in the GIF below:
GameMaker Studio 2 is a powerful tool and there are lots of other features that we could explore and talk about here - the texture page manager, the sound mixer, tileset brushes, etc... - but we just don't have enough space to cover them all in one blog post! However, we strongly recommend that you take some time to read through the IDE reference section of the manual as it'll show you all the features available, We know that nobody likes to read the manual, but sometimes it's worth the time-sink, as you can find out new ways to work with the software and improve your workflow!
Hopefully, however, this article will have shown you some new tools and tricks that'll help even if you don't RTM...