[Solved] Performance Impact on Code/Event Sheets

Get help using Construct 2

Post » Sat Mar 08, 2014 1:52 am

Hello. :)

I hope this kind of question is in the correct place.

Is there any benefit in using event sheets like the scripts in other program languages?

Does it save performance if I link the content of huge if statements to event sheets?

Thank you.
Last edited by Alyra Games on Tue Mar 11, 2014 9:14 pm, edited 1 time in total.
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Sat Mar 08, 2014 2:07 am

An event sheet is directly tied to a specific layout. All of that layout's specific code is place on the event sheet.

So if you have a button on the Layout, you can tell the program what to do when a user presses that button on the Event Sheet tied to that Layout.
B
19
S
7
G
7
Posts: 88
Reputation: 4,117

Post » Sat Mar 08, 2014 2:16 am

Thank you for the answer but you misunderstood me. Maybe I explained myself badly.

I mean:

Does it has advantages if I create new event sheets for big blocks of code like the AI? In programming languages you can call a Script. In construct 2 there is an option to use event sheets like scripts. But I'm not sure if this is of advantage in construct 2.
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Sat Mar 08, 2014 2:28 am

I understand now.

Sure it is, you can have many layouts that access the same code so you won't have to copy that code to every layout.
B
19
S
7
G
7
Posts: 88
Reputation: 4,117

Post » Sat Mar 08, 2014 2:40 am

Okay this makes sense, thank you.

And if I only have one layout? Does it safe performance if I avoid giant blocks of code?

For example if there is an "if statement" (if x=1) with 1000 lines of code in it. Does it take processing power to skip this huge "if statement" if x is not 1? Because if this is true, than using event sheets instead, whould also make sense.
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Sat Mar 08, 2014 6:41 am

I'm actually curious about this, as well. I've been adding enemies to my game, and checking the debugger, even when the enemies aren't in the layout, the code still seems to grab a 0.1% or 0.2% of my CPU usage.
B
40
S
12
G
1
Posts: 533
Reputation: 4,149

Post » Sat Mar 08, 2014 6:44 am

I've got 20 different events sheets to more easily manage different parts of my code. There shouldn't be a huge performance impact if you make sure any code that isn't relevant to what's currently going on in the game isn't being checked. Even if you don't worry about that tiny little bit of optimization (like turning groups on/off to turn sections of code on/off), it doesn't seem to noticeably impact performance.

Keep in mind you can also include different sets of events sheets with other layout-associated event sheets, so if for example there are no enemies on a specific layout, just don't have the event sheet with the enemy behaviors as one of those included with that layout.
B
80
S
46
G
24
Posts: 525
Reputation: 20,955

Post » Sat Mar 08, 2014 4:24 pm

So does this mean using multiple event sheets (as "scripts") does safe performance?
B
10
S
2
Posts: 135
Reputation: 1,090


Return to How do I....?

Who is online

Users browsing this forum: MathNook and 39 guests