Fixing buffer_set_surface in GameMaker: Studio

If you are still using GameMaker: Studio instead of moving to a more current version (perhaps you should - it's been almost five years since GMS1 support has ended) and you are doing extension work or anything else that demands conversions between raw pixel data and surfaces on Windows, you might have noticed that buffer_set_surface doesn't work on some computers - no matter what you pass in, no pixels appear on the surface.

Though the better way to put it would be "buffer_set_surface doesn't work anymore".

This is a post about the matter.

Continue reading

A yellow accent skin for GameMaker Studio 2 (and how to make your own)


(click for full-window version)

As it becomes increasingly more apparent that many people are completely unware of GameMaker Studio 2 having a light skin and fail to recognize it as being GameMaker as such, I have decided to stop using it for screenshots in my assets/blog posts.

However, the default dark skin is a little boring, so I decided to make a custom one with a familiar yellow tone for accents. This also doubles as a general explanation on how to make skins.

Continue reading

GameMaker: sprite_add_sprite in Studio / Studio 2

On this fine day[1], we're[2] proud to announce that we're bringing back everyone's[3] favourite GameMaker 8.x function!

That's right, we're bringing back sprite_add_sprite! 🎉

Now, you might be thinking either "this is not what I've expected" or "this is exactly what I expected [after reading the title] and I only have more questions now". You see, there's not always justification for things happening, sometimes they just do.

Should you actually need this function or if this introduction got you curious, take a seat and let me tell you a story (and some code),

Continue reading

Spelunky Classic source code for GameMaker: Studio

Original Spelunky's source code is available for download for a while now.

The downloadable project is, however, in GM8 format, and does not easily work in GMS.

At the same time, a GameMaker:Studio-compatible (ported) version of Spelunky Classic was included in Humble GameMaker Bundle, and thus available to anyone that bought the bundle.

A certain problem with that is, obviously, that if you haven't had the luck to be made aware of and buy the bundle in time, you would not have access to it afterwards.

However, I was able to confirm that the GMS version of Spelunky Classic included in the bundle can in fact be distributed publicly (because the GM8 one already is publicly available), so here's that:

yal.cc Dropbox Google Drive
MD5 checksum: 65c418623581b9d0c392cd8709e2739f
SHA-1 checksum: fd9794f05d62e37dfd1213769bb8afcad9cfaf16

Keep in mind, however, that this the exact file made available via Humble - it may still have some oddities that you'd need to resolve. Regardless, a solid starting point.

For discussions, check out the official forums. Have fun!

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: 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

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).

GameMaker: Opening GM5/6/7/8 projects in Studio

Opening GameMaker files with GameMaker: Studio

One of first questions ever when starting with GameMaker: Studio is how does one open pre-Studio GameMaker projects (such as GameMaker 8.1, GameMaker 8.0, 7, 6.x, 5.x...). If you got here from search, you probably already tried opening these by dragging them over the program window or attempting to pick these from "Open" menu which does not allow to switch file types. Thus you are probably thinking something in the lines of this now:

Sad handdrawn character standning. Caption says 'Rewrite all the code?' in italics.

But no, of course it isn't that bad (why would someone do this to you?), and you can get your projects running in GameMaker: Studio by importing them. This posts explains how and why.

Continue reading

GameMaker: Compacting Studio project files

If you have ever inspected directories of newly created projects for GameMaker: Studio, you may have noticed that even the seemingly empty project does "weight" a bit. 4 megabytes, to be precise (or 2 and half if zipped). Now you could say that it's not a lot nowadays, but it does stack, and those extra megabytes now and then could have came useful somewhere else (especially if keeping multiple backups of same project or periodically sending it over to someone). And, overall, it's a bit more than you'd logically expect from something that doesn't do anything (yet).
Reason of this is that upon creation your project looks roughly like this:

That is, most of space is occupied by Configs folder. It, in turn, mostly contains data and placeholder images for entire variety of platforms that GameMaker: Studio supports.
A thing is that far not many of those are actually needed in most situations, since splash screens and icons are commonly replaced with game-specific ones, and items left unmodified are commonly not used at all.
This post goes a bit into "optimizing" GameMaker: Studio projects a bit to reduce filesize drastically.

Continue reading