This is a little FAQ for various Windows-specific extensions for GameMaker that I make!
Motivations
Some extensions I make with a specific use in mind - for example, Native Cursors and Native Mouselock both address common complaints in mouse-controlled games.
Some extensions are a "wouldn't it be cool if you could do this" kind, like window_shape, Display Screenshots, or multi-keyboard/mouse input.
Some are a bit of both - for example, over years Window Commands have grown from an extension for showing an "Are you sure you want to quit?" upon clicking the Close button to an assorted collection of window-related functions.
And sometimes people pay me to make publicly available extensions! Then I don't have to concern myself with how many people might use it or what to charge for it, though I still have to worry about whether other people might have complaints about it afterwards.
Technical
Most of these extensions are written in C++, some in C#. I use Visual Studio for both.
My extension-making process relies on a variety of automations, which enables me to make these quicker, have them be more convenient to the end user, and target multiple GameMaker versions without a substantial increase in development effort.
Many of these (even some of the paid ones!) are open-source, so you can see how things are done, or tweak them for yourself.
Overall I'm fairly pleased with my process.
Compatibility
My C++ extensions are built from a template that's set up to not depend on Microsoft Visual C++ Runtime DLLs, which has them work on a variety of Windows versions down to Windows 7, Windows Vista, or even Windows XP¹, depending on what exactly the extension is doing and when those functions were introduced.
As for C# extensions, I usually target .NET framework 4.6, which either comes pre-installed or can be installed in any Windows version starting with Vista.
¹ Not that you can easily target Windows XP from current GameMaker versions.
Compiling extensions
Most of these have more or less the same process so I'm going to put the steps in a place where it's easier to update them (this post).
Preparing to build
To build an extension, you need basic familiarity with Visual Studio, Command Prompt / PowerShell, and Windows more broadly.
Setting up Visual Studio
If you haven't installed Visual Studio yet, you can follow the official GameMaker guide for YYC.
Aside: if you have Visual Studio open while doing the rest of the steps here, you'll want to re-open it afterwards.
Setting up GmxGen
- Install Haxe (make sure to install Neko VM!)
- Download the source code (or check out the git repository)
- Compile the program:
haxe build.hxml
- Create an executable:
nekotools boot bin/GmxGen.n
- Copy
bin/GmxGen.exe
to a folder your PATH (e.g. to Haxe directory )
Setting up GmlCppExtFuncs
- (you should still have Haxe and Neko VM installed)
- Download the source code (or check out the git repository)
- Compile the program:
haxe build.hxml
- Create an executable:
nekotools boot bin/GmlCppExtFuncs.n
- Copy
bin/GmlCppExtFuncs.exe
to a folder your PATH (e.g. to Haxe directory )
Setting up the project
If you know what you're doing, you can check out the repository using git.
If you don't know what you're doing, you can click on Code (green button near top of the page) and then "Download ZIP".
Note: You should probably avoid having spaces in the project path, so "C:\CoolStuff\winMenu" and not "C:\Cool Stuff\winMenu".
Visual Studio Things
The project files can be built in either VS2019 or VS2022, but each of two comes with its own SDK versions and build tools.
You can check whether there's trouble as following:
- Open the
.sln
in Visual Studio - Open menu: Project ➜ (project name) Properties
- See if either "Windows SDK version" and/or "Platform Toolset" on the first page say "(version) (not installed)"
And if it does show that:
- Switch the two dropdowns on the top of the Property Pages window to "All Configurations" and "All Platforms"
- Change "Windows SDK version" and/or "Platform Toolset" to the newest versions that you have installed.
- Press OK to apply changes.
Building the DLL(s)
- Open the
.sln
in Visual Studio - Change the configuration (in the toolbar) to Release
- Change the architecture (also in the toolbar) to x64
- Pick menu: Build ➜ Build Solution
Visual Studio will let you know if there are errors. - If there's a x86 architecture in the dropdown, switch to it and build solution again.
If you have correctly set up GmxGen
and GmlCppExtFuncs
, the project will generate the autogen.gml
files for GML<->C++ interactions before building and will copy and [re-]link files after building. You can now open the GameMaker project and it should work!
Why just Windows, anyway
Unless the extension 100% GML code or is wrapping a cross-platform library (like Lua, or Steamworks), I have to re-implement the functions for each supported platform.
For desktop, that's usually 3 separate implementations.
For desktop+web+mobile that's 6 (or 5 if you get lucky with Mac/iOS sharing an API).
And then the extension should work the same on each platform too! That's the tricky part because the underlying APIs can be very different.
The economics side of it is that if an extension takes 3-4x the effort, can I expect it to sell 4x more? Should the price be increased proportionally? (the answers are "generally not", and "I don't think people would like that", respectively).
The non-economics side of it is that even with my advancements the extensions still take some time to make, and I'd rather make 3 extensions instead of 1 unless I'm out of ideas (I'm never out of ideas).
For other people, things might be different - if you have more time on your hands or are in no particular rush, you could very well spend whatever time it takes to make a thing that's up to your standards.
Asides
[Most of] this post was written in Obsidian!
(on my phone! Using an external keyboard!)
Now, my other posts are also written in Markdown, but it's my own dialect with a bunch of custom tags and cool tricks.
Fortunately, this post needed none of those.
Thanks for reading!