Does amount of Events impact speed?

Post » Tue Apr 18, 2017 8:41 pm

Generally, does the amount of events impact speed?
Say you have an action that takes 10 Events to do a certain task...maybe lets say something simple like movement and flipping animations etc.
If you do that same task in a different way and it takes 5 events, does it speed up the game or does it not really matter much when run?
In other words does the task (what it's performing) have more impact than the number of events?
Does the amount of sub events impact speed more than just usign a regular event.

I know this is kindof a general question but i'm trying to test some things w.r.t performance.
B
28
S
7
G
4
Posts: 204
Reputation: 4,863

Post » Tue Apr 18, 2017 9:05 pm

I'm guessing there is a difference in performance depending on the amount of events you have, but a difference between 5 and 10 events is probably insignificant. The amount and type of actions you have in each event has a lot to do with it too.
B
16
S
7
Posts: 190
Reputation: 1,823

Post » Tue Apr 18, 2017 9:18 pm

Moot wrote:I'm guessing there is a difference in performance depending on the amount of events you have, but a difference between 5 and 10 events is probably insignificant. The amount and type of actions you have in each event has a lot to do with it too.

That's exactly what I am trying to make a conclusion on.
Is the 10 Events with 1 action in each faster than 5 events with 2 actions each? I'm wondering if it will be a Moot point :D
and then in actual fact be the same in performance wise.
I know I'm over simplifying it but I suppose we can make the numbers say 100 events with 1 action each vs 50 events with 2 actions each. :geek:
B
28
S
7
G
4
Posts: 204
Reputation: 4,863

Post » Tue Apr 18, 2017 10:47 pm

I think the actual actions that are performed is more relevant in determining the processing speed than the number of events/sub-events.
I also would put a priority on creating events that can easily be scaled; ie, constructing your events so that it allows you to expand the game. If you focus too much on trying to combine everything together, then you'll begin to get stuff entangled and it will be difficult to expand your game. It took me a long time figuring out how important this is.
B
43
S
19
G
65
Posts: 1,105
Reputation: 37,949

Post » Tue Apr 18, 2017 10:49 pm

It depends on what the events are doing.
If you are checking collisions on hundreds of objects then that particular event will slow down the system, especially if it's doing it every tick.
If all its doing is setting an objects opacity to the same value, then no it won't adversely degrade fps, .....unless you have hundreds if not thousands of instances doing that.
Adding extra events to stop it setting the opacity don't add any overhead either.

Unless you have hundreds if not thousands of instances doing that every tick.

So basically, adding extra events to stop unnecessary repetition are the way to go.
Image ImageImage
B
169
S
50
G
170
Posts: 8,292
Reputation: 108,728

Post » Wed Apr 19, 2017 8:57 am

Thanks people.
B
28
S
7
G
4
Posts: 204
Reputation: 4,863

Post » Wed Apr 19, 2017 9:24 am

Another good tip.

Good practice is to have as few events running as possible. Place events in groups and close the groups when they are not needed. Constantly having the event sheet check through all the conditions will get heavier the more you have.

For example: If you have an event checking the distance between objects, and none of these objects are visible on screen at the moment you can pretty much disable disable those events by putting them in a group and disable the group altogether.

That's one of the major optimizations i did for my mobile games that gave me a lot more bang for the buck.

I had a quite a lot of stuff constantly checking in the background every tick, after optimizations like that, basically my game was actually really using about 20% of all the events at any given moment, instead of checking through all of them. A lot of small things add up. :)

So for now i always think like this.

The best code is no code at all.
You'll have much better performance the less your game is doing every single tick. Closing groups, and using every X seconds instead of every tick can boost performance quite a bit. Especially on mobile where you have pretty limited CPU power.
Follow my progress on Twitter
or in this thread Archer Devlog
B
38
S
15
G
17
Posts: 949
Reputation: 12,320

Post » Wed Apr 19, 2017 10:04 am

There's no clear answer to your question: 5 events could be slower, the same or faster than 10 events. It depends on too many things. The only thing that matters, and the only thing you should ever do, is make actual measurements. If you don't make measurements, you're just making things up.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Wed Apr 19, 2017 5:49 pm

Havok wrote: I'm wondering if it will be a Moot point :D


:lol:
B
16
S
7
Posts: 190
Reputation: 1,823

Post » Wed Apr 19, 2017 10:26 pm

Correct me if I'm wrong but I got the impression Havok is asking if there's a performance overhead to events themselves, regardless of conditions. Like, will a thousand empty events running every tick bog things down for instance?
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Next

Return to General Discussion

Who is online

Users browsing this forum: alspal and 0 guests