Objects vs instances

0 favourites
  • 3 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hey! I'm currently working on a piece of software and I'm creating a lot and I mean a lot of Slider Bar Objects as I have a lot of parameters to mess with. I am creating a new slider bar for each parameter as it makes it really easy for me to reference it. I was wondering however, if I used instances of a slider bar instead of an individual object for each slider, will this have an effect on the game's performance? Are 100 instances of one object faster than 100 different objects with only one instance? Or is it the same since they'd be changed individually anyway?

    Cheers!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Normally I maximize the use of instances, given that all the instances of the object in question logically have the same scope or function as far as events go.

    However, if using all separate objects works and makes it easier for you, there is no reason not to unless you can actively notice or measure a performance difference.

    I don't think 100 objects would have any measurable impact on performance. On the other hand, slider bars objects are html form elements and those don't always play by the rules. Anyways I wouldn't bother worrying about performance.

    I'd go crazy building events for 100 separate objects if I could do it just for one instead though. Then again, you've got families to make up for that as well. This engine gives you a lot of flexibility to work in whatever way you feel most comfortable.

  • Thanks for the reply!

    I have to make specific code for each object, as each one as a different functionality, so it makes it easier to reference them if they are separate objects, otherwise I'd have to give each of the instances an ID and compare their id each time I'd want to reference them which would make it more difficult for me to work with.

    I wouldn't mind sacrificing that if it had an impact on performance, but if it doesn't then I think I'll continue with separate objects.

    Thank you for the insight!

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