FAForever / fa

Lua code for FAF
221 stars 228 forks source link

Reduce the lifetime for water trail emitters #6089

Closed Garanas closed 2 months ago

Garanas commented 3 months ago

Description of the proposed changes

This reduces the life time of water trails to a similar value to what we have for footprints and tread marks. When you zoom out and back in all emitters are recomputed. The water trails are surprisingly complex (multiple emitters per unit that last 10 to 15 seconds on average) and are therefore a prime target for a frame time spike.

Adjusted life time

https://github.com/FAForever/fa/assets/15778155/3e303f38-4407-4596-9ae9-67d19e7adab5

Old life time

https://github.com/FAForever/fa/assets/15778155/805732a5-cd19-4762-821f-d9f77e27681a

Testing done on the proposed changes

Spawn in naval units and observe the trail.

Additional context

I'd also like to review the other water trail effects.

Rebased version of https://github.com/FAForever/fa/pull/6088

Checklist

Garanas commented 3 months ago

The emitters are determined by the terrain type definitions, specifically:

            Water = {
                AeonGroundFX01 = { EmitterBasePath .. 'aeon_groundfx_emit.bp', },
                AeonGroundFXT1Engineer = { EmitterBasePath .. 'aeon_t1eng_groundfx01_emit.bp', },
                AeonGroundFXT2Engineer = {
                    EmitterBasePath .. 'aeon_t2eng_groundfx01_emit.bp',
                    EmitterBasePath .. 'aeon_t2eng_groundfx02_emit.bp',
                },
                BackWake = {
                    EmitterBasePath .. 'water_move_trail_back_02_emit.bp',
                    EmitterBasePath .. 'water_move_trail_back_03_emit.bp',
                    EmitterBasePath .. 'water_move_trail_back_04_emit.bp',
                },
                Hover01 = { EmitterBasePath .. 'tt_water_hover01_01_emit.bp', },
                LeftFrontWake = { EmitterBasePath .. 'water_move_wake_front_l_01_emit.bp', },
                RightFrontWake = { EmitterBasePath .. 'water_move_wake_front_r_01_emit.bp', },
                SeraphimGroundFX01 = {
                    EmitterBasePath .. 'seraphim_groundfx_emit.bp',
                    EmitterBasePath .. 'seraphim_groundfx_02_emit.bp',
                },
                SeraphimGroundFX02 = {
                    EmitterBasePath .. 'seraphim_groundfx_03_emit.bp',
                    EmitterBasePath .. 'seraphim_groundfx_04_emit.bp',
                },
            },
BlackYps commented 2 months ago

I like that the water trails look more reasonable in general now. We could further improve the visuals by changing that second emitter that creates this shorter trail. It looks kinda weird at the moment. I am not quite sure what it is supposed to represent. Maybe it is supposed to mimick the dissipating foam... I would suggest either making the lifetime longer and varying the lifetime a lot to better achieve this effect, or to remove it entirely. grafik

Garanas commented 2 months ago

It is supposed to be this:

image

I can make it slightly shorter and close to the unit.

Garanas commented 2 months ago

I'm merging this in as it works on its own. Additional changes can be done via new pull requests