I hear that too many global variables can bog a game down...

Just started using Construct 2? Post your questions here

Post » Tue Mar 25, 2014 2:31 am

Is that true? If so, how many is too many?
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Tue Mar 25, 2014 3:09 am

Having a bunch of variables shouldn't be a big deal.
Doing something to a bunch of variables each tick is.
Image ImageImage
B
169
S
50
G
174
Posts: 8,325
Reputation: 110,794

Post » Tue Mar 25, 2014 12:41 pm

No, global variables can probably be entirely ignored from a performance point of view, they are so fast as to effectively have zero impact. A pretty much complete list of things you should worry about for performance is here: https://www.scirra.com/manual/134/performance-tips - anything not listed there is probably not a concern.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Tue Mar 25, 2014 1:39 pm

But still I recommend to use local variables, since too many global variables will be very confusing
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Tue Mar 25, 2014 3:30 pm

@Ashley and everyone - thanks.
Image
B
20
S
4
Posts: 382
Reputation: 2,974


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests