Skip to content

Commit

Permalink
Add support for gamemaker
Browse files Browse the repository at this point in the history
  • Loading branch information
cute-the-niini committed Mar 19, 2024
1 parent a0d9955 commit c843f95
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ We aim to support all reasonable web-exports of common game engines. The list be
- ✔️ **Ren'Py** (full support for Ren'Py web export 7.5 and 8.1 as of Kate v0.23.6);
- ✔️ **GB Studio** (web emulators work with existing bridges, but no recipe provided yet);
- ✔️ **Pico-8** (web export works with existing bridges, but no recipe provided yet);
- ✔️ **Godot 3** (web exports should be fully functional as of Kate v0.25.x);
- ✔️ **Godot 3** (web exports should be functional as of Kate v0.25.x);
- ✔️ **RPG Maker MV** (web exports should be functional as of Kate v0.25.x --- plugin support depends on what APIs the plugin requires);
- ✔️ **GameMaker** (web exports should be functional as of Kate v0.25.x);
- ➖ Unity (requires minor code changes in the game);
- ✖️ Twine (requires changes to Kate's sandboxing);
- ✖️ Godot 4 (requires changes to Kate's sandboxing);
Expand Down
87 changes: 87 additions & 0 deletions docs/source/dev/port/gamemaker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
GameMaker
=========

Games made with `GameMaker <https://gamemaker.io/en>`_ can run on Kate when
using the HTML5 export option.


Kart configuration
------------------

The minimal configuration for a GameMaker game looks like this:

.. code-block:: json
{
"id": "my-namespace/my-game",
"version": {"major": 1, "minor": 0},
"metadata": {
"presentation": {
"author": "Me",
"title": "My Game",
"tagline": "A GameMaker game"
}
},
"platform": {
"type": "web-archive",
"html": "index.html",
"recipe": {
"type": "gamemaker",
"pointer_support": true,
"hide_cursor": false
}
}
}
Bridges used
------------

This recipe includes the following bridges:

.. code-block::
{
"bridges": [
{ "type": "network-proxy", "sync_access": ["*.js"] },
{ "type": "keyboard-input-proxy-v2", "mapping": "defaults", "selector": "#canvas" },
{ "type": "pointer-input-proxy", "selector": "#canvas", "hide_cursor": false },
{ "type": "capture-canvas", "selector": "#canvas" },
{ "type": "preserve-webgl-render" }
]
}
The ``point-input-proxy`` depends on whether you've enabled ``pointer_support``
in your recipe configuration or not. If your game uses other features and APIs,
you might need to specify additional bridges in the ``platform`` section,
as usual; those will take precedence over the default recipe configuration.


Included files
--------------

By default the recipe will include all files that are generated for a
default GameMaker project. If you need other files, you'll have to include
them in the ``files`` section manually.

The default file patterns are:

.. code-block::
{
"files": [
"**/*.html",
"**/*.ico",
"**/*.ini",
"**/*.js",
"**/*.png",
"**/*.ogg",
"**/*.yy"
]
}
Note that this does not include the `*.mp3` files which GameMaker duplicates
on export for Apple devices. That would double the size of the cartridge and
increase significantly the time required to install it. Kate will support
decoding of OGG sound files on Apple devices in the future natively, so
there's no need to add proprietary formats.
3 changes: 2 additions & 1 deletion docs/source/dev/port/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Porting recipes are currently available for the following engines:
bitsy
renpy
godot
rpg-maker
rpg-maker
gamemaker
38 changes: 36 additions & 2 deletions packages/kate-tools/source/kart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const keymap = require("../assets/keymap.json") as {

const spec_version = Cart.Kate_version({
major: 0,
minor: 24,
patch: 2,
minor: 25,
patch: 0,
});

class KartWriter {
Expand Down Expand Up @@ -231,6 +231,11 @@ const recipe = T.tagged_choice<Recipe, Recipe["type"]>("type", {
pointer_support: T.optional(true, T.bool),
hide_cursor: T.optional(false, T.bool),
}),
gamemaker: T.spec({
type: T.constant("gamemaker" as const),
pointer_support: T.optional(true, T.bool),
hide_cursor: T.optional(false, T.bool),
}),
"rpg-maker-mv": T.spec({
type: T.constant("rpg-maker-mv" as const),
pointer_support: T.optional(true, T.bool),
Expand Down Expand Up @@ -411,6 +416,7 @@ type Recipe =
}
| { type: "bitsy" }
| { type: "godot"; version: "3"; pointer_support: boolean; hide_cursor: boolean }
| { type: "gamemaker"; pointer_support: boolean; hide_cursor: boolean }
| { type: "rpg-maker-mv"; pointer_support: boolean; hide_cursor: boolean };

const mime_table = Object.assign(Object.create(null), {
Expand Down Expand Up @@ -1153,6 +1159,34 @@ function apply_recipe(json: ReturnType<typeof config>): ReturnType<typeof config
};
}

case "gamemaker": {
return {
...json,
files: ["**/*.html", "**/*.ico", "**/*.ini", "**/*.js", "**/*.png", "**/*.ogg", "**/*.yy"],
platform: {
recipe,
type: "web-archive",
html: json.platform.html,
bridges: select_bridges([
{ type: "network-proxy", sync_access: ["*.js"] },
{ type: "keyboard-input-proxy-v2", mapping: "defaults", selector: "#canvas" },
...(recipe.pointer_support
? [
{
type: "pointer-input-proxy" as const,
selector: "#canvas",
hide_cursor: recipe.hide_cursor,
},
]
: []),
{ type: "capture-canvas", selector: "#canvas" },
{ type: "preserve-webgl-render" },
...json.platform.bridges,
]),
},
};
}

default:
throw unreachable(recipe, "Recipe");
}
Expand Down

0 comments on commit c843f95

Please sign in to comment.