Caching animations or sound files?
by BeyondtheTech · in iTorque 2D · 05/28/2009 (1:16 pm) · 2 replies
In my game, the first time an animation or a sound file is used, the engine will stutter for a quick second. Is there any way of pulling in the animation or sound before the game starts, so that the user will never experience it in the game?
Just a hack of an idea, but I'm thinking of playing the animation with the alpha set to near 0. Likewise, I can probably play a sound at near 0 volume. Perhaps that will do the trick? I have a lot of animations and sound files, so I'd rather not clutter up either the memory or the time before the game starts.
Just a hack of an idea, but I'm thinking of playing the animation with the alpha set to near 0. Likewise, I can probably play a sound at near 0 volume. Perhaps that will do the trick? I have a lot of animations and sound files, so I'd rather not clutter up either the memory or the time before the game starts.
#2
06/02/2009 (6:31 am)
If you set the animation t2dImageMapDatablock or sound AudioProfile to preload (add preload = "1" or "true" to the object definition) you shouldn't see a stutter.
Torque 3D Owner Mat Valadez
Default Studio Name
On first alxPlay, it seems to be going that route and loading the info, and subsequently using the loaded info.
It shouldn't take more than a few minutes to make a new consoleFunction (alxLoad perhaps?) that does exactly what that alxPlay() does, except skips the actual playing part (line941).
Copy/paste the alxPlay ConsoleFunction and C function, rename them and take out that last bit about playing the sound.