How to make a fancy game launcher with game maker

You can easily use gamemaker’s programming language to create a game launcher, like a auto play screen that pops up when you insert a disk, for a non gamemaker game, no matter where the person puts the file in their directory. Very useful if you don’t want your players digging through the file to start the game or find the readme.
This tutorial covers how to:
*Run an external executable such as RPG_RT.exe for a rpgmaker game (play button)
*Open a readme file using the execute shell command
*Open an internet shortcut to a website, good for an update button
*Create an .ini file that holds the version of the game and can be edited for future patches
*Open the .ini file in the launcher and display the version number in the right hand corner
*Wow! An Exit Button!
*Putting it in a fixed up module

1. Create a new folder somewhere on your hard drive, call it Game Launcher, then create another folder inside it called test_game. Make sure you check hide file extensions off on in folder options! In the test_game folder, make a new text document and rename it as readme.txt, some sort of an executable, make one in gamemaker or use the RPG_RT, and rename it game.exe, and create an internet shortcut named update.(You can actually name these anything you want but we’re using this for the purpose of the tutorial)

2. Create a new file in gamemaker at save it as game launcher or something, in the directory just outside the test_game file, hence two files with the game name. The location is very important as this will allow the launcher to function properly as long as its still in the Game Launcher folder along with the test_game folder.

3. Make sure you are in advanced mode by checking the preferences, and draw some nice button sprites, for this tutorial, a play button, a readme button, an update button, and an exit button.

4. Play Button- create a new object called play, create a new left click event and create the Execute a piece of code action (its under control>code in the tabs)
Execute_program executes an external executable, does not work for non .exe
Add single quotes inside the parenthesis, to tell it to take test_game\game.exe as an directory instead of a executable name
Gamemaker starts the directory in the same file that the game is in, so as long as the test_game folder, or whatever you call it in its place, is in that folder, it will find the game.exe
The first 1 behind the comma does nothing, the second 1 behind the second comma tells the launcher to pause while the game.exe is running.

5. Create a new room and name it launcher. Place the play object in the room
(hopefully you know enough about gamemaker to remember to set its sprite)
And to test it, thanks to the way gamemaker works, create the game launcher executable in the Game Launcher Folder, along with the game maker save file mode to test it. You will have to do this every time that you test so that it opens the right directory while testing. Run the game launcher.exe and hopefully it loads without error. Click on the play button and your game.exe should start. If not your a failure in life who can clearly not understand extremely complex and poorly explained instructions. (Don’t feel bad it took me three hours to figure out how to get this to work)

6.Readme Button- create a new object called readme, once again make a left click event and create a new execute code action.
Execute shell opens any file in the default program for opening it, so your readme will open up in WordPad or such on top of the launcher.
The first comma 1 does nothing but is required. Don’t forget the single quotes.
6b. Test it!

7. Update or Website button- create a new object called update, once again make a left click event and create a new execute code action.


8. Exit button- you should probably know how to make this one but, just incase, create a new object called exit, create a new left click event and add the endgame action.

9.Fancying it up- Create a new 640x480 background and draw yourself a nice image for the launcher, then open the room launcher and under background check visible when it starts and open the selection box and select your background. Reposition your button objects how you want them.
9b.To get rid of the loading bar (you don’t really want one for your launcher do you?) open the global game settings, go to the loading tab. Check show your own image while loading, check transparent, and set alpha value to zero. Then check no loading progress bar. Change the game icon if you wish. Note: unless you buy the registered version, it will still show the gamemaker logo.

10. Creating an .ini file and using it to show a file version in the lower right hand corner.
Note: This is way more advanced then the previous actions. Chances are that you will screw up somewhere, and any screw up in coding will stop it from working.

Using a .ini file to show the file version is very useful, because it can easily be updated when you create a patch for your game (I would suggest clickteam’s patch maker) rather then making the person redownload the launcher if you want to simply draw the text in the launcher and send a new version of the launcher with each update.
First of all you need to create a .ini file. Create a new text document !In the same location as the game launcher, namely in the Game Launcher Folder, not the test_game! and change the .txt extension to .ini, and rename the file to version.ini. Open it to be edited.

Before we edit it, you need a basic understanding of an .ini file. Ini files are basically a common format for externally storing settings, such as to store game settings, options, values, etc in, for reference that lasts more than one game without the game being saved.
An .ini file consists of a Section, Keys within that Section, and Number or String values for each Key.

[Settings] -Section has to have brackets around it
level=22 -key with number value
pie=Chocolate -key with string value
[Qwerty] -section
setup=wasd v.22 -key with numbers, letters and spaces, has string value

In most forms Keys and Sections must contain no spaces, use underscores

For our purpose create a Section labeled File, and a Key in that section labeled version, then add the equal sign and type v1.00


Save the file.
Go back to gamemaker and create a new object named version. No need for a sprite for this one.
Create a new Draw event, and add the set the color action under the draw tab and set it to what color you want it to be. Next add an execute code event and type:




ini_open- Note: Don’t forget the single quote, cost me another 4 hours of sleep and completely revising all of the code again and again , turns out you need it for about all directories.
Gamemaker can only open one ini file at a time and it has to be in the same directory as the game, so just put in the ‘name.ini’

draw_text- the first two values are the x and y values. ini_read_string command returns the string value (what the key actually contains) as opposed the ini_read_real which only gets the real numerical value. The first value is the name of the section, the second is the name of the key, and the third is the default value, what it shows if it can’t find the key.

ini_close()- leave the parenthesis blank, it closes the open .ini file. Now place the object in the room, and save the game, make a new executable, and test it, v1.00 should appear in the lower right hand corner.
Now that wasn’t so hard was it?

Congratulations, you just learned how to make a launcher for your game, not really necessary but its nice to have. Just change the file directories and values for your game.

Example of a finished launcher:

Pages: 1