4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
10.81k stars 848 forks source link

Javascript extensions not working #584

Closed Wend1go closed 6 years ago

Wend1go commented 6 years ago

Describe the bug

The JavaScript extension example which is bundled with the newIDE raises an error when it gets included and isn't working. Also a very simple JavaScript test extension based on the working Facebook extension shows the same error.

To Reproduce

  1. Run import-GDJS-Runtime.js as described in README-extensions.md. (The files indeed get copied)
  2. Start the dev server (run yarn/npm) and run the newIDE as Electron application
  3. In the IDE open the developer console. It shows the following error and the extension is not usable. https://imgur.com/a/2JoDHjY

Other details

@blurymind couldn't get to run any JavaScript extensions either.

blurymind commented 6 years ago

Yes I get the error too. :) Thank you taking the time to report this problem. It is my understanding that the JS extension framework is still work in progress

4ian commented 6 years ago

It is my understanding that the JS extension framework is still work in progress

What is released should work, even if objects/events can't be declared in JS extensions. Let me check what can be wrong

4ian commented 6 years ago

Have you clicked on the arrow (next to [Object])? The error message should indicate what is wrong.

Open every error object until you get the final error message. Also be sure to go to newIDE/app/public, erase libGD.js file, and then restart GDevelop (yarn start/npm start). Can maybe be related to an outdated libGD.js as extensions are loading properly for me.

Wend1go commented 6 years ago

The error message was: "Missing runExtensionSanityTests in the extension module exports."

My own test extension loaded successfully after I copied this line from Facebook to the end of my own JsExtension.js: runExtensionSanityTests: function(extension) { return []; }, The Facebook extension already had it and Example extension is working now too. (even though I haven't changed anything in "Example".

Were the sanity tests in Example extension there right from the beginning? Looks I completely missed that part.

4ian commented 6 years ago

Were the sanity tests in Example extension there right from the beginning?

I've added this later, as it's quite easy to make mistakes when declaring extensions, so it can be handy to have a few tests written and running to ensure that things are working properly. :)

4ian commented 6 years ago

Is that working properly now/can we close the issue? Or is there something else?

Wend1go commented 6 years ago

For my part it can be closed. What about you @blurymind ?

blurymind commented 6 years ago

@Wend1go @4ian thank you for getting this fixed. I can confirm that the example dummy js extension is now loading successfully!

This issue can be closed :) This is excellent!

blurymind commented 6 years ago

@4ian on the dummy one I get a warning: Object with type MyDummyExtension::DummyObject has no editor configuration registered. Please use registerEditorConfiguration to register your editor. Does that mean that js extensions can be registered to use specific object editors? This will help me with the Yarn extension :o

4ian commented 6 years ago

@blurymind Not yet, in fact the functions to declare object exist and work (as shown by the DummyObject of the example) but you cannot create an editor for your object... well you can by adding it directly to newIDE like the other objects. Ideally these editors would be provided by extensions, that's why I'm considering it's not finished. But objects can still be declared now if you want to.

(Closing the issue as the error have been solved, we can continue the discussion if needed)

blurymind commented 6 years ago

@4ian thank you for clarifying =)