Add TypeScript/JavaScript Support for Godot 4.x with v8.
Note
This project is still in the very early stage of development.
- Godot ScriptLanguage integration
- Debug with Chrome devtools when using V8
- REPL in Editor
- Hot-reloading
- Asynchronous module loading (
import
function) - Sandboxed scripting (not multi-threading)
- Worker threads
STEP 1: Download or clone the repo into the modules
directory of your Godot engine source:
cd YourGodotEngineSource/modules
git clone https://github.com/ialex32x/GodotJS.git
STEP 2: Put v8
headers and libraries into GodotJS
, or directly download the prebuilt v8
from GodotJS-Dependencies:
# download the archive of prebuilt v8
curl https://github.com/ialex32x/GodotJS-Dependencies/releases/download/v8_r6/v8_r6.zip --output your/download/path/v8.zip
# extract the zip file into your `GodotJS` directory,
# NOTE: no white space after the switch `-o`
7z x -o"YourGodotEngineSource/modules/GodotJS" your/download/path/v8.zip
The module directroy structure looks like this:
┗━ godot
┗━ modules
┣━ ...
┣━ gltf
┣━ GodotJS
┃ ┣━ bridge-quickjs
┃ ┣━ bridge-v8
┃ ┣━ ...
┃ ┣━ lws
┃ ┗━ v8
┃ ┣━ include
┃ ┣━ linux.x86_64.release
┃ ┣━ macos.arm64.release
┃ ┗━ windows.x86_64.release
┣━ gridmap
┣━ ...
The currently used version of v8
is 12.4.254.20
.
STEP 3: Compile and launch Godot Editor
. Then, install TypeScript/JavaScript presets into a Godot project.
For more information on how to use GodotJS
in a project, check out GodotJSExample for examples written in typescript.
A prebuilt version of Godot Editor
can be downloaded from GodotJS-Build.
Note
Encountering Unresolved external symbol
errors during linkage with v8_monolith.lib
or libucrt.lib
may be addressed by updating to the latest version of the MSVC v143
toolchain and Windows Universal CRT SDK
(if VS2022 is used).
- Windows: x86_64
- Windows: arm64, UWP
- MacOS: arm64
- MacOS: x86_64
- Linux: x86_64
- Linux: arm64
- Android
- iOS
- WebAssembly (quickjs only)