Object oriented event sheets that can be attached to objects

The idea is this: You attach an event sheet to an object and in it you refer to that object as the object that the code is attached to, rather than the object specifically. You create some logic for it.

But then because the logic is all object oriented, it can be reused by anyone else whom you share it with. They can attach it to their sprite and have it do wonders.

In addition object oriented event sheets being attached to new sprites could be instanced - like scripts in unity. Changing the sheet in one place could update it everywhere.
Event sheets could be saved as files that gdevelop can import or use as a resource.

If they use behaviors that need to be enabled, they automatically enable them and attach them to the object.

This is like an alternative approach to object groups. I know you can do all this with object groups and to some extend I think gdevapp had something like that. But it’s so interlinked with the web server. I wonder if we can also take advantage of it locally.

Good idea. I’ve proposed it before, search for user-defined automatism or similar. To this day I don’t know why it wasn’t made.

Maybe I remember wrong but I believe Victor and 4ian was not convinced about that it would be useful.

Just would like to add:

In case it would be not possible to “attach” events to objects but could be sort of “link” an object in the event sheet and refer to the object in the events as “This” or “Self” would be great. We could share only the event sheets, and people could use it without need to change anything in the event :slight_smile:

But in case we could attach an event to an object through properties that would be triggered automatically only on that object that has the event sheet, we could also use it to make something called “prefabs”.

Prefabs in Leadwerks engine are preconfigured objects that can be just thrown in to the scene and ready to use.
For example we could create this way a platformer character prefab that already got all the animations and events so when we import it in to our project and throw it in to the scene, it would be ready to use in case of player character, can be controlled to move and jump and fall and attack…etc or in case of an enemy character it would automatically start attacking and staff. We could also call a prefab using an event to be created in our scene for example a bullet, and when it created, it would just do it job automatically which is moving toward it angle and does damage to other objects…

An other strength of Leadwerks that is very useful with prefabs, we can make scripts configurable and so in case for example a bullet prefab, we can simply allow people to set the speed, value of damage and name of object to take damage from bullet through script properties. Basically in the scripts we can define “public” variables that can be edited through properties so a level designer don’t have to touch scripts, only throw prefabs in to the level done by animators and scripters, and ready to go for a test run.
So, in case we could attach events to an object and we could also make prefabs similar to Leadwerks, it would be also extremely useful to be able to use such “public variables” in event sheets to allow other people to make changes to the event and prefab through properties without open up the actual event sheet…

Such feature would be extremely useful in collaboration and also here on the forums to share content. In case someone need help with making a turret, we don’t need to share a complete GD project only to show how to make it, we could simply share a turret prefab that can be imported in to any GD project and ready to use.
GD could also have a prefab store actually where we could share and browse prefabs :slight_smile:

The advantage of such object events and prefabs over the current event store (system) would be that for example if I would share a turret event now in the event store, the users need to use the event as many times as many different turrets they have with different properties and they could use the turrets only the way I have designed. If I have designed the turret to shoot only one bullet at the time but somebody would like to shoot two bullets at the time they need to go in to the event and edit as many times as many different turrets they have.

Using a prefab and object event I could have a bullet object inside a prefab with it own bullet event that would make the bullet move toward it angle and do damage to enemies as soon as it created and it would have a turret object inside the prefab with it own event that would make the turret to rotate toward enemies and create the bullets. Through properties, the user could simply change how fast the turrets move toward enemy, how fast shoot the bullet, how many bullets to shoot at the time, how fast the bullets would move and what is the name of the enemy object that need to be destroyed by the turret so need to rotate toward and need to does damage to it.
People could also use the object events used in the prefab with any objects so instead of using the same events multiple times with different properties, we could use a single event multiple places for multiple objects with different properties :slight_smile:

Then Victor and 4ian shouldn’t be convinced that having automatisms/behaviours/whatever it is called now is useful. Because those would be just like automatisms, only made up from events instead of c++/js code.