# In GameMaker Studio, how can I make an auto-updater for my game?

I would like to let players update their copy of my game by clicking a button, which would:

3. Prompt the user to restart the game

I want to do this because my friends hate to re-download my game each time I make a change.

Is this possible with GameMaker? If so, how?

• It sounds this video tutorial might be helpful. It relies on a Game Maker extension .gex file written by the video author. (I haven't got Game Maker installed, so I can't really test it. Definitely post it as an answer if you get it to work!) – Anko Feb 21 '15 at 11:08

I have tried to make an update system for my game, and this is how far I got.

First, connect to my server, and download an .ini file containing the name of the newest version of the game:

http_get_file("http://mywebsite.com/game/Versions.ini", working_directory + "/Versions.ini");

The first part tells Gamemaker where to find the file online, and the last part tells it where to save it locally.

if file_exists("Versions.ini") {

I’m not sure of this function is optimal for larger downloads, because I don’t know if the file exists before the download is complete, but for small downloads like this very small text file, I haven’t found any issues yet.

 ini_open("Versions.ini"); global.NewestVersion = ini_read_string("Versions","Newest","ERROR"); ini_close(); } 

First the file is opened, then the string global.NewestVersion is set to the value that is in block “Versions” called “Newest”. And if that value doesn’t exist, set the string to ERROR. And then the file is closed.

By the way, the .ini file should look like this to work with the code:

 [Versions] Newest=”1.0” 

This one will say that the newest version is version 1.0

Anyway, as soon as you have the global.NewestVersion, you just have to compare it to a string in the game, that tells the game what version it currently is. I usually do that by creating an object without sprites, that makes a new string called global.CurrentVersion when the game starts.

If the strings match, do nothing.

If global.NewestVersion is equal to “ERROR”, inform the user that there was an error.

If none of these things are true, start downloading the new installer, and when it’s done, execute the installer, and close the game right after executing.

Now the installer can install the new game, and everybody’s happy.

So I figured what the heck, and instead I made my game open a website, where it said “there is a new update”, and then you could click on a link to download the update. In that way, I let the browser deal with downloading the executable, and then everything works fine!

If anybody knows how I can download an executable without damaging it, I’m all ears.

STRING = http_get_file("http://mywebsite.com/game/Versions.ini", working_directory + "/Versions.ini");

Now you can use a function that looks something like this to get info about how far the download is, and If there were any errors:

ds_map_(async_load, “WHAT YOU WANT TO KNOW ABOUT”);

But unfortunately, this never worked for me either.

• It looks like that download function returns files as a string, which could cause translation issues when writing it as a binary file, likely causing the "damaged" exe. – JonBee Feb 2 '16 at 15:58

I'm not sure it would be possible to do that without a "launcher" type application like Minecraft or the Battle.net app. You could most likely get the update itself easily enough, and close the game upon retrieving it, but I'm not sure how you would restart the .exe without an additional program triggering that. At any rate, here's how I'd do it:

1. On launch of the game (or the launcher) use Game Maker's networking feature to hit a page on a server which returns the current version number.

2. If your version # matches what the page said, then you're good, but if not then use the same Game Maker networking functions to grab an exe off the same server (doesn't have to be an exe, could be updated .dlls, art files, etc...).

3. Upon receipt of the file, have Game Maker replace the .exe from before with the one you just downloaded and then close the game.

4. At this point a launcher would have to control the re-opening of the game.

Maybe WinSparkle could work somehow? http://winsparkle.org "WinSparkle is an easy-to-use software update library for Windows developers. It's Open Source, available under the permissive MIT license."

• Preferably your answer would list suggestions on how to solve the problem. Describing how it's solving the problem and a high level view of the solution. Just suggesting a software package and saying "Maybe it could work somehow" is not the kind of answers we're looking for here. – MichaelHouse Feb 19 '15 at 6:05
• Im not quite sure how to implement it into Gamemaker... Or how to use it... – user61819 Feb 19 '15 at 21:07