I want to check for collissions and the general state of specific children of a customObject on the event sheet or extension functions, in resume, outside of the customObject’s event sheet.
The main reasons I find for using customObjects are:
1.the events within them don’t run unless the object exists on the scene.
2.they save me from having to use a lot of “for each” events.
3.they are the perfect mix of an objectFolder with an objectGroup, and then they also have both things within them.
4.we can literally run entire scenes and games on a customObject’s event sheet.
5.Their code exists within extensions, which are stored on a separate file,on the project’s folder, which means that if a project’s file gets corrupted and you can’t open it anymore, you still have acces to the logic that was stored on the extension that has your customObjects
And the use cases for this new feature are infinite but I can list some:
-a gun with diferent kinds of bullets, with events that handle the reload, picking of amunition, intervals of creation, everything that doesn’t really need to be on a behavior or the event sheet. ¿But what happens when the bullets hit the target? that’s when we actually need an interactive event that actually needs to run outside the object, and only to check the collission and pass the event to the object that is being hit, which brings me to the next example…
-A character that runs their own movement, animations, artificial inteligence, and how it is affected by it’s interactions with other objects. But again THE COLLISSIONS with those objects, lets call them bullets, platforms, items, etc, need to run outside the object.
-A box that releases a Consumable Walking Mushrom Item when an italian plumber headbutts it. Same story as with the last examples.
Event sheets actually need very little events on them
Thanks for reading and revewing this request, and also thank you so much for adding the last feature I requested “allowing childs to be created on doStepPostEvents”.
IDK if you are familiar with the following. I’m also not sure if this is related to your post.
I was just testing custom objects. I already knew that you add the children in reference to the object. Meaning 0,0 is the main objects X, Y within the scene.
Using that same logic, if you place the custom object at 0,0 in the scene then you can add a parameter to a behavior function and test the parameter object against the children for collisions.
The custom object (or the children) seems to be on their own layer. If the layer is out of sync with the scene objects layer then visually it looks like the objects are in collision but since the layers aren’t sharing the same coordinates then they aren’t. It’s like when layers or cameras aren’t in sync.
You can also use the point inside if you add the controls X, Y and the child objects X, Y.
(you might need to use centerX and centerY for the child object)
Meaning point is inside obj.X()+childName.CenterX() and the same for Y
Do you want to check for collisions between other objects and the children?
Do you want to check for collisions with other objects without using conditions in the scene?
I wish I understood how behaviors like platforms and players communicated. You could put one behavior on the Italian plumber and use a custom object for the box.
Collision between object on scene and specific child of an object on scene.
That way plumber can fire bullets and lighning and run all the logic without it needing to run when plumber doesn’t exist on scene. We can add the same logic to green plumber, fire breathing tortoise monster, add hundreds of variations without clogging the event sheet with checks running when they don’t need to run.
It’s definetely not the intended use for extensions or custom objects but it solves other feature requests that I’ve read today, as well as it enables a better workflow for the built in multiplayer by helping isolate processes, It’s also way better than writing bunches of “for each” every time you want to discriminate a player or server from host.
I do think custom objects have a lot of potential. I’ve played with them. I just don’t know how efficient they are compared to a simple sprite. They’re basically a scene within a scene. They have aot of overhead. Although, some of it is canceled out by moving things from the scene to the custom object.
if this feature is integrated, developers will be able to literally share the characters they make as custom objects that are ready to be used in multiplayer and/or single player, this is the mising piece of the puzzle. And be able to share the entire skeleton of games as extensions, and then the scene editor becomes just a space to set interactions, and assign assets.
this can also be used to make generative landscaping that automatically assigns the right platform properties, and syncs what needs to be sync.
I was playing with platforms and platform characters within a custom object.
Inside the custom object both types behave normally. But, originally the children passed straight thru the scene objects. I realized that the custom object itself didn’t have any behaviors.
After adding the platform character behavior, it still didn’t really work because the hitbox and bounding box was made from the combined boundaries of all of the objects. Things just didn’t mesh correctly. The individual objects can interact with each other but they interact with the scene as 1 object.
It’s all kind of weird. There’s a method to the madness. It behaves consistently but still a bit chaotic. If that makes sense.
I tried it with and without that action although I didn’t do a lot of testing. I think either way the position of the children changed the bounding box. It created the box around them which also changes the center points. A custom object can’t alway use multiple behaviors. Custom Object are like multiple objects. I’m not talking about multiple children but you have the custom object that you add to the scene and then the children objects which combine to form it. Each one can have behaviors.
To do the power-up box. You could have a box with the platform behavior or not. You would have to have an action to supply the player object to test for collisions and then a parameter for an object to spawn. Which defeats the benefits of using a custom object except all of the events would be inside the custom object along with the box. So, the events would already be written. But it’s not completely self contained. It’s basically a behavior.
I need to do more testing. You might be able to use Javascript to overcome some things. You need to add objects to the scene and not to the custom object.
The cases you described above are not a good fit for custom objects apart from the animation but it’s very specific and an external tool like Spine is probably a better option.
Custom objects are mainly useful to put things together that don’t need to interact outside of the custom object, for instance a dialog box.
Usually, behaviors are a good choice for anything that is related to movement.
Spine is not free, in fact it is very expensive, which means I can’t even dream about using it, which is very depressing because it is a powerful tool indeed.
Also the big difference of using the ability to create childs instead of using behaviors for object creation is the amount of extra steps, and the convenience of using the custom object a folder/group to organize related objects and their events. I did said that I know this is not the intended usage for custom objects. Custom objects have s lot of potential that would increase a lot given the option to make them interact with the stuff on the scene. Besides of the benefits of not having to use “for each” events (which are a headache), behaviours also do the trick but require a lot of extra steps, setups, and are way less beginner friendly.
It looks like they’re working on the “prefab” objects. I hope it comes out soon. They’re working on an editor plus an extract objects to custom object feature. I know it’s not what you’re asking for but it gives me a little hope. They haven’t made a lot of changes to the custom objects. This looks like a good sign that they might be fully embracing them.
From the release notes https://github.com/4ian/GDevelop/releases
A new, work-in-progress, visual editor for custom objects (aka “prefabs”/“templates”) is being finalized. More information about it will be available in the next releases.
These are the features still in progress:
Properly handle effects (disable 3D effects) for layers
Handle hot reloading properly
Avoid duplicating the configuration of the custom object inside each object created from it.
Add a “Extract as a custom object (“prefab”)” when selecting instances in a scene.
Ensure physics and pathfinding behaviors work properly.
New expressions to translate coordinates from the parent to the local custom object.
Ensure deletion of a custom object is gracefully handled by the editor
that part of the update gives me hope, If they give prefabs a chance, we could develop games more modularly (besides making “for each object” events basically obsolet).
This one was a bug because the same object instance was the floor and the wall which the platformer character wasn’t handling well, but it has been fixed.
In the last note of the comment I said that this feature could be used as a work around until or if that feature request wasn’t added, the method would be using children of a prefab as the hitboxes (to replicate the system I was describing) but that only works if the collisions of the children can be checked individually outside of the prefab editor.
This can be done already with behaviours but it can be done way better and faster with prefabs in a more self contained way.