godotjs/javascript

Godot 4 Tracker

Closed this issue ยท 31 comments

fire commented

Here's my current work on porting to godot 4.

https://github.com/fire/ECMAScript/tree/next

I got stuck. Need some help.

I have more plans for this project including embedding V8 backend, using NodeJS in the editor, etc. Sadly I haven't been able to find enough time yet to implement them.

I'd like to see how much real world godot users are accepting of JavaScript.

I got stuck. Need some help.

You can tell me the problem you're having and I'll be happy to help.

fire commented

@Geequlim Can I call you on discord? Want to see if I can send you the code and a description of the current issues so you can assist.

@fire I don't using dicord that much. And I don't have the confidence to understand or express myself correctly with English.

Can you describe your problem here? There is a big time difference between us and I will try to help you as much as possible when I am avaliable.

fire commented

https://github.com/fire/ECMAScript/tree/next doesn't compile.

Don't know how to reduce the complexity so I can finish porting it.

@fire I have pulled your code down and made some changes.
Since I haven't modified the godot source code for too long, the main problem at the moment is that all of my IDEs are broken.

fire commented

Let me know if you have godot 4 questions.

Downgraded QtCreator to 4.x and it finally worked.
@fire Did you build the code on the Windows platform? QuickJS doesn't support MSVC yet, so it is recommended that you try to build with mingw.

We create binding code for built-in types through xml documents.
I noticed the errors from generated code is caused as the argument is changed to param in 4.0, so change it to param should fix that.
https://github.com/fire/ECMAScript/blob/next/generate_builtin_api.py#L382

For PackedByteArray we'd better ignore all the methods make errors for now.

fire commented

I uses mingw llvm. Did you post your changes anywhere?

I uses mingw llvm. Did you post your changes anywhere?

@fire https://github.com/Geequlim/ECMAScript/tree/gd4

fire commented

What does FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/ECMAScript/ECMAScript/doc/classes/Quaternion.xml': mean?

@fire The buitin math type binding code is generated from xml doc files in build script. I think I have fixed these compile errors in branch gd4

fire commented

Can you repeat the tasks that are open for g4?

The gd4 branch is for godot 4 I have fixed the compile errors.

fire commented

The cicd actions is still failing.

CICD scripts is not fixed for godot 4 yet

fire commented

The javascript rename was merged.

There are things left to do for porting to godot 4.0

  • Call godot api from Javascript
    • Bind Object types
      • Signal and slots support
    • Bind buitin types with codegen tools
    • Mannually methods binding of buitin types which are ignored by codegen tools
    • Implements @GlobalScope functions
  • Call javascript from godot
    • Implements JavaScript and JavaScriptInstance for godot
    • Implements importer for TypeScript
fire commented

Can you describe how to do this? Implements JavaScript and JavaScriptInstance for godot

That should be same with 3.x.
We need to fix the code to fit the 4.0 workflow

fire commented

Do you have a test project so I can check what works and doesn't work?

Here are demos for godot 3.x you can reference.

https://github.com/Geequlim/ECMAScriptDemos

The script workflow for godot 4.0 is implemented in gd4 branch now.
We can play javascript in godot editor now.

fire commented

Would you be interested if I fixed the cicd? Is there anything I should know?

fire commented

I was able to get javascript to build, what's a hello world script?

https://github.com/V-Sekai/javascript

Changes:

  1. restore custom_modules=custom_modules by hacking the path. Please restore.
  2. might have msvc support

You can create a script for a node in the editor as same as GDScript with script create dialog

Would you be interested if I fixed the cicd? Is there anything I should know?

Still not found enough time to finish port all the things. These are something missing for the binding side thought. Contributions welcomed

Is there anything I can do to help out here? Not 100% clear on what the state of things are after reading through the thread.

@Geequlim
i have errors in the build, probably because of the refactor on the GDScript side (fresh from godot github)

fire commented

https://github.com/Geequlim/ECMAScript/tree/gd4 has a recent merge for Godot Engine 4.0 support.

I am going to close this in favour of new bug reports!

Thanks

Built-in methods which need bind manually in @GlobScope and GDScript is not fully checked yet.