View Issue Details

IDProjectCategoryView StatusLast Update
0000417FSSCPgraphicspublic2005-05-29 19:55
ReporterDa_Brain Assigned Totaylor  
PrioritynormalSeverityminorReproducibilityrandom
Status resolvedResolutionfixed 
Summary0000417: EFF explosions cause stuttering
DescriptionI have worked on some EFF explosions for Inferno, MindGames and The Bablyon Project.
Some people (including me) noticed a problem with EFFs used for explosions. It looks like some other people do not have this problem.
Problem:
During the 'playback' of the game stutters for a second.

The odd things is this only happens for fighter explosions. Captital ship explosions seem to work fine.

This happened with 512² and 256² DDS (S3 DXT1) frames. All have 0000070:0000040-70 frames.

I can't reproduce it. It just happens randomly.
Slasher reported it happend sometimes when the explosion was not even on the screen.
Additional InformationI'm using PhReAk's newest build for TBP and his Inferno build for Inferno.
In both cases D3D was used.

System specs:

Athlon XP 2,3 Ghz
1,5 GB Ram
Geforce 6800LE
Windows XP

If you need the explosions for testing, PM me on HLP. I can't post mod content here.

I'm not sure about it, but I think the stuttering always happens exactly in the middle of the explosion animation
TagsNo tags attached.

Activities

taylor

2005-05-19 17:20

administrator   ~0002432

Do it happen with anis of the same effect? To get the memory usage right create an ani that's half the size of each EFF frame (512² EFF frame -> 256² ANI frame). Memory size for an ANI will be doubled since it's converted to 16-bit. See if it still causes random stuttering.

EFFs are handled like ANIs are for all effects so it should really happen for both. The problem is likely that it's only loading some of the frames into video memory at a time since it gets filled up. When it explosion happens it will possibly empty the video memory to make room for more explosion frames and cause the stutter. I've seen this too for both EFF and ANI graphics which make use of a lot of frames.

I played around once with prioritizing certain graphics so that the most used images are always in video memory but that never worked right. Another thing I've been wanting to try is to create a bunch of blank surfaces in video memory and just page in the textures to those. So for something like an explosion there may be only one blank frame of the pariticular size in memory. The data from the other frames will just be uploaded to that same texture. Don't know how much that would help things though.

Da_Brain

2005-05-19 22:47

developer   ~0002433

I've just reworked exp05 for Inferno. So the frame count is the same. The effect itself looks almost identical. (I hope a bit better though.)

Before I replaced it, I had no problems.

Old effect 256² ANI, new effect 512² EFF (S3 DXT1).

It's rather odd. The shockwave has the same size and a high number of frames, but it never caused this problem.
What's even more odd, it the fact that capship explosions seem to work just fine, even though they use the same effect...

phreak

2005-05-20 01:12

developer   ~0002434

try my experimental build in the inferno internal. It only pages out ship textures when the mission ends, not if the last ship of that type is destroyed.

taylor

2005-05-20 02:16

administrator   ~0002435

Shockwave and explosion animations should never get paged out though. If anything is getting unloaded and is used later then it's a bug. That page out stuff should only hurt if it got broken with my newer bm_release stuff or if it's going through the pagefile. The ship texture page out stuff was really just to help reduce sound stuttering anyway so disabling it shouldn't hurt anything.

Also try this in OpenGL mode if you can DaBrain since it handles texture unloadint just a little bit differently. I have to wonder if possibly this isn't texture related at all but really an EFF problem, perhaps something with calculating the FPS. The code should be about the same for EFF and ANI so I can't think off the top of my head what the problem might be. I know that your other EFF effects always work great for me unless I'm really low on memory.

Da_Brain

2005-05-20 23:39

developer   ~0002437

Ok, I've tested the experimental build. It seemed to work fine, but I'll have to test this more intensive.

I'd like to test TBP with another build too. Is there a new build that has this pageout feature?

taylor

2005-05-20 23:51

administrator   ~0002438

Every build after Feb. 6th should have the ships page out code. Phreak's build should be the only recent one that doesn't have it. I'm all for disabling the code if it's causing problems but we need to make sure that we aren't trading stuttering graphics for stuttering sounds.

phreak

2005-05-21 03:48

developer   ~0002441

i didn't notice any sound stuttering when i had my experimental build running. If you'd like, i can ifdef out my code and commit it. Its kinda hackish though since i wanted to get it running in like 5 minutes.

taylor

2005-05-21 04:04

administrator   ~0002442

I never had sound stuttering problems either but others have reported them and this was an attempt, even if secondary in purpose, at a fix.

How much did you disable? Disabling the page out should just be commenting out that one line in ship_delete(). If that's all you did then just comment it and don't worry about an ifdef. If others have problems with sounds then we can just revisit it later, hopefully with a better solution. I'm assuming that you did more than that from your response though.

Da_Brain

2005-05-21 10:36

developer   ~0002445

Ok, I have tested this enough, I think. The experimental build fixed the problem.

Inferno runs fine now and it even worked with TPB. Though the build has a problem with some warp anis. I'll take a closer look later.

phreak

2005-05-21 14:08

developer   ~0002446

taylor: I have all paged in textured unloaded whenever the mission ends.

void bm_level_close()
{
    int num_unloaded=0;
    for (int i=0; i < MAX_BITMAPS; i++)
    {
        if (bm_bitmaps[i].preloaded)
        {
            bm_bitmaps[i].preload_count = 0;
            bm_bitmaps[i].load_count = 0;
            bm_unload(bm_bitmaps[i].handle);
            num_unloaded++;
        }
    }

    mprintf(("BMP: Unloaded %d bitmaps\n",num_unloaded));
}


this is called from game_level_close() (freespace.cpp, line 2130)
also bm_page_out() should return 0 instead of trying to free the texture.

taylor

2005-05-21 19:14

administrator   ~0002447

Last edited: 2005-05-21 20:40

<edited out the first part> I see what you're doing now with the unload_on_close thing. I had always thought about doing that given the memory usage when you get back to the mainhall. That works for me then so if you want to commit it go ahead.

If the EFF stutter thing is just the ship-page-out code then I'd prefer to only change that. Also bm_page_out() should still work so no changes to that please. The only place it's used right now (in CVS code anyway) is in ship_page_out_model_textures() which is only used in ship_delete(). I don't want to disable bm_page_out() just for that, remove that one call from ship_delete() and you get the same effect without disabling a function that could be used in other areas. The return value of bm_page_out() is set so that it can be used as a safety check for bm_release(). I have always intended to do more with bm_page_out() but that code never hit CVS and I haven't had the time to do what I wanted properly.

edited on: 05-21-05 16:40

taylor

2005-05-26 08:51

administrator   ~0002523

Ok, since Phreak's build seems to help this try my new one:
http://dynamic.gamespy.com/~freespace/forums/showthread.php?s=&threadid=32852

It's doesn't actually use Phreak's changes but does avoid paging out ship textures when that ship gets destroyed. If it's still working good with this build then we'll know that's all it took to fix the problem.

taylor

2005-05-29 19:55

administrator   ~0002527

Simply not unloading ship textures on ship_delete() appears to fix this. Just need to be more careful about how bm_page_out() gets used in the future to avoid calling it in busy situations.


Fixered.

Issue History

Date Modified Username Field Change
2005-05-19 15:03 Da_Brain New Issue
2005-05-19 17:20 taylor Note Added: 0002432
2005-05-19 17:20 taylor Status new => assigned
2005-05-19 17:20 taylor Assigned To => taylor
2005-05-19 22:47 Da_Brain Note Added: 0002433
2005-05-20 01:12 phreak Note Added: 0002434
2005-05-20 02:16 taylor Note Added: 0002435
2005-05-20 23:39 Da_Brain Note Added: 0002437
2005-05-20 23:51 taylor Note Added: 0002438
2005-05-21 03:48 phreak Note Added: 0002441
2005-05-21 04:04 taylor Note Added: 0002442
2005-05-21 10:36 Da_Brain Note Added: 0002445
2005-05-21 14:08 phreak Note Added: 0002446
2005-05-21 19:14 taylor Note Added: 0002447
2005-05-21 20:40 taylor Note Edited: 0002447
2005-05-26 08:51 taylor Note Added: 0002523
2005-05-29 19:55 taylor Status assigned => resolved
2005-05-29 19:55 taylor Resolution open => fixed
2005-05-29 19:55 taylor Note Added: 0002527