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
5
Posts: 382
Reputation: 3,094

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
178
S
50
G
206
Posts: 8,692
Reputation: 127,727

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
414
S
245
G
92
Posts: 25,207
Reputation: 200,365

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
5
Posts: 382
Reputation: 3,094


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests