Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Trivial Psychic on November 23, 2006, 10:07:54 pm

Title: ANI Particles Causing Massive FPS Drop
Post by: Trivial Psychic on November 23, 2006, 10:07:54 pm
This has been reported a couple times in the Media VP thread, but I've just posted a Mantis bug-report and felt that it could do with a bit of combined exposure here.  The main problem reported was that the Hornet missile was causing a massive FPS hit.  I had a hunch that it was the particles in its exhaust that were the problem, since its the only missile that has them.  In idle conditions, I was getting about 60 fps, but firing off a double-fire volley of Hornets was bringing my FPS down to less than 10.  I extracted the modular table file from the effects MVP, and commented out the Hornet's particles, and the slowdowns went away.  Unfortunately, I get the same slowdowns with impact particles too.  Since both particles are ani, I'm thinking that there's something wrong with how anis are dealt with as effects.

I'm using 3.6.8 Zeta MV_Core, Textures, Effects, and Models, as well as the corresponding 710 patches, and I run on latest CVS, which is 2006/11/15 at this point, but I encountered this with 11/07 as well.  I haven't done a comprehensive check of all builds to see what builds aren't effected.

BUG 1154 (http://scp.indiegames.us/mantis/view.php?id=1154)
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Bobboau on November 23, 2006, 11:35:59 pm
how big are the ANIs?
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Wanderer on November 23, 2006, 11:49:39 pm
Its a known bug.. Exists only in CVS HEAD tree. And afaik fix already exists but just isnt committed to cvs. 
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Trivial Psychic on November 24, 2006, 05:07:10 am
how big are the ANIs?
Only 8 or 9 KB.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Johnmike on November 24, 2006, 06:54:39 pm
I get the same issue.  I get 90 FPS normally (VSYNC is on, refresh rate is 90Hz), but God forbid I look at my wingmen fire off a volley of hornets at a capital ship.  I get maybe 2FPS and the game is completely unplayable.  It goes away if I turn away.  I'll see if I can get a Fraps video of the game later (though frame rates will be lower when recording, you'll get an idea of what's going on).
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Johnmike on November 24, 2006, 10:10:34 pm
http://www.meikathon.net/FS2ChoppyMissiles.wmv


Youtube (lower quality): http://youtube.com/watch?v=DBelWShicxQ



C:\Games\FreeSpace2\fs2_open_r-P420061115.exe;
game_flags = -ambient_factor 75 -fov 0.50  -spec -glow -env -jpgtga -mipmap -missile_lighting -cache_bitmaps -dualscanlines -targetinfo -rearm_timer -ballistic_gauge -3dwarp -warp_flash -snd_preload -loadallweps -alpha_env -fps -pos -stats -coords -show_mem_usage ;
active_mod = mediavps;

Latest VPs from the installer.

Windows XP Pro x64
Athlon 64 4000+
VIA KT880
All-In-Wonder X800XT
Sound Blaster Audigy 2 ZS
SATA 7200RPM HDD

All drivers up to date.


Remember the video doesn't show just how dramatic the effect is.  Since Fraps was recording, I only got around at 20 FPS max, while I normally get 90FPS.  In BOTH cases it drops down to below 5 FPS and becomes completely unplayable when I watch my wingmen shoot off those missiles.  When I turn away, the frame rate goes back up.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: DrunkenPirate on November 25, 2006, 09:35:51 am
Oh so THIS is what's causing this damn mess.
Been trying to play over the last few days and got this 5 fps rubbish, thought my hardware was screwing up.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: CP5670 on November 25, 2006, 11:12:48 am
This really should have been fixed a while ago. I think the exact problem has been known for at least a month now and it has made a lot of builds essentially useless.

Just stick with one of the RC7 builds for now. I am using the dot9 build and haven't run into this issue.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: karajorma on November 25, 2006, 02:06:07 pm
To be honest I doubt that most of the people complaining should even be running CVS builds in the first place. Unless you're using the new team loadout (I can dream! :D) or WMCs newer version of the scripting or a few other features there isn't much good reason to be running CVS instead of 3.6.9.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: DrunkenPirate on November 26, 2006, 09:01:18 am
Where's this RC7dot9 build?  looked and only found a link to an August build.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: taylor on November 26, 2006, 12:27:49 pm
Where's this RC7dot9 build?  looked and only found a link to an August build.
The newest incanation is this one: http://icculus.org/~taylor/fso/testing/rc7dot9x.rar
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Mars on November 26, 2006, 09:08:41 pm
Can I get it for Linux?  :D
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: taylor on November 26, 2006, 09:22:56 pm
Can I get it for Linux?  :D
I suppose... http://icculus.org/~taylor/fso/testing/fs2_open-3.6.9-7dot9x.tar.bz2   :)



And before someone asks:  No, there will not be an OS X build.  There are several OS X specific issues that I want to look into before uploading a new build for the Mac.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: DrunkenPirate on November 27, 2006, 02:16:35 am
The newest incanation is this one: http://icculus.org/~taylor/fso/testing/rc7dot9x.rar
Thanks.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Mars on November 27, 2006, 07:32:24 am
Can I get it for Linux?  :D
I suppose... http://icculus.org/~taylor/fso/testing/fs2_open-3.6.9-7dot9x.tar.bz2   :)



And before someone asks:  No, there will not be an OS X build.  There are several OS X specific issues that I want to look into before uploading a new build for the Mac.

Thank ya  :D :yes:
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Flaser on November 30, 2006, 08:51:01 am
I wonder why we use ANIs to begin with IIRC using DDS compression is the way to go (and I always forget the format name the team came up with for the animated version).
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Trivial Psychic on November 30, 2006, 09:24:29 pm
You're thinking of EFFs, and AFAIK they aren't always more efficient.  Now, if you were to make 2 different EFFs, both using the same specs and the same sized images, except one used 24-bit DDS and the other used 8-bit PCX, the DDS one would definitely be the better choice, as the PCX files within an EFF are treated the same as PCX textures and are expanded into 16-bit memory.  The 8-bit PCX files within an ANI however, stay as 8-bit in memory so they take up less space.  What it comes down to, is if a compressed 24-bit DDS image takes up more memory than an uncompressed 8-bit PCX image.  If the answer is "NO", then ANIs still have their uses when it comes to small animations, but for things like shockwaves where you want a large range of colors and DDS-based EFF would be the format of choice.
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: taylor on November 30, 2006, 11:29:14 pm
The 8-bit PCX files within an ANI however, stay as 8-bit in memory so they take up less space.
Incorrect, most ANIs are converted to 16-bit images for each frame.  Only ANIs which have no color information will stay 8-bit, which pretty much only applies to talking head ANIs.  Talking head animations can't be EFFs anyway though so it's not really an issue.  Talking head animations also aren't used like effect animations, they are streamed, which means that there is always only one frame loaded anyway.

What it comes down to, is if a compressed 24-bit DDS image takes up more memory than an uncompressed 8-bit PCX image.
An EFF making use of DXT1a, DXT3 or DXT5 will take up the same amount of memory that an 8-bit PCX image will (if the 8-bit PCX image did not get converted to 16-bit).  A DXT1c however, will use less memory than an 8-bit PCX.


But once an effect animation is loaded, there is absolutely no usage difference between ANI and EFF.  The game uses them exactly the same.  The only difference is how much memory they use.  Technically an EFF should take a little longer to actually load the first time, since it has to search for each frame of the animation as a file, but then ANI frames have to actually be decoded to be used, and EFF frames (DDS at least) don't.  In the end it pretty much balances out.

And one thing that most people tend not to do (I don't think it's common knowledge anyway) is mix DDS formats for an EFF, even though that is explicitly allowed.  So you could really just base each frame on it's content, and use any mix of DXT1, DXT3, DXT5, or an uncompressed DDS format, in the same EFF.  As long as all of the frames are actually DDS then it would work.  This way you get maximum flexibility with the ability to both help save memory, and preserve the best visual quality possible for your EFF.  That capability was a main goal of the format. :)
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: Turey on December 01, 2006, 01:48:52 am
And one thing that most people tend not to do (I don't think it's common knowledge anyway) is mix DDS formats for an EFF, even though that is explicitly allowed.  So you could really just base each frame on it's content, and use any mix of DXT1, DXT3, DXT5, or an uncompressed DDS format, in the same EFF.  As long as all of the frames are actually DDS then it would work.  This way you get maximum flexibility with the ability to both help save memory, and preserve the best visual quality possible for your EFF.  That capability was a main goal of the format. :)

Really? So we could use DXT1a for the less detailed parts of the animation, saving memory, then step up to uncompressed for the more detailed frames?
Title: Re: ANI Particles Causing Massive FPS Drop
Post by: taylor on December 01, 2006, 02:09:39 am
Really? So we could use DXT1a for the less detailed parts of the animation, saving memory, then step up to uncompressed for the more detailed frames?
Yep.  Every frame must be the same file type (ie, DDS, TGA, JPG or PCX), but DDS is a containter format, so the data contained in it has nothing to do with the overall animation settings.  Just like with an ANI, each frame of an EFF effect is treated separately by the game.  EFF was designed to take full advantage of this, even though at the time it was made the support for DDS was rather minimal.  Outside of filenames, every frame of an EFF need only have a similar image width and height.  Everything from compression level, to base format, to color depth, and mipmap levels are considered individual settings for each frame.  You can even mix 24-bit images, with 16-bit images, with 32-bit images which have full alpha.  The game will just handle each frame by it's individual settings rather than as a whole for the EFF.

Even an EFF using JPG could have different compression levels for each frame, and save disk space by heavily compressing some frames, while having max quality on others (obviously this has nothing to do with memory usage though, it would be the same for each frame).  A TGA EFF gives you the same basic options, allowing 24-bit and 32-bit frames to be mixed together in the same animation.

That is a primary reason that EFF was never designed to be a container format, but instead have each frame as a separate file.  A container format would complicate that ability (though it would still be possible).  This is also why EFF can't be used for streaming animations (like interface stuff or talking head animations), since is was tailored specifically for effects use.  There is a new format coming which will offer a better-than-ANI steaming animation, and will be specifically tailored to that usage.