Tags

This forum is currently in read-only mode.
  • First I started working with Contruct, I started adding variables to objects. Then I discovered Families and I thought that was a great thing to manage many objects. Now I think it is very frutrating. Deleting objects is a nightmare, adding or deleting variables in objects sharing different families too.

    I really use families for one thing: Picking objects.

    So I would like separate completly families and variables. A simplified version of family; maybe "Tag" concept ?

  • Attributes sort of work that way. You can create a custom attribute and use that for picking. You can't perform actions by attribute though. Would be nice if you could, perhaps there is a way that might be implemented?

  • What problems exactly are you having with deleting objects in families and managing variables? The family manager should take care of most of that for you.

  • Well, for one, you can't change the type of a variable in an entire family from the family manager, nor the initial value. You can only add or delete a variable, which has been a source of frustration for me at least, I've had to change two variables from number to text on every member of the family separately in order to not break the code that deleting the variables would cause, and I can tell you that this is quite a frustrating and time-consuming task to do with lots of objects in the family.

  • I create a family, add one variable to this family and include an object in this family. If this object has 50 variables, when you assign the family to an empty object, construct forces you to apply 51 variables, when I really want the family expecific one. If I check only the original one and uncheck the other 50, construct gives me this warning: "All events referring to the unselected family variables will be removed". The problem is, when you assign a family to a object, this family absorbs all the variables that alredy exits, so somehow it loses the family sense and don�t has family expecific private variables, forcing you to share all of them.

    Then if you want remove families and variables... it is a chaos, because you have dependencies everywhere.

  • I create a family, add one variable to this family and include an object in this family. If this object has 50 variables, when you assign the family to an empty object, construct forces you to apply 51 variables, when I really want the family expecific one. If I check only the original one and uncheck the other 50, construct gives me this warning: "All events referring to the unselected family variables will be removed".

    That sounds like it's working OK so far: it warns you just in case. If you don't have any events referring to the other variables, it's fine to uncheck them, but Construct always warns you. So here you just need to uncheck all of them except the one you want to share across the family.

    [quote:2isrurg4]The problem is, when you assign a family to a object, this family absorbs all the variables that alredy exits, so somehow it loses the family sense and don?t has family expecific private variables, forcing you to share all of them.

    You lost me here. When you add an object to a family, you should get the "which private variables do you want" dialog, just like you mentioned above. Then all you need to do is, again, remove all the variables you don't want to share across the family (as before, Construct will warn you again, just in case). Is there something you're doing differently?

    Family variables are simply the private variables in common to all the objects in the family - you can always organise it by editing each object's private variables individually. If all objects in a family have a private variable in common (same name), it becomes a family variable. That's all; the family manager is there to make this process easier.

    Still in Construct 2 I think this should be changed, since it is fairly ambiguous. I guess there could be a separate variables list for a family.

  • [quote:3derp6n5]I guess there could be a separate variables list for a family.

  • Still in Construct 2 I think this should be changed, since it is fairly ambiguous. I guess there could be a separate variables list for a family.

    ... We need an emote for forehead smacking

    That's such a simple and useful idea you can't help but think "wow, it should have been that way from the start." Live and learn, I guess

  • Families and objects are somewhat analogous to object orientation and inheritance. Perhaps you should seek inspiration there.

  • That's a good perspective, madster. It sounds like a good way to implement it: families contain "base" variables, effects and behaviors, and objects in the family inherit them. The current "only those in common" is pretty obscure and was retro-fitted in after the main engine was written.

    I wonder if we could even throw in encapsulation? Eg. variables only accessible by the object that owns them. Would that be useful in the real world? And polymorphism... can't think of a decent way that would fit in to events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I still have issues with families and variables, they always stop working, picking the wrong variables and stuff, and I think it could have to do with some bug with assigning new sprites to families and choosing to not have some variables. I've tried to make example .caps but the problem only happens in more elaborate games. I've managed fine without families but it's cumbersome.

  • I've noticed that if you place more than one initial condition using a family, and a private variable its taken like Or, instead of And.

    <img src="http://dl.dropbox.com/u/666516/familysubevents.jpg">

    In the first event multiples as well as different objects are picked separately, as expected.

    In the second any object the mouse is over, as well as the object with a private variable = 3 is picked.

    Then in the third everything works as expected by using a sub event.

    Am I not correct in assuming that conditions in the same line should be considered like And?

    http://dl.dropbox.com/u/666516/familysubevents.cap

  • I wonder if we could even throw in encapsulation? Eg. variables only accessible by the object that owns them. Would that be useful in the real world? And polymorphism...

    Well for once, you wouldn't be able to pick which family variables go in and which not (that in itself is weird to me). All vars from the family go in. When defining the family you would have to decide which variables (attributes) it has and their default values. These could be changed without having to touch the objects inside that family.

    Encapsulation could be in the form that you could define an attribute (aka family variable) as private, and it wouldn't be accesible unless you were refering to the object via its family. Protected doesn't make sense in this context, as Construct's "methods" (behaviors) cannot read from other objects... can they?

    Polymorphism... mmmm well for inheritance you could add families as members of other families, that would be nice. For polymorphism you'd have a family or object that's a member of several families (which is possible right now). What to do with an object that belongs to several families that have attributes with the same name? I'd say just forbid it and show a warning. It's a nightmare in any other way.

    PS: I tried the familysubevents.cap but it's saved in a newer version and I'm not updating until I finish my current game =)

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