Animations: events or more images?

Discussion and feedback on Construct 2

Post » Tue Feb 14, 2012 6:10 pm

Wondering what's better for performance.
I'm starting to work on my animations for my game and since I could not find any info in manual or the forum I thought I ask.

Currently I have a sprite with event:
-lerp size,
-lerp opacity,
-if size = something -> lerp to different size and opacity
- and so on..

It's all good but I start to think, what if there's 100 objects like that. Lerping different values at same time.

Does using an animations instead of that would be more efficient at runtime?

In example, rather than
+Mouse: On left button Clicked on "Sprite"
-Sprite: Set width to lerp(self.Width,100,5*dt)
-Sprite: Set opacity to lerp(self.Opacity,0,5*dt)
- and so on...

do:
+Mouse: On left button Clicked on "Sprite"
-Sprite: Set animation to "On Click"

I'm aware that changing lerp to animations will increase significantly files size in the project due to adding more images to sprite required for animation. But let's not take memory into account and focus on performace only.shinkan2012-02-14 18:10:27
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Tue Feb 14, 2012 6:19 pm

Use lerp. Doesn't matter the number of objects. Simulating the effects of lerp in animations would be big and meaningless work, makes no sense at all. If JS can't handle some hundreds of lerp calculations in realtime than we're doomed.Kiyoshi2012-02-14 18:20:51
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Tue Feb 14, 2012 7:05 pm

Always, always animate objects by moving/rotating/resizing rather than making a sequence of animation frames. Doing it by animation frames will waste tonnes of memory unnecessarily! It's much better to do it by events, and it usually looks smoother too.Ashley2012-02-14 19:05:47
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Tue Feb 14, 2012 7:25 pm

Thanks guys. @Ashley is there a way to check how much memory current game is using?
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Wed Feb 15, 2012 11:12 am

@shinkan, there is indeed.
A helpful 'approx. N mb' is always displayed on the bottom bar.

B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Wed Feb 15, 2012 1:01 pm

@sqiddster yes heh, was thinking more of a video memory at run time :)
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Wed Feb 15, 2012 8:43 pm

Oh, whoops :)
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400


Return to Construct 2 General

Who is online

Users browsing this forum: humanescape, Mirlas and 2 guests