GameMaker: trace/log function

A scribble reads "trace(x,y)"

Debugging games can be fun! Or not fun. Depends on what your definition of "fun" is.

Either way, starting with GameMaker: Studio, GameMaker has a proper debugger with breakpoints, step-by-step execution, watches, profiling, and other conveniences.

There is also an Output panel, to which you can write messages using show_debug_message. This can be preferable if you need to inspect order of execution or are in a hurry - after all, throwing a quick look on the panel is fast. You know what's not fast though? Using show_debug_message to do so.

Continue reading

Haxe: Simplistic .properties parser

If you have ever been using Java, you may already be familiar with .properties file format. This is a simplistic configuration file format, somewhat similar to INI:

# Comment
key = Value

For ones not liking that, there's also alternative syntax:

! Comment
key: Value

Where leading/trailing spaces are optional and are trimmed in parsing process.

Since I've seen people ask about this kind of thing, and also have seen people invent ridiculous (and non-functional) regular expressions to parse this file format, I thought that I may as well make an implementation that works "just right".

Continue reading

GameMaker: GM8 code editor color scheme for Studio

If you are using GameMaker: Studio and find default dark theme to be odd, you probably have already switched to lighter "GM8" theme via File - Preferences dialogue.

But, alas, switching to "GM8" theme does not change code editor color scheme, and you still get the default dark gray-orange theme in middle of your light-colored IDE.

So I thought that it would make sense to publish a GM8-esque color scheme that I've made and am using locally for a while now.

This color scheme follows GM8 style closely, with few exceptions like displaying resource names in teal instead of yellow (which grants higher contrast and generally looks better).

To import a color scheme, go to File - Preferences - Scripts and Code, click Import button, and pick the obtained file.

It is hard to make a large post about thing as small, so here's the file:

Download COL

Alternatively, file' contents (to be saved as gm8x.col and imported into GMS):

<Colours>
  <Color0>0</Color0>
  <Color1>8388608</Color1>
  <Color2>16711680</Color2>
  <Color3>32768</Color3>
  <Color4>128</Color4>
  <Color5>128</Color5>
  <Color6>128</Color6>
  <Color7>8388736</Color7>
  <Color8>11171870</Color8>
  <Color9>16777215</Color9>
  <Color10>14744314</Color10>
  <Color11>10512464</Color11>
  <Color12>5988454</Color12>
  <Color13>16120058</Color13>
  <Color14>255</Color14>
  <Color15>2633011</Color15>
  <Color16>11913437</Color16>
</Colours>

Have fun!

GameMaker: Testing two game instances at once

If you are using GameMaker: Studio to create multi-player games (via not-so-recently added network_ functions or by utilizing existing DLLs) without separate projects for server and client, you might have stumbled upon one annoying limitation - you can't run two instances of game from IDE.

From a glance, this looks like a small issue, but it gets tedious really fast - to run a second instance, you have to either compile the game (takes time and monotonous file dialog actions), or find a compiled .win file in depth of temporary directories (or otherwise retrieve it's location via means of WinAPI), and pass it to the runner via command-line, like

...\AppData\Roaming\GameMaker-Studio\Runner.exe -game (path to *.win file)

But that's no fun, right?
At least I've found so.
So I took a bit of time and made a small GML snippet to lift this unfortunate limitation.

Continue reading

GameMaker: Windows-specific functions for Studio

While working on one of recent projects, I've stumbled upon few common issues that many meet - even if you are only targeting Windows in GameMaker: Studio, you cannot access files outside the game's AppData directory (not even in program directory). Neither you can order system to open a file, meaning no external "readmes" to be easily hooked up with game, nor portable configuration files, and some other limitations.
So I took an evening and made a simplistic DLL library to bring equivalents to some functions (sleep, execute_shell, non-sandboxed I/O) back for Windows target. Function list is as following:

Continue reading

Simple GameJolt API plugin for Construct 2

GameJolt API plugin for Construct 2

As you may know, there's a program called Construct 2. You can make games with it. While I'm generally not a huge fan of built-in scripting system (scene editor and idea of behaviours are pretty great though), some people make nice games with that.

Also there's Game Jolt. Game Jolt is a site you can host your games, devlogs, and related media upon. It's great. I'm not sure which of Saturn's moons you are living on if you haven't heard of it by now.

Then when two come together... you can upload Construct 2 games to GameJolt, but you cannot use any of it's quite so nice Game APIs (such as high score tables, trophies, data stores...), since, well, noone made a plugin for that so far.

Seeing that, I thought that I may as well fix that part (a bit). So I have devoted a bit of time over few days and have made a plugin that provides basic functionality, such as sending scores and trophies. Everything is pretty straight-forward and easy to get hang of.

Installation is simple also - download ZIP file below, and unzip contents (a folder called "gamejolt") into HTML5 plugins directory (Construct 2\exporters\html5\plugins) in your Construct 2 installation. Upon next launch of program, GameJolt plugin will be available in "Platform specific" category alongside of Kongregate, Scirra arcade, and other items.

That's pretty much it, I guess. Download links are below. If there are any questions, feel free to ask.

GameJolt page (demo+downloads)

Update (August 2014)

Extension has been updated to include additional functions. So have been links in this post and files on GameJolt.

Notepad++: Syntax highlighting for GameMaker Studio

npp-gml-gms

Some time ago I've introduced a Notepad++ syntax highlighting file for GameMaker 8.1 and earlier versions. At the time, making a GameMaker: Studio version seemed slightly less senseful, since dynamic scripting functions are no longer supported, and code in XML files is escaped slightly, but then... oh do wait, extensions!
Extensions in GameMaker: Studio are imported into each project locally, permitting easy modification of their files. Of course, this also implies ability to edit GML files in them. Which in turn permits editing them with external editor of choice without having to deal with XML conversions.
So I took those several minutes needed, and updated UDL (user defined language) file for GameMaker: Studio. It contains all functions, variables, and constants present as of version 1.2.1264 (released January 22, 2014). Apart of new keywords, it now sticks to editor style better as well.
Oh, and you can fold code with comments (//{, //}). Foldable sections are awesome.

Download UDL (XML)

(or grab source from PasteBin, if Dropbox is somehow inaccessible)

... and if you prefer Sublime Text, there's GameMaker plugin for that too (by Cycododge).