Engine Trails and explosions .. possible fix

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

Post Reply
ihaveamo
Above Average
Above Average
Posts: 18
Joined: Mon Feb 01, 2016 10:56 am

Engine Trails and explosions .. possible fix

Post by ihaveamo »

Just wanted to ask other peoples experiences with oolite.oxp.Norby.Trails.oxz

Often during explosions, trails goes up to 900 or so entities, bringing framerate down to 3 or 4 FPS for minutes at a time. Most people I've given OOLITE to, have this happen, and they get very frustrated during ship fights... It's a pity as trails look AMAZING!!!!

A good example is shooting at a refuel station. About 500 entities are created, even before it explodes, bringing FPS down to almost 0. Explosions often happen during fights (duh) which is when low-frame-rate becomes a joy-killer.

I've managed to reduce this happening by changing a few lines in trails.js .. give it a go if you like!

Dropping maximum entities down to 400 instead of 1000 makes a huge FPS difference during explosions..

if( a > 400 && w.$Length > 10 ) { //low fps or too much entity


Also, the TRAILS script has a hard-set of 15fps .. don't know about you but 15 FPS is way too jumpy. ... so having this higher by default would be cool :) :)

this.$MinFPS = 35; //if fall below then will reduce the max. dataKey number

The best fix would be to possibly remove trails on explosion fragments (which is again, a pity as it's quite pretty), but the FPS hit is just too much. :roll:

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2559
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Engine Trails and explosions .. possible fix

Post by Norby »

Thank you for the report! Now I tried Fuel Station but the extra entities at me mostly created by [wiki]CustomShields[/wiki] like in [wiki]Fireworks[/wiki].

Wreckages defined in core game are set to scan_class="CLASS_NO_DRAW"; which is already excluded in Trails v1.2 so unless you have a very old early version of Trails then only another OXP which add different wreckages could cause slowdown at explosions. I added a possible speedup for these in the new Trails v1.3, please try it.

Your idea about entity limit could work, just 400 is often happen in normal situations also so I think raising MinFPS is the first which worth a try and limit only if that is not enough.

I do not recommend to increase MinFPS to 30 or more due to the game has a built-in FPS limit at 60 and my code increase the quality when it is possible via checking the FPS against the double of MinFPS. If it is 30 then never can get back the somewhat better looking trails. So now I set it to 25 by default and when dropped below then can go back over 50.

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5465
Joined: Wed Feb 28, 2007 7:54 am

Re: Engine Trails and explosions .. possible fix

Post by another_commander »

Norby wrote:I do not recommend to increase MinFPS to 30 or more due to the game has a built-in FPS limit at 60 [...]
This is not entirely correct. The game will attempt to sync its framerate with your monitor refresh rate, which in most cases is 60Hz. But it does not limit its FPS to 60 unless you explicitly set the (undocumented) animation_timer_interval key in your .GNUstepDefaults to the value of 0.0167.

If your monitor has a higher refresh rate than 60Hz (say 75Hz), Oolite will try to sync to that. Also, if you disable v-sync in your .GNUstepDefaults (or maybe in your gfx driver), the game will run at the maximum framerate it can achieve. This is the case under Windows, but I believe Linux will work the same in that regard.

Edit to add: The current frames per sec cap is 200, but it is changeable via animation_timer_interval, as mentioned above. If you want to use that key, its value should be 1.0 / DesiredFPS.

User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 13805
Joined: Sat Jul 04, 2009 9:31 pm
Location: Corke's Drift
Contact:

Re: Engine Trails and explosions .. possible fix

Post by Cody »

another_commander wrote:But it does not limit its FPS to 60 unless you explicitly set the (undocumented) animation_timer_interval key in your .GNUstepDefaults to the value of 0.0167.
I'd been trying to recall that key for a while - thanks!

ihaveamo
Above Average
Above Average
Posts: 18
Joined: Mon Feb 01, 2016 10:56 am

Re: Engine Trails and explosions .. possible fix

Post by ihaveamo »

Thanks, Norby :D

Great community where fixes like this are implemented so fast :)

FPS may well be impacted by the interaction of TRAILS and some other wreckage-producing addons, as you suggested.

Downloading the new trails 1.5 OXZ now and giving it a go. Will report back !

ihaveamo
Above Average
Above Average
Posts: 18
Joined: Mon Feb 01, 2016 10:56 am

Re: Engine Trails and explosions .. possible fix

Post by ihaveamo »

Reporting back as planned - You have fixed it :D

It's a seriously beautiful thing to see engine trails, big explosions and no FPS slowdowns. A dream come true.

Post Reply