Question about Arrays and performance

Get help using Construct 2

Post » Mon Apr 25, 2016 12:48 pm

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
In development: Avalon Isle
B
12
S
4
G
1
Posts: 44
Reputation: 1,496

Post » Mon Apr 25, 2016 2:49 pm

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.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Mon Apr 25, 2016 3:29 pm

keroberos wrote: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.

keroberos wrote: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!
In development: Avalon Isle
B
12
S
4
G
1
Posts: 44
Reputation: 1,496

Post » Mon Apr 25, 2016 6:19 pm

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.
B
94
S
33
G
114
Posts: 5,357
Reputation: 73,775


Return to How do I....?

Who is online

Users browsing this forum: warmty and 20 guests