GameMaker:Studio 1.2 - Shaders, YYC and more

The GameMaker:Studio 1.2 update has added many new and powerful features. All of these features except the YoYo Compiler (YYC) are included as standard across all versions of GameMaker:Studio, with the YYC being available as a separate module for those using the Professional version.

This article provides you with an overview of these new features.

Shaders

A shader is basically a two-part program that runs directly on the graphics card itself, making it very fast since the GPU is doing all the work. This frees up CPU cycles for your game code, meaning more over-all running speed when compared to more "traditional" methods of doing graphics effects rendering.

A complete shader is comprised of a vertex shader program, and a fragment shader program (also known as a pixel shader). Both of these tiny programs work together in order to manipulate what the graphics card renders to the screen. This then permits you to manipulate, in real time, the position, colour and alpha values that are actually rendered into the display buffer.

Using them in GameMaker:Studio is very simple, and if you have every used surfaces or blend modes then you will be in familiar territory. To start with you have to actually write (or import) the shader, using the new Shader Editor which is opened by right-clicking the new Shader Asset from the resource tree:

GMS_1_2_ShaderEditor.png

By default any new shader will be configured as a simple "pass through" shader (ie:it will simply draw whatever you use it with as-is), making adding and changing things very easy.

The shader program itself is written in a shader language with the default, cross platform choice being GLSL ES (you can find out more about the GLSL (ES) specifications here). Using this language guarantees that your game will work correctly on all platforms that shaders are available on, but you can also choose to use one of three other languages if you are only targeting a specific platform. The available languages and their respective targets are shown in the list below:

  • GLSL ES - All target platforms except Windows 8 (JS)
  • GLSL - Mac and Ubuntu (Linux)
  • HLSL9 - Windows 32 only
  • HLSL11 - Windows Phone and Windows 8 (Native)

Once you have configured the shader as you wish, you can then use it in the Draw Event of an object with a couple of simple lines of code:

shader_set(myShader);
draw_self();
shader_reset();

Obviously, you will need to set variables and other properties within the shader at run time, and the 1.2 update to GameMaker:Studio adds in the extra functions necessary to do this, as well as a whole host of secondary functions that permit you to create your own vertex formats and build your own primitives. You can find a full list here.

You can get additional information on how shaders fit into the graphics pipeline and how to use them in GMS from the following YoYo Games tech Blog articles:

Shaders Part 1
Shaders Part 2
Shaders Part 3
Shaders Part 4

Note that non-WebGL JavaScript  targets, like Windows 8 (JS) do not support shaders, but normal HTML5 does as long as you have the Global Game Settings set to WebGL - Enabled.

AUDIO

With GameMaker:Studio 1.2 there has also been a major change made to the way that sound assets are imported to give the user more flexibility with the output per-platform. The new Sound Editor looks like this:

form_sound.png

NOTE: If you are using the old audio engine, you will be missing the the Decompress On Load and Streaming options since these are not supported.

The first great change that has been made is to permit you to select from four different audio attributes. This allows greater control over how your audio will impact on the game performance and it's memory usage. The options and their general purpose are:

Uncompressed: This is an uncompressed file format, and will use the most memory with little or no performance impact for small sounds. This is ideal for *.wav sound effects, especially when you need to play multiple sounds at once.

Compressed: As above, but the sounds are compressed and then decompressed at run-time. This means that there may be a slight performance loss, so you should only really use this for *.mp3 music, or larger *.wav sound effects.

Uncompress On Load:  This option means the actual file size will be smaller, but there will be a delay at start up where these are uncompressed into memory, so you want to consider the start-up time for your game as this will be affected. Basically, if the size of the file is important to you, but you don't want the performance penalty of run-time decompression, then that would be a good setting for both *.wav sound and *.mp3 music.

Streamed: With this option your sound file will be streamed from the disk when played. This will reduce dramatically the initial load time for your game, but will also give a greater performance hit as the file is decompressed at run-time, so should only really be used for *.mp3 music.

There is now also a series of Target Options for your output files. These enable you to set the final output properties that will define the quality of your sound or music: Whether it is mono, stereo or 3D, it's sample rate, bit depth, and bit rate. Using these options you can change the output file quality and size to suit the device or build of your game. These settings are also Per Configuration, so you can change configurations and set different values based on the config being used.

NOTE: If the source file is has a lower quality than the default settings, then your final output file size will be "inflated" with no perceptible increase in audio quality. This means that you should always try to set these values to be as close as possible to the source audio quality, and then tweak them as necessary from there.

YoYo Compiler (YYC)

One of the most important additions to GameMaker:Studio in the 1.2 release is the addition of the YoYo Compiler (YYC) for different target platforms. The initial 1.2 release adds extra modules to compile to Android, iOS and Windows, with all other targets (except HTML5 and other JS targets) to be added in the coming months, and as such this upgrade is available as a separate module (it is actually several different modules giving a compile YYC target for each).

The YYC takes the normal GameMaker:Studio output and then compiles that into native code for the target platform, "stripping out" unneeded functions and performing a host of other optimisation techniques to create a smaller and performance enhanced executable. This can increase your games performance by a hundred-fold, especially on logic-heavy games, and when combined with shaders to create your graphical effects, gives an incredible overall boost.

Using the YYC for your games requires that you set up a few things beforehand (you can get more details here) but after that it's simply a case of selecting the desired platform from the Targets menu and pressing the Create Executable button. It is worth noting that for larger projects this may take some time so it is recommended that you test your games using the standard target for the platform and only compile as necessary.

NOTE: The YYC is included as part of the Master edition and does not need to be bought separately. This also goes for those people that already own the Master Edition - simply go to the Help drop down, select the Update Licence option and re-submit your Master Edition licence then re-start GameMaker:Studio.

Constants

Constants have finally been added to the resource tree in GameMaker:Studio 1.2. Previously they were a bit "hidden away" and lacked certain features, but with this update they now form a part of the regular assets list on a "per config" basis. This means that you can create a general list of constants that can be used no matter what configuration is being used (added to the All Configurations constants list), and then add further constants based on the currently selected configuration.

GMS_1_2_Constants.png

Instance Order Control GUI

Another addition to the user interface in the 1.2 update is the Instance Order window. This can be opened from the Settings Tab in the Room Editor, and will present the following information:

GMS_1_2_InstanceOrder.png

From here you can see the exact order in which all instances of objects placed within the room editor will be created. You can also select individual entries in the list and move them up or down, meaning that if your game has any errors due to dependencies based on creation order, you can fix them here easily.

Other Features

The 1.2 update for GameMaker:Studio also has a number of other additions and improvements:

3D games in HTML5 - The 3D functionality of GameMaker:Studio has been extended to cover the HTML5 platform when WebGL is enabled.

IAP limit raised - Previously you could only have 16 in app purchases. The 1.2 update increases this to 128.

Steam integration - The Steam API for developers has been fully integrated with GameMaker:Studio. This means that once you have your deal with Steam and access to their SDK, you can begin to integrate all the standard Steam features into your game.

PlayHaven support - PlayHaven support has been added to enable you to use their services for IAP, advertising, segment targeting etc... Find out more from the articles found here.

Tizen 2.2 support and Tizen IAPs -  Further support for the Tizen platform has been added.

Full ready-to-deploy OUYA support - This is added through the Android Global Game Settings and sets up the Android Manifest.xml properly for OUYA settings, as well as adding an OUYA icon.

MOGA support for Android - The Professional and Standard versions can now use the gamepad functions for MOGA Pocket and Pro controllers when targeting Android.

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk