Families and performance

  • Greetings

    I have a project with a lot of different sprites. I'm making a point and click adventure game. The estimated number of interactable objects is around 500-1000.

    Now my question for debate would be regarding Families and how they affect performance.

    I would like to use several families, all holding the all the objects.

    One family for the localized description, let's say "ObjectsDescriptionFamily" which would hold instance variables of the sort "ObjectsDescriptionFamily_EN" , "ObjectsDescriptionFamily_FR", etc, for all the languages that my game will support.

    Then I would have a family with the object's positions, like InitialPos_X, InitialPos_Y, CurrentPos_X, CurrentPos_Y, etc

    And the list would continue.

    What would be the performance difference between using let's say 5 families holding all the objects but certain instance variables each rather than 1 family holding all the objects with all the instance variables?

    Would the game perform better if I would drastically reduce the number of instance variables and replace them with global variables?

    Like instead of having Object_0001.ObjectsDescriptionFamily_EN = "description string" I would have it pointing to Object_0001Desc_EN_globalVariable, and this variable would hold "description string". The global variable part would help with organizing the project much better.

    I'm eagerly awaiting your thoughts on these 2 matters: 5 families vs 1 and family vs global variable

    Cheerio!

  • It probably does not make any difference either way, but if you doubt that, you can find out yourself.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'll take your word for it for the moment Ashley

    If I had enough time I would have tried to see if there's any performance gain/loss on a crappy device I got.

    Thanks

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