godot-html-js-int-demo/README.md

37 lines
1.6 KiB
Markdown

# godot-html-js-int-demo
Demo of integrating a Godot HTML5 exported game with its host page.
Uses a simple clicker game and a custom web shell to interact with the hosted
page.
[Working demo page][demo]
## Setup
* Requires Godot 3.2.x
* Use OpenGL ES 2.0 to allow for the HTML5 export.
The custom JS and styling (outside of the fixed size template provided by the
Godot devs) can be found between the `<!-- Start of Custom Game block -->` and
`<!-- End of Custom Game block -->` comment codes in [fixed-size.html](fixed-size.html).
## Extra Notes
* [Calling JS from the HTML5 Export][js-from-godot]
* [Using a Custom HTML Shell][custom-html-shell]
* [Custom Fixed Size Shell template][custom-fixed-size-template]
* Some minor tweaks are needed to work the custom shell with Godot 3.2:
* Remove the line: `const EXTRA_ARGS = JSON.parse('$GODOT_ARGS');`
* Update the starting of game engine by removing `EXTRA_ARGS` from `engine.startGame(EXECUTABLE_NAME, MAIN_PACK, EXTRA_ARGS).then(() => {` making it
`engine.startGame(EXECUTABLE_NAME, MAIN_PACK).then(() => {
[demo]: https://games.birch-tree.net/godot-html-js-integration-demo/
[js-from-godot]: https://docs.godotengine.org/en/stable/getting_started/workflow/export/exporting_for_web.html#calling-javascript-from-script
[custom-html-shell]: https://docs.godotengine.org/en/stable/tutorials/platform/customizing_html5_shell.html#doc-customizing-html5-shell
[custom-fixed-size-template]: https://github.com/godotengine/godot/blob/master/misc/dist/html/fixed-size.html
## Credits
* [Fonts by Kenney](https://opengameart.org/content/kenney-fonts)