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: 3,004

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
172
S
50
G
183
Posts: 8,442
Reputation: 115,603

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
403
S
238
G
89
Posts: 24,653
Reputation: 196,143

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: 3,004


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests