GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Better way to manage object's instances

Open Oxey405 opened this issue 2 years ago • 3 comments

A better way to manage object's instances 💭

So,I think that handling mulitple instances of an object is far too complex. Here is my idea on how to make that process way easier for devs :

Description 📜

GDevelop misses a way to store object references in variables and everything else it implies.

This way gamdevs could store some object and for example deal with multiple pushable objects chain or getting a specific instance aware of where are the other objects of his kind in a certain radius etc...

Solution suggested 💡

New features that should be implemented ⌨:

  • Storing an object reference in a variable (implies new variable type "ObjectReferenceVariable").
  • Making it possible to use an "ObjectReferenceVariable" inside of an argument instead of directly referencing an object.

Some other features that are not needed but could be great

  • Attaching an event list to each object. What I mean by that is : a sheet "PlayerLogic" that is linked to an object "Player" and executed for each instance of "Player". In the script the object instance could be named "myself" and the object kind could be named "other_instances"

Alternatives considered 🤔

I think there is no workaround for that. ¯_(ツ)_/¯ Oh and, thanks for reading ! 📖

Oxey405 avatar Sep 15 '22 17:09 Oxey405

I think this might be similar to https://trello.com/c/VfginxSG/472-add-actions-to-remember-a-list-of-picked-objects-in-memory-and-pick-them-again-later and a discussion was started here: https://github.com/4ian/GDevelop/discussions/2653

4ian avatar Sep 15 '22 17:09 4ian

I think this might be similar to https://trello.com/c/VfginxSG/472-add-actions-to-remember-a-list-of-picked-objects-in-memory-and-pick-them-again-later and a discussion was started here: #2653

Looks like it but to my knowledge, this has never been done. I may work on it this weekend

Oxey405 avatar Sep 15 '22 18:09 Oxey405

Maybe this extension can help? https://wiki.gdevelop.io/gdevelop5/extensions/object-stack/reference

D8H avatar Sep 17 '22 17:09 D8H