-
Notifications
You must be signed in to change notification settings - Fork 871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the current js addon system more accessible - without requirement of c++/manual gdjs recompiling #540
Comments
While I mostly agree with the points here, here are a few notes that are important, as this issue itself is important but also hard to implement so we have to be creative.
You're not describing alternative to your solution here ;) This section is important to have a critical thinking about what else we could do for our problem. Let me explain using the "5 whys": Our problem is "making new extensions is too hard".
So here is an alternative solution:
Beware of the distinction between extensions for the runtime (which are existing in Extensions folder) and plugin for the IDE (which do not exist - but experience prove that you've been able to add Piskel anyway ;)). In any case I do see the interest for this and I'll like to lower the barrier for extensions creation. But there is no easy solution to do it for now, it's not as simple as "let's just rewrite every extensions in JS" and so we have to get creative. ➡️To make progress on this, can I ask you (or anybody reading the thread) to write ideas that would help lower the barrier to writing extensions - while still not dropping all the existing extension system. For example, can we start with just events? or just objects? or maybe you just want to tweak some part of the editor by creating new dialogs? |
Note as stated in the other thread, I hope I don't feel too harsh when reading me - it's not the case 😇 It's just that the issue is complex and we have to be VERY precise about what is really needed to avoid losing a huge amount of time into working on an extension system that will complexify the whole software. |
My idea for this is to simply allow the js runtime to automatically load js files that are inside a project subfolder called So this is basically what we already have, BUT:
Wiring third party javascript libraries made easier would enable very powerful functionality to be added to gdevelop easier and faster |
I wonder if there is some way to use a simple json file to declare the extension, instead of a c++ script. Perhaps a parser could convert the json data into c++ code? :) If only gdevelop's newIde could trigger recompiling gdjs- that would also make it seem less intimidating to new users. But ideally I guess it would be best to streamline/improve what is already there rather that reinvent the wheel |
Yes I think so :) |
I think that with the newIde you really make gdevelop's new editor very attractive to javascript devs. But the js runtime and the extension system still require a lot of steps and some c++ to extend the engine. If that also becomes accessible to the user in their project folder space - that would make the whole engine incredibly attractive to javascript developers. Automating the step of recompiling gdjs somehow via a button in the new editor and ability to place extensions in the project folder would be enough to resolve this imo. The title of this issue is misleading - It is not to rewrite the current system, but to make it more accessible. I should rename it |
@4ian I really like the idea of wiring a code editor with gdevelop. Did you decide on which ide to use? I was wondering if we can use something stripped down, light and simple - that is only for javascript :) |
+1, a similar idea has also been on my mind for long, although only for the C++ side.
The current stateThe problem is, that even as they are now, extensions don't seem very flexible. This means that if you try to detect via an event whether the property "speed" of "Character" is greater than 0, the condition will fail if the object is a Platformer Character, even if Character is moving. Instead, you have to use the separately implemented "Is Moving" event of the Platformer extension. An interface-based design - an SDKAn interface-based design would normally allow for behaviors to be implemented in terms of already existing code. Plugin mechanisms are also a common thing - if someone creates an extension, it could be stored in a shared library as a plugin. No longer needed to recompile the whole relevant extensions subproject when installing an extension. I wonder if classes and functions are easier to expose to JavaScript with such a design. I really don't know. Beyond codingHaving an SDK by itself could not only ease the coding side of things! Imagine if you could just define a new type of behavior from GDevelop itself without coding, that would consist of conditions and corresponding actions packed together! Also more consistently with all the other extensions that were implemented in terms of a single SDK. |
https://github.com/superRaytin/react-monaco-editor would be a good one I think! Will try to answer more in details tomorrow, going to sleep now but this part is interesting:
That's something that I was thinking of indeed. Having actions/conditions (maybe events) that can be dynamically defined by the user (like an extension, but written using events) would allow much more expressive events. Like functions in GD4 but going a step further. |
The most exciting aspect of extensions is the ability to expose a third party library to the engine in a nice and easy to use package. After following the work that has been done on extensions for construct 2, it was clear to me that most of the extensions greatly benefited from already popular and battle tested javascript libraries. The extension authors simply exposed them a lot of times. What made them available really is the simplicity of what the engine required to expose them, use them in the context of a game, share them, install them. They are quick to test while being developed- without inbetween steps and waiting of 10minutes to recompile the whole thing. Just look at what one guy was able to do: To me at this point - it is easy to use third party js libraries and I see a lot of missing functionality in gdevelop right now - that would be very easy to add if the engine would simply allow me to attach a bunch of js scripts to my project and run/check their methods through the event sheet. Things like this: The creation of extensions via event sheets is also exciting, I really like the idea- we really need to be able to expose functionality from third party scripts better though. In the context of html5 game creation - this is super exciting stuff! Our current system is exactly like what godot calls modules. Modules require recompiling the engine. Also godot devs implemented the gdscript addon system - a lot of people (including me) started making plugins for it- because gdscript is very easy to use- very similar to python. So those of us who had no idea how to write c++ modules no longer needed to recompile the entire engine to use new functionality via modules or learn c++ to extend the engineourselves. I see alot of similarities of what javascript can be for gdevelop, with what gdscript is for godot. Javascript is an easy to learn and very popular scripting language. If better exposed to it- the engine can open a door for a lot of devs to create plugins with it for gdevelop and share them with developers who only use the event sheet. Whats great about it is that- in the context of a html5 game/app it can enable alot of things with less effort- as most of the implementation is already written in javascript. Suddenly we no longer need to start from scratch if we want x or y feature in a gdevelop game. :D If you ask event sheet users to recompile gdjs to use your extension, you will likely lose a lot of them. To me that seems to be the Achilles heel of the extensions system now. It really is a c++ modules system |
I also like @Nnarol 's idea of creating user defined behaviours based on logic bricks. A little documentation on the newIDE would also help to get into development. |
From my personal experience with the newIde, I found it relatively easy to get into, because it doesnt require many steps to set up a development environment and that part is well documented. @4ian helped me with me understand any parts that were initially confusing (like passing functions from class to class as a prop for example :) ) @Wend1go If you want to, just make a pull request or file an issue where you explain how you are thinking of implementing a feature. You will likely get some help. A more important low hanging fruit for the documentation imo is in adding some information of how to compile gdjs and develop extensions for it (with a minimal example if possible) - at it's git page If the event sheet can already run javascript on gdjs and it already used to be able to even include external js files, why do we still need to recompile the entire gdjs in order to create an extension? The newIde is in javascript - it's interface can in theory render any new condition/action event sheet elements- the interface is live and doesnt need rebuilding, but its not taking advantage of that for extensions at all. One json file can define the inputs and outputs (actions/conditions with their parameters that an extension adds) and another javascript file could do all the logic. To me that is the dream implementation of js extensions. When you look at extensions in other game engines - be it Unity3d,godot, construct , game maker- they dont require recompiling the engine. They dont become a part of the engine - they extend it without altering the core . The user is not touching the core engine, but is allowed to add new and easy to share functionality to it with some scripting alone. Any necessary recompiling is done automatically by the engine, upon playtesting (game maker) - the developer is not repeatedly running the same terminal commands between each itteration |
Please don't panic ;)
So working on an extension is a single command once you have the C++ part done. The C++ part should not change a lot so it's not ideal but still ok to have to wait for it to be recompiled. |
@4ian in any case - if I am to summarize this request - its for a way to bypass the compilation requirement by using js/json file to register actions/conditions. It can be in the same folder as the extension, or in the project folder. |
Yes :) |
@4ian currently stuck at note: in the instructions you are not even mentioning that mingw needs to be installed and set up. |
Relaunch your terminal after adding C:\MinGW\bin to the PATH maybe? The README was written for macOS/Linux where |
Let me know if it's working with mingw32-make. (And update the Gruntfile.js to refer to this executable instead of mingw32-make). |
Also if you're still stuck try replacing
by
in GDevelop.js GruntFile.js: https://github.com/4ian/GDevelop.js/blob/master/Gruntfile.js |
FYI, I did a few tests by exposing gd::PlatformExtension and related classes that are used to declare extensions into GDevelop.js. Warning, this is highly experimental and I've just quickly set up something to validate that it could work. For now please continue to dig to see if we can manage together to have you compile GDevelop.js and expose a simple extension. 😊 |
@4ian this is absolutely fantastic! I can help testing it if you want to :) The problem with compiling gdjs for me is that I can not do it when I am not at home. So this greatly limits what I can do with gdevelop during the day. You see in my case I usually have a copy of gdevelop on a usb flash thumb and then in my break time at work, I try to write some code for the newIde. And the newIde doesnt require installing any dependencies that I dont have on the flash thumb- thats why I can just plug it in the working computer and run a portable nodejs server. When you add the requirement to install things locally (big things), my hands are tied because I don't have admin rights on the work computer. After geting back home from work, I am left with an hour to tinker (at best). |
@4ian I don't mind restarting the editor to reload extensions for now :) One suggestion is to have gdevelop look for them in project/extensions folder The main bottlenecks are the c++ dependencies and gdjs recompilation steps. Being able to bypass them will be a huge improvement - even if the extensions folder is the same as always. So my suggestion is to do this in steps. First enable bypassing recompilation/c++ dependencies - without changing how extensions are discovered - they can be in the same folder for now. I dont mind if the js file follows the same structure either. Then later on when that is merged and tested, we can add ability to load extensions from the project folder in user space and add ability for live reloading - they are just extra features. |
You've probably already gotten past this issue, but judging by the prompt on the image, you were using a Windows console.
I.e., if you were using CMD.
will print "True" if <PATH TO SEARCH FOR> was found, otherwise, it prints "False". |
@Nnarol I tried it again now and I am getting more errors :)
2nd day of trying to make a js extension, the development environment is not even set yet. On your suggestion, this is what I get:
If @4ian has a bleeding edge js approach to register an addon - I much rather try to get my addon working with it and help test it, than to set up this ancient c++ compiler stuff on my system :) At least the errors I would get in it would help us make more progress to get away from this. I want to help any way possible to create a way around it. It is my strong belief that it will make gdevelop way more accessible and capable of being extended by others |
If you copy-pasted it like it seems from your response, the results are not surprising, since the placeholder surrounded by brackets:
Sure, I was just trying to give a hint as to how to check your PATH, since you described your issue above. For the second part: actually, even though it indeed looks like MinGW 4.9.2 is from 2014, and ships a somewhat older version of g++, environment requirements would not differ much from non-ancient versions of the compiler. |
@Nnarol ah sorry slaps forehead xD
Its finding it now, but as you can see, still lots of errors. I wonder if I should open a separate issue for this - its really a gdevelop.js issue and while it is related to my request here- the goal of this request is not to solve it, but to work towards a way to not require doing the c++ compilation in the first place. I tried looking for a test branch for what is in @4ian 's screenshot- but there is still none :) I guess its very alpha at the moment |
I've just pushed the branch and the PR. See https://github.com/4ian/GD/blob/373c55ddc54349130b86d2b718fdd886079a8744/newIDE/README-extensions.md and #544 :) Let me know if something is not clear in the new README as it will be linked from the first README page. |
@4ian thank you for this absolutely fantastic new feature I will tinker with it in the weekend. Would it be ok if as a simple excercise I try to port the shopify extension to a purely js extension? |
Awesome feature, will bring so much more functionality to gd 👍🏻
Next step, importing from construct3, would be so funny 🤣
…On Fri, 29 Jun 2018, 8:50 am Todor Imreorov, ***@***.***> wrote:
@4ian <https://github.com/4ian> thank you for this absolutely fantastic
new feature
🥇🥇 😄 🥇🥇
I have to say that it is so far my favorite in GD5!
I will tinker with it in the weekend. Would it be ok if as a simple
excercise I try to port the shopify extension to a purely js extension?
I see that you have done so with the facebook instant games one :D
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#540 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQ8miyZMA9xMNRvJgbC4VA32UlON_-JIks5uBdxFgaJpZM4U2XFT>
.
|
Yes, I intended to do it later, so feel free to go and convert the Shopify extension :) |
@zatsme That has actually been requested before xD It would be quite cheeky to steal their huge library of extensions. For now let's focus on making gdevelop's js extension framework awesome. It might become better than theirs |
Remember to check the license of anything that you're using- if something is copyrighted from another software please don't use it. Only use code that has a proper licensing allowing for sharing and reuse. I will work to expose objects/behaviors when we've confirmed that you were able to use the new extensions mechanism, by for example porting Spotify extension (shouldn't be too hard, just to have to be cautious). |
@4ian that is a good point actually. I will try to use this more for my own extension - to parse Yarn files for now. EDIT: Actually they seem to all have license included - but its different for each. There seems to be no clause in there forcing them to only be used in Construct, which is fantastic imo: @zatsme if you decide to do any porting- the courteous thing to do is ask the original developer first, as well as check the license - as @4ian noted |
Thanks for checking the license - remember to always do this to ensure the work of the author is sharable/re-usable :) Remember that the game engine for GDevelop is entirely different. Nevertheless, common principles can surely be found as in any game engine. I think it's a good exercise for you to compare how things are done. Hopefully you'll find GDevelop runtime/game engine easy to use. Otherwise please ask me for more details/help when you open a PR :) I also recommend to start by things maybe a bit simpler than a full Yarn/Bondage.js port. A few smaller but helpful extensions will be excellent :) |
@4ian yes indeed- I will start with simpler things. Thank you for working on this again. Please let me know if there is anything I can do to help. We can use this issue to report bugs/feedback while the js extension framework is still not merged :) Btw do you have suggestions for small js extensions that would be quite useful and help with testing at the moment? |
I would go for some quick extensions giving access to expression/small useful computations. For example, tween functions (something that is really missing from GD), etc... |
Can we close this now that it's done? :) |
I think so yes :) will experiment with it more when I get back to the uk in
a couple of weeks. Thank you for the hard work, this is an awesome feature!!
…On Tue, 17 Jul 2018 01:35 Florian Rival, ***@***.***> wrote:
Can we close this now that it's done? :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#540 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGMbVb5TmCSoBk1PhzOzn-j_pVUCox0Tks5uHRU0gaJpZM4U2XFT>
.
|
Closing this then :) Created the card on the roadmap for objects and events declaration: https://trello.com/c/OupkrLk6/68-add-support-for-declaring-objects-in-extensions-written-in-javascript and https://trello.com/c/Fl0hOu04/69-add-support-for-declaring-custom-events-in-extensions-written-in-javascript |
Thank you :)
…On Tue, 17 Jul 2018 23:56 Florian Rival, ***@***.***> wrote:
Closing this then :) Created the card on the roadmap for objects and
events declaration:
https://trello.com/c/OupkrLk6/68-add-support-for-declaring-objects-in-extensions-written-in-javascript
and
https://trello.com/c/Fl0hOu04/69-add-support-for-declaring-custom-events-in-extensions-written-in-javascript
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#540 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGMbVe5h04w9n9HIRKfPHjJ3mxEO5Gi4ks5uHk9ngaJpZM4U2XFT>
.
|
Description
Gdevelop's current js extension system is not very welcoming to gdevelop's users. At least not as accessible as other engine's (see godot and construct3 for example)
It requires:
https://github.com/4ian/GDevelop.js
Look at the huge number of dependencies: emsdk,cmake,a specific version of mingw32..
All that just so you can expose some custom js script functionality to a javascript ide :o
These requirements make the addon system dificult to use, addons difficult to create/use/share - especially if they are not already a part of gdevelop.
You have to recompile gdjs every time you make a change to your addon, if you share an addon with the community - other users are required to recompile gdjs in order to use the addon - essencially forking it. So every time gdjs is updated in the main branch, they have to recompile it with their addon to use it.
I strongly believe that is the sole reason gdevelop hasn't had such a live extension/addon scene in its community. Very few people create addons for it
Solution suggested
The main request here is to enable a way to bypass recompiling gdjs in order to register new actions/conditions in the event sheet with access to a custom javascript files!
This could be done by using a simple json file that the newIde reads from the extension's folder.
So the extensions are the same as before, but we can also include a json file for registering functionality in the newIde - as an alternative to the c++ approach. The newIde can read that file to add the new action/conditions on enabled extensions.
It would really benefit us if we have a more accessible js extension system that doesn't require any recompilation of gdjs or understanding of c++ :)
You can already kind of access the runtime via the JS event. Add ability to include external js files and we can kind of do it in the event sheet. But the event sheet can not modify the editor itself (creating new game object/conditions/actions).
Godot engine does it in a very interesting way where anything inside project/addons/myaddon is automatically detected by the engine as an addon to interpret.
Inside that folder there is a bunch of script files that can alter the editor's interface (using 'tool' key word) and describe what the addon does, with instructions to add new game objects and all. It is quite powerful and easy to use - also doesnt require recompiling godot
http://docs.godotengine.org/en/3.0/tutorials/plugins/editor/making_plugins.html
If gdevelop had this, you will see new community made functionality so much more. We will start getting new stuff on a monthly basis! I mean look how well it is working for godot:
https://godotengine.org/asset-library/asset
Alternatives considered
Construct3's biggest advantage over gdevelop is their addon api, which is well documented and very easy to use. Addons are easy to develop, share and extend - without any recompilation. You just drop them in a folder global folder and construct makes them available to all users- both in the editor's gui and the runtime! Here is a link to the documentation:
https://www.scirra.com/doc/c3sdk/index.html
This suggestion will work very well with another one here:
#454
The text was updated successfully, but these errors were encountered: