Question about Arrays and performance

0 favourites
  • 4 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Hi all,

    As i'm going through my game I realise that i'm a bit heavy on array data. I have around 10 different arrays at the moment and that is going to increase to 35-40 by the time i'm finished (and then some for updates). Some arrays are small and hold temporary data, a couple are quite large for NPCs and loot per different layout.

    At the moment the vast majority of these are on 1 layout/event sheet which is my UI layer (basically a hidden layout no one can get to as the previous layout has "load layout, then go to next layout upon load complete").

    My question is are all the arrays loaded when I get to this layout (thus having a load effect when getting to the UI layout)? If they are, would it be beneficial to move these arrays to the specific layout that they're to be loaded for? Or are they loaded so quickly that there's no performance hit?

    Apologies if it's not clear, I just don't want to carry on the way I am if by the end of it there's a long delay whilst data is loaded.

    Cheers

  • [quote:3b340lin]My question is are all the arrays loaded when I get to this layout (thus having a load effect when getting to the UI layout)? If they are, would it be beneficial to move these arrays to the specific layout that they're to be loaded for? Or are they loaded so quickly that there's no performance hit?

    If my understanding is correct, the array object should be loaded when you arrived to the layout it is on. This implies that it should be beneficial to move the arrays to the specific layout they are intended for.

    But regarding "whether they are loaded so quickly that there's no performance hit", this is actually a platform question and you must test on all platforms you wanna publish on. Obviously, desktops should be able to crunch through without any framerate drop, but for low-end mobile phone, this might not be the case. So which platforms are you publishing to need to be tested.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If my understanding is correct, the array object should be loaded when you arrived to the layout it is on. This implies that it should be beneficial to move the arrays to the specific layout they are intended for.

    Thanks very much keroberos. It might actually be beneficial to do it that for me as some of the "zones" I can just ctrl-c ctrl-v and edit the arrays as I see fit.

    But regarding "whether they are loaded so quickly that there's no performance hit", this is actually a platform question and you must test on all platforms you wanna publish on. Obviously, desktops should be able to crunch through without any framerate drop, but for low-end mobile phone, this might not be the case. So which platforms are you publishing to need to be tested.

    This is understandable, thank you. I think the arrays in the game will be the most demanding, it's very simple in terms of everything else. I have a first gen Moto E and iPhone 5 laying around so they will be my test beds. I'm not concerned with PC at the moment as i've no plans to steam release.

    Thanks for the info!

  • I don't think you need to worry about this. Loading of arrays, even gigantic ones, is negligible, and even then it's only done once. When it comes to arrays the only way it would slow things down is maybe if it's enormous (millions of values or something) and your events loop over it every tick.

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