Starting a new game - Grisgram/gml-raptor GitHub Wiki
Starting a new game is as simple as creating a new project from the template, but:
-
If you plan a desktop or console game (everything, except
HTML5
anditch.io
), you're ready to go -
If you plan a
HTML5
game, read the chapter about HTML a bit down this page closely -
If you plan to release it on
itch.io
, after reading the HTML chapter, make sure, you also read the itch.io chapter, as this site has an additional challenger for us developers in stock
raptor
tries to read a file named version.json
at startup from the included files root folder.
This file has a very simple structure, and a default version of it is included in the project template.
In this file, you provide the game version as a whole string and each part (major/minor/build) as integer values.
In the game, you have these macros available to access the values stored in the file:
Macro | Data type |
---|---|
GAME_VERSION_STRING |
string |
GAME_VERSION_MAJOR |
int |
GAME_VERSION_MINOR |
int |
GAME_VERSION_BUILD |
int |
The file looks like this:
{
"version": "0.1.0",
"major": 0,
"minor": 1,
"build": 0,
}
This is the first question you have to ask yourself. If the answer is 'Yes', and if this will (also) support the HTML5 runtime, then there are a few steps you have to do only once per project. You need to get the correct javascript file name of your game.
Don't worry, this is not complicated. Here is a step-by-step guide for how to get your project ready for the HTML5 runtime.
The information shown here can also be found directly in the IDE in the !_NEW_GAME_README_!
file
which is in the root folder, visible at the bottom of your Asset Browser
.
Important
You have to do this only once in a project and only if you do HTML!
Do these steps before you do ANYTHING ELSE
-
Delete the
raptorTemplateRoom
folder, instead import theraptor-Html-Template-Room
package -
Set
rmMain
andrmStartup
(in the _GAME_SETUP_ folder) to1920x940
resolution (room, camera, viewport)! -
Set
Game Options → HTML → General → index.html
back to DEFAULT! -
Set the build target (at the top right corner of GameMaker) to
HTML5
and start the game -
In the Browser press
Shift-Ctrl-I
(inspect) and look at the Source ofindex.html
-
In line ~82/83 you find something like that:
<script type="text/javascript" src="game/gml-raptor.js?CMQAC=2015636066"></script>
-
This
src
part contains the name of your game project and the correct javascript filename
src="game/gml-raptor.js?CMQAC=2015636066"
-
Copy this part at the corresponding position in
index.html
in the included files -
Then you can set back to "index.html" in the game options
-
TEST NOW!!
-
If you see the flag in the browser, all is good. Go ahead, start developing!
If you love game jams like I do, you will answer this with "Yes" more often than not. Unfortunately, itch.io has a strange behavior, when it comes to files. For some reason, if you do a "file_exists" in your game, if it runs on itch, it will always return true
, even if it does not exist!
Even more confusing is, that you can even read bytes from the non-existing file! You get some random bytes, and I do not have any idea, where they come from.
After many sleepless nights, hunting this one, I finally came up with the only reliable solution, I have found:
You have to make sure, that files DO exist. You have to deliver them (even with zero byte length) with your package. You have to create them in the Included Files
, so they are part of the .zip file you upload to itch.
Now, for you as raptor
user, this means, you also have to make sure, that the two files, raptor needs, are available in the package. They can be zero bytes long, but they must exist.
You set a GAME_FILE_PREFIX
constant in the Game_Configuration script, which can be found in the _GAME_SETUP_
folder of the project template:
#macro GAME_FILE_PREFIX "YourGameName"
Then click the Hamburger-menu in the top-right corner of the Asset Browser in GameMaker and choose Included Files
.
You should see something very similar to this:
There you see two files:
gml_raptor_game_settings.gsx
gml_raptor_game_settings.json
Click on Open In Explorer
and rename these files to:
YourGameName_game_settings.gsx
YourGameName_game_settings.json
They must match the name of the GAME_FILE_PREFIX
_game_settings.* . Then all is good and you can publish even on itch.io.