What is the better way to use event?

Discussion and feedback on Construct 2

Post » Tue Oct 11, 2016 1:06 pm

Hello there!

I'm always making games in construct 2 and i like to make a function with a single blank event inside, becouse i can minimize a function to see better all the codes and every function that i have. I want to know if this is a bad thing to do or not.

Example:
Image
B
14
S
6
G
2
Posts: 81
Reputation: 2,241

Post » Tue Oct 11, 2016 1:52 pm

I use number 1 just in case in the future I have to put an "if" or "else" statement it will be easier. So go with number 1 so in case you want to make changes to code, its very easy.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 682
Reputation: 16,645

Post » Tue Oct 11, 2016 2:20 pm

PixelPower wrote:I use number 1 just in case in the future I have to put an "if" or "else" statement it will be easier. So go with number 1 so in case you want to make changes to code, its very easy.


Me too, but, do u think this can be make a code be slow and heavy? :?:
B
14
S
6
G
2
Posts: 81
Reputation: 2,241

Post » Tue Oct 11, 2016 2:23 pm

It will have no effect on speed.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Tue Oct 11, 2016 2:29 pm

andykenobi wrote:
PixelPower wrote:I use number 1 just in case in the future I have to put an "if" or "else" statement it will be easier. So go with number 1 so in case you want to make changes to code, its very easy.


Me too, but, do u think this can make the code be slow and heavy? :?:
B
14
S
6
G
2
Posts: 81
Reputation: 2,241

Post » Tue Oct 11, 2016 2:53 pm

There is no effect on speed if you do 1.
You can simply do the performance check yourself by calling a function 1 thousand times using coding via 1 and 2.
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Tue Oct 11, 2016 3:30 pm

You can use both. I usually use "1" but I also use "2" for ordered events.

Performance difference? "None" , both runs the same on export.
Even if in theory 1 is faster, no one would volunteer to prove it considering it's insignificance.
Don't focus your time on minor details, my mistake when I was still learning C2 ;-) .
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
67
S
22
G
90
Posts: 1,125
Reputation: 60,036

Post » Tue Oct 11, 2016 4:40 pm

Sethmaster wrote:There is no effect on speed if you do 1.
You can simply do the performance check yourself by calling a function 1 thousand times using coding via 1 and 2.


Cool, good to know, thanks! :D
B
14
S
6
G
2
Posts: 81
Reputation: 2,241

Post » Tue Oct 11, 2016 4:41 pm

chadorireborn wrote:You can use both. I usually use "1" but I also use "2" for ordered events.

Performance difference? "None" , both runs the same on export.
Even if in theory 1 is faster, no one would volunteer to prove it considering it's insignificance.
Don't focus your time on minor details, my mistake when I was still learning C2 ;-) .


I use 1 normaly, but i always get this question... :D thanks!
B
14
S
6
G
2
Posts: 81
Reputation: 2,241

Post » Wed Oct 12, 2016 8:00 am

first is better. 2nd is a subevent which probably causes a minor cpu intruction to change where it reads the next action, and checks for empty condition, while first just executes what it was called for. yes you won't notice any performance loss on such small things, but if you make 10k events game where you wrote every event like that (2nd) you might feel a small performance drop 1-2fps max. and that's going too far anyway.

i just prefer not wasting space and even every microsecond of processing :)
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,455


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests