pre-load sprites?

Started by Divon, Fri 04/12/2009 23:59:48

Previous topic - Next topic

Divon

This is going to sound fairly stupid I'm sure, and honestly I'm not even sure if I'm phrasing it in a logical way, but here goes:

I have several fairly complex animations near the beginning of my game. 

One in quite literally the first room, that begins the moment the first room loads.

One within the first minute or so of the game being launched.

When I say fairly complex animations, I mean more than 30 or so frames of animation, 32-bit, alpha channels, etc.

Here is the problem:

When both of these animations play at first they are fairly laggy (I'm running the game on a dual core 3GHz box, 4 gigs of DDR2 RAM, and a GeForce GTX260 video card, so a very beefy PC).

However, if I cause the 2nd animation to replay itself, or if I F9 to restart the game for the original animation, everything runs smooth as butter, without any hint of choppiness.

Is there a trick to avoiding this issue that I'm not aware of?  Its definetly not the PC...just to be sure I've tried it on two other PC's (one much, much slower, one significantly faster) and the problem is identical.  The slow machines performance is identical to my main PC.

Thoughts?

GarageGothic

You could play the animation on an invisible object first, then the sprites should be preloaded in memory for when you actually need them. Not sure if it's necessary to play the whole animation or just assign the View to the object to make it preload all the frames.

Pumaman

What size are the animation sprites? If they're full screen-sized and you're using the Direct3D driver then it will take a while to load them into video memory initially.

If you're using D3D, try switching to the DX5 driver and see if you get the same thing.

Divon

changing to the DirectDraw5 driver doesn't help any unfortunately.  I think I may have found a couple work arounds / code improvements that will help somewhat, but its more of a band-aid fix than anything. 

In the initial animation I can get away without using a lot of the alpha channels, and in the 2nd animation I'm taking advantage of the "EpicShadows" module, which I really dont need to be. I can easily draw my own shadows for those frames in the artwork itself.

I'm going to thoroughly test the idea of assigning the view to invisible objects before I need them though, thats a great suggestion.  I'll post my findings here :)

SMF spam blocked by CleanTalk