Arrays, dictionaries, and other datatypes as a behavior or( instance variables )

0 favourites
  • 14 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • As often as not, I find my use of arrays and dictionary to be tied to objects. Dropping them in a container is great... but I always use families.

    Thus... object picking is required for every object pair... which can reduce performance and adds alot of boiler plate to families for no reason.

    Are others interested in being able to add lists, arrays, dictionaries, etc. directly to an object?

    Has this been suggested before? Are there cons to this? I know I have seen 3rd party behaviors that do this and wondered why it wasn't default in construct since the beginning?

  • This plugin does exactly that and more

  • This plugin does exactly that and more

    Looks like a great plugin with tons of useful features! I wish Scirra implemented at least some of these ideas.

  • I mean, that's cool, but it is still a 3rd party plugin for what should probably be vanilla. At least its from a user with a grand reputation.

    And donkey doughnuts UIDtoAnything! Yeah, that's another thing construct always needed.... handling references without having to pick objects over and over.

  • 100% agree, Overboys addon is great! (most of your recent posts make me feel like I'm not alone xD)

    This plus nested families would allow writing so so much cleaner, more scalable and more performant events as you can get rid of a lot of picking spaghetti and for each.

  • Yeah I found working with data in C3 in terms of arrays and such is... meh. It works but handling it in javascript is so much better, easier and faster. So in that regard I'd just go for subclassing. construct.net/en/make-games/manuals/construct-3/scripting/guides/subclassing-instances

    I had no idea that plugin exists, seems pretty useful. I had that thought a while ago where I wanted to add a json object as a new type of instance variable, don't remember if I ever posted a suggestion for it or anything.

  • I realized I'm using JSON object for almost everything now. It's not perfect, but so much easier to work with than C3 arrays.

    We have dozens of large array files in the project because it's easier to edit the data in table format, but in runtime I convert them all to JSONs.

  • I realized I'm using JSON object for almost everything now. It's not perfect, but so much easier to work with than C3 arrays.

    We have dozens of large array files in the project because it's easier to edit the data in table format, but in runtime I convert them all to JSONs.

    I'll have to look into this. My current project has arrays acting as an inventory of effects affecting the instance the array is connected to. I assumed it was better for performance reasons, but I haven't trie using json for it.

  • As often as not, I find my use of arrays and dictionary to be tied to objects. Dropping them in a container is great... but I always use families.

    Thus... object picking is required for every object pair...

    Containers are meant to be the way this works - it gives you one Array/Dictionary/etc per instance. Does that not work with families? I guess that might be an oversight in the engine. Could you file an issue for that so I can take a look? Ideally this would just work and not need workarounds if you use families.

  • As someone that's just started using containers for linking arrays/dictionaries/JSON to sprites (usually I stored UIDs in instance variables), having them work with families would be amazing! I'm fairly sure it is true that families cannot be in containers, but need to double check.

  • Ashley I hope this really is an oversight... But this has been brought up before so I doubt it...

    you can only add containers to the base object types, so when picking its family variant there is no way to know which container each instance has. This might be fixable if families had their own container so an object type can have both a family and a object type container

  • I noticed a spike in traffic and sales for Data+ and UIDToAnything, it looks like it came from here, thanks for recommending my plugins, I'm glad they're useful !

    As it seems there is a great interest for them currently I just set up a sale/bundle in case anyone wants to grab them !

    overboy.itch.io/construct-3-json-plus

    overboy.itch.io/construct-3-uid-to-anything

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • never mind my last message it doesn't work properly in all cases, I think my test was flawed.

  • Having the arrays/dictionaries as a behavior sounds like a great way to do it!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)