The changes in this pull request should make react-godot be able to run Godot games exported with Godot version 3.5.3 LTS (and possibly others).
This change maintains backwards compatibility with whatever version of Godot the library was previously created with.
Major Changes
Add compatibility for the latest API. Tested with a personal project that was exported with Godot 3.5.3 LTS. I did not test with any other versions.
Fix a typescript error with instance. Required to compile the project.
Modify the package.json to indicate compatibility with React 17 and 18. I have tested with React 18, the example project uses React 16. An error on npm install will occur otherwise when using newer versions of React.
Changed the package.json references to use index.js instead of index.es.js, which does not exist.
Enable strict mode for Typescript checking and remove a soon to be removed property. Fix all errors that occur due to typing.
The newer engine now requires the location of the wasm file. Add this as another prop.
Minor Changes
Update package-lock.json versions, this was automatically done when running npm install.
Edited files have been automatically formatted to match the default settings of the Prettier code formatter. If you prefer a different code style, please let me know. I see that this project uses the standard code style, ran ts-standard --fix src/ to match the code style.
Export the Engine and EngineLoaderDescription types so that they are accessible externally. This is an optional change, I can move it to another PR or remove it altogether.
Notes
Confirmed backwards compatibility by running the example project.
To run the example, I had to also run the following commands after I did a npm install:
~/react-godot/example$ npm link ../node_modules/react
~/react-godot/example$ npm link ../node_modules/react-dom
If you do not run these commands, you will get an invalid hook call error when trying to run the example project. This seems to be caused by including a local module, more information about this can be found here.
example game:
Simple exported game with Godot 3.5.3 LTS
Future Improvements
Newer versions of Godot support auto-resizing to fill the window. This can easily be controlled with a prop. I will not include that new functionality in this PR, but can add it in a later one.
Would also probably be a good idea to export Godot settings/callbacks to the user for advanced usage.
There are some error logs in the console, but this doesn't affect the execution of the game. Some of these are probably related to the game/environment I'm testing with. Some of these could probably be cleaned up.
There is currently no way that I am aware of to get the Godot engine version from the Engine object. If a way exists, this would simplify the logic necessary to maintain backwards compatibility.
Type checking could be improved, I use any in a few places that can probably be converted to Error with more tweaks and testing. No new anys are introduced, I just convert the implicit anys to explicit ones.
Would be nice to setup a proper pipeline to build, test, and publish new versions of the package. I'm happy to set one up with Github Actions or CircleCI or similar, let me know if you have a preference!
The changes in this pull request should make
react-godot
be able to run Godot games exported with Godot version 3.5.3 LTS (and possibly others).This change maintains backwards compatibility with whatever version of Godot the library was previously created with.
Major Changes
instance
. Required to compile the project.package.json
to indicate compatibility with React 17 and 18. I have tested with React 18, the example project uses React 16. An error onnpm install
will occur otherwise when using newer versions of React.package.json
references to useindex.js
instead ofindex.es.js
, which does not exist.strict
mode for Typescript checking and remove a soon to be removed property. Fix all errors that occur due to typing.wasm
file. Add this as another prop.Minor Changes
package-lock.json
versions, this was automatically done when runningnpm install
.Edited files have been automatically formatted to match the default settings of the Prettier code formatter. If you prefer a different code style, please let me know.I see that this project uses the standard code style, rants-standard --fix src/
to match the code style.Engine
andEngineLoaderDescription
types so that they are accessible externally. This is an optional change, I can move it to another PR or remove it altogether.Notes
example
project.example
, I had to also run the following commands after I did anpm install
:If you do not run these commands, you will get an invalid hook call error when trying to run the example project. This seems to be caused by including a local module, more information about this can be found here.
example
game:Simple exported game with Godot 3.5.3 LTS
Future Improvements
Engine
object. If a way exists, this would simplify the logic necessary to maintain backwards compatibility.any
in a few places that can probably be converted toError
with more tweaks and testing. No newany
s are introduced, I just convert the implicitany
s to explicit ones.