Conversation
…ializableWithNameList
…ehavior for GDCpp
|
cc @blurymind @ddabrahim @Wend1go @Bouh @PascalLadalle @zatsme or others, if you have a bit of time to read the wiki page, would be very helpful to see if it's properly explained and fix typo/grammar :) |
|
WOW !
-- I've spotted a little thing :
|
|
Pure awesomeness! This will bring object orientated programming to GD. I can hardly imagine all the possibilities this will give us. 🎉 🚀 🎉 The event based behaviours will be useful for about any game object that has some kind of interactivity. Disclaimer: I haven't yet tried this branch on my pc. Some thoughts:
There are also some grammar mistakes in the wiki article and the lifecycle method descriptions. Will take a look at it when I come home. |
|
I am particularly excited about the prospect of community shared reusable objects/behaviors 😸 |
|
Love it, looks great. With custom functions It is going to be a huge game changer! A real hit. Thanks a lot! 🎆 |
|
Fixed some grammar mistakes in the wiki article. (One image seems to be missing somehow) Another idea for this function:
|
| description={ | ||
| <Trans> | ||
| Events that will be run at every frame (roughly 60 times per | ||
| second), for every object that have the behavior attached, |
There was a problem hiding this comment.
for every object that has the behavior attached
| description={ | ||
| <Trans> | ||
| Events that will be run at every frame (roughly 60 times per | ||
| second), for every object that have the behavior attached, after |
There was a problem hiding this comment.
again "for every object that has the bahavior ..."
|
I wanted to do a behavior to create a usable text field. |
Yup, this should be included in the latest commits :)
At the least the panel on the right can be closed, and the one on the left reduced. I think it should be enough?
True, I'll start thinking about how to rework this list. I want at some point to include here a search amongst behaviors that are shared somehow by the community :)
You can manually resize the top part to reduce its size, but I agree, I'm not totally satisfied with this for now.
Thanks!!
Yeah at some point I'd like to have custom images. The only thing is that I have to see if I can somehow embed it in the behavior, so that sharing is a matter of copy/pasting the content of the behavior (rather than having to share resources too).
Yes, it's because behaviors don't know anything about your game, and so can't access objects in your game (remember they should be reusable, and are generated like traditional behaviors). |
|
Also concerning customization:
For now these custom behaviors don't have properties (like builtin behaviors can have). I'd like to expose that later, but for now you'll have to use variables of the object. It's less clear but I'll add support for properties later :) |
|
Thanks, it works! And in the control panel, the sentence for the event sheet gives me an error about if i wrote |
7d6edf0 to
eeeafff
Compare
|
Note also that exporting/importing extensions as files allow for an "organic grow" of extensions (read: people exchanging/reusing functions using files). This is very fine and will be also a good metric of the success of the Events based behaviors and extensions :) I've added a first extension by @ddabrahim! :) Feel free to submit issues on https://github.com/4ian/GDevelop-extensions/ even if you don't follow the template/have questions, we can rework the extension before adding them :) |
|
@4ian it's starting to look fantastic! 😮
can be
if
is just a header, it could just say
Just some wording suggestions :) |
There was an error indeed, the parameter shown in the IDE is shown as a (number) expression, while it should be a string (so in your case, you must use VariableString).
I've fixed the first, thanks :) For the "Edit Extensions Options", I think I'll keep "Edit" because this is a button, so a verb describing the action is important I think (otherwise you can mistake this as a header - even though GDevelop don't have these - and think it's not clickable). |
|
|
@Bouh: you can do this already I think by choosing "Object" as the objects to pass to the JS function: At least this is working for me: Let me know if that work for you :) |
|
damn I wish we had some simple way to import libraries from the project folder easily. Seeing you guys write extensions like that straight into the embedded monaco editor makes it more and more apparent that is the way forward with how we write and distribute extensions. If I could just write Any simple way to achieve that within the ide would be amazing |
|
I see the idea, though I don't think that would go through import/require support (that would need GDevelop to actually parse the JavaScript, something that you probably don't want at all, or at least complex bundling with webpack/other bundlers). But I see the idea of having external files bundled with the project. |
cab1572 to
7fe3fa1
Compare
|
This should be good enough to merge and have this in the next version :) |
|
I have a few ideas of simple yet useful behaviors, for example:
(feel free to give more ideas - I think we could even have a custom column for this in the roadmap! What do you think?) Most of them would greatly benefit from having properties to customize them to be really useful. For now we can start with variables, but I'll try to see soon if I can add support for properties for these behaviors :) I've also added a second function by @ddabrahim to https://github.com/4ian/GDevelop-extensions/ (snap to grid) |
|
Cool, can't wait to try this. 😍 |
|
I just hope it won't lead into an uncontrolled mess when JS is
used in the custom behaviours they might need to be checked/updates
when we update any library GD relies on like Pixi or electron.
Yes that's a risk, this is why I warned against using too much JS in my
previous message. As much as possible:
* Behaviors should be done using plain old events - because they are
guaranteed to work across GDevelop versions :)
* Then, if a behavior really needs JS, then it should rely as much as
possible on well documented methods from GDevelop game engine (see
http://4ian.github.io/GD-Documentation/GDJS%20Runtime%20Documentation/)
* Then, if a behavior really needs to use Pixi.js or Electron specific
code, then it can be done but should I guess be stated in the description
("this will only work for Windows/macOS/Linux" for example for Electron)
and should use something like `if (typeof electron !== 'undefined') { ...
}` in the code to avoid crashing the game if not running with Electron.
Note that for now I'll review the submitted extensions so I'll double check
that. In the future, it should also be quite easy to just update this
script (
https://github.com/4ian/GDevelop-extensions/blob/master/scripts/update-extensions-registry.js)
to analyze extensions: if "electron" is found, or there are some usage of
JS, this can be displayed in GDevelop with some badge ("Windows/macOS/Linux
only").
In the future, if extensions can be submitted without my review, we'll
still verify the "featured" extensions to make sure they follow these
guidelines (events as possible, JS if needed, but using proper checks and
public methods only).
Also in case I change something in the game engine that will break
compatibility with some extensions using JS, I'll try to update the related
community extensions - but this will be more of a headache for sure.
Btw, is it possible to add functions to existing extensions? Like adding
a function to change the opacity/object colour of Panel Sprites or Tiled
Sprites?
So for downloaded extensions yes because they are simply added to your
project (but if you update/re-download the extension, any changes will be
erased).
For existing "builtin" extensions, not directly but you can totally create
a behavior that is limited to an object type (select the object type in the
behavior properties, see
http://wiki.compilgames.net/doku.php/gdevelop5/behaviors/events-based-behaviors).
This allow you to tell that you're behavior is only working with objects
that are for example Panel Sprites or Tiled Sprites. Actually, you could
think of existing objects as being a set of behaviors that have been merged
together :)
If something cannot be done using events, you can then use JS (to access
for example to the Pixi.js rendered object and modify the opacity).
Note that if an extension is using JS and is really useful or simple, I
could help and integrate your code directly in the game engine :) But the
idea is that now with custom behaviors, you can do it without me ;)
That's why using JS inside custom events is interesting (though again, if
you can use only events please do! :))
Look forward to having people create behaviors :D Hopefully I can release a
new version not too late with this.
…On Mon, May 20, 2019 at 7:14 AM Wend1go ***@***.***> wrote:
Cool, can't wait to try this. 😍
I just hope it won't lead into an uncontrolled mess when JS is used in the
custom behaviours they might need to be checked/updates when we update any
library GD relies on like Pixi or electron.
Btw, is it possible to add functions to existing extensions? Like adding a
function to change the opacity/object colour of Panel Sprites or Tiled
Sprites?
I have been wanting to add this for a long time now but always shied away
cause it is still in the C++ part of the engine.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1049?email_source=notifications&email_token=AAJYRAQ2FKMHHFQ7K22IAITPWI6UZA5CNFSM4HLNFHO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVXZJ5Y#issuecomment-493851895>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJYRAS3LLMPXIXXFN74NZ3PWI6UZANCNFSM4HLNFHOQ>
.
|
Actually, "snap to grid" was done by @Lizard-13, I only implemented his work in the function so the credit goes to him. Actually, I prefer not to take credit for any of that. All done by others. |
|
All, for your interest:
Still a few things that I'd like to iron out before a release.
Right, I changed to make him the author. If you prefer, I can just credit "GDevelop Team" for extensions that don't have a proper owner. |
|
Dialog windows have a problem We can't use buttons if the description is too long :|
I rewrote the conditions in expressions, and I create new ones, I submitted for review on the repo of extensions, link. |
I would go with "GDevelop Community" considering if the origin of something is uncertain, probably it has been shared by 'someone' on Discord or the Forum. But I leave it up to you, I don't mind. Thanks. |
Which one do you mean?
For now I recommend to use object variables as much as possible (or scene variables if needed), but prefix them by something like the name of the extension, or some acronym (for example Flash_Duration for the duration of the flash, and not just Duration). Ideally in the future, we'll have variables that are specific to Behaviors or even to the current functions - but not soon so for now let's prefix the variables to avoid collisions between variables of different behaviors (or even to avoid confusing the user that could "break" a behavior by misuing a variable).
Can you reproduce it with some game? I can't manage to do it by myself. |
Passing an object in javascript events.
I paste "Lorem ipusm" text in fields and button gone far because text area have no limit. |
|
looks like a css problem :) max-height +overflow-y:auto? :) trivial to fix |
|
Material-UI components, here TextField, should already take care of that. I think the fix is adding |
|
https://github.com/4ian/GDevelop/releases/tag/v5.0.0-beta69 👀 Let me know if there is any major issue! |
|
I can't copy a behavior, I must have misread a commit I thought it was possible :/ |









Ground breaking feature ahead 🔥
GDevelop has always being based on the idea of allowing anyone to create simple, advanced or very ambitious games. Behaviors have been very helpful as they allow to quickly add features to objects.
I'm taking this one step further by allowing GDevelop users to create their own reusable behaviors using the classic events system.
For the full help page, read here: http://wiki.compilgames.net/doku.php/gdevelop5/behaviors/events-based-behaviors 👀
I would need your help to fix grammar/typos and to tell me the part that are not clear.
This is still a work in progress but I hope to be able to ship this sooner than later. As far as I know, this is something that was never done in any other game making software with visual programming :)
Still to do:
Then asap: