diff --git a/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs b/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs index c1a4d0c143..e2a739be9f 100644 --- a/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs +++ b/OpenRA.Mods.Common/Traits/World/WeatherOverlay.cs @@ -27,10 +27,10 @@ namespace OpenRA.Mods.Common.Traits public readonly bool ChangingWindLevel = true; [Desc("The levels of wind intensity (particles x-axis movement in px/tick).")] - public readonly int[] WindLevels = { -5, -3, -2, 0, 2, 3, 5 }; + public readonly int[] WindLevels = { -12, -7, -5, 0, 5, 7, 12 }; [Desc("Works only if ChangingWindLevel is enabled. Min. and max. ticks needed to change the WindLevel.")] - public readonly int[] WindTick = { 150, 750 }; + public readonly int[] WindTick = { 150, 550 }; [Desc("Hard or soft fading between the WindLevels.")] public readonly bool InstantWindChanges = false; @@ -45,13 +45,13 @@ namespace OpenRA.Mods.Common.Traits public readonly int[] ScatterDirection = { -1, 1 }; [Desc("Min. and max. speed at which particles fall in px/tick.")] - public readonly float[] Gravity = { 1.00f, 2.00f }; + public readonly float[] Gravity = { 2.5f, 5f }; [Desc("The current offset value for the swing movement. SwingOffset min. and max. value in px/tick.")] - public readonly float[] SwingOffset = { 1.0f, 1.5f }; + public readonly float[] SwingOffset = { 2.5f, 3.5f }; [Desc("The value that particles swing to the side each update. SwingSpeed min. and max. value in px/tick.")] - public readonly float[] SwingSpeed = { 0.001f, 0.025f }; + public readonly float[] SwingSpeed = { 0.0025f, 0.06f }; [Desc("The value range that can be swung to the left or right. SwingAmplitude min. and max. value in px/tick.")] public readonly float[] SwingAmplitude = { 1.0f, 1.5f }; @@ -140,6 +140,7 @@ namespace OpenRA.Mods.Common.Traits long windUpdateCountdown; Particle[] particles; Size viewportSize; + long lastRender; public WeatherOverlay(World world, WeatherOverlayInfo info) { @@ -197,6 +198,12 @@ namespace OpenRA.Mods.Common.Traits var viewport = new Rectangle(center - new int2(viewportSize) / 2, viewportSize); var wcr = Game.Renderer.WorldRgbaColorRenderer; + // SwingSpeed is defined in px/tick so we must account for the fraction of a tick that elapsed since the last render. + // The scale is capped at 1 tick to avoid unexpected behaviour at game start, if RunTime overflows, or if the game stalls. + var runtime = Game.RunTime; + var tickFraction = Math.Min((runtime - lastRender) * 1f / world.Timestep, 1); + lastRender = runtime; + for (var i = 0; i < particles.Length; i++) { // Simulate wind and gravity effects on the particle @@ -208,7 +215,7 @@ namespace OpenRA.Mods.Common.Traits swingDirection *= -1; var swingOffset = p.SwingOffset + p.SwingDirection * p.SwingSpeed; - var pos = p.Pos + new float2(p.DirectionScatterX + p.SwingOffset + windStrength, p.Gravity); + var pos = p.Pos + tickFraction * new float2(p.DirectionScatterX + p.SwingOffset + windStrength, p.Gravity); particles[i] = p = new Particle(p, pos, swingDirection, swingOffset); } diff --git a/mods/cnc/maps/gdi06/rules.yaml b/mods/cnc/maps/gdi06/rules.yaml index a520ea0f2e..10606c9bc6 100644 --- a/mods/cnc/maps/gdi06/rules.yaml +++ b/mods/cnc/maps/gdi06/rules.yaml @@ -6,12 +6,10 @@ World: StartingMusic: rain WeatherOverlay: ChangingWindLevel: true - WindLevels: -5, -3, -2, 0, 2, 3, 5 - WindTick: 150, 550 InstantWindChanges: false UseSquares: false ScatterDirection: 0, 0 - Gravity: 8.00, 12.00 + Gravity: 15, 25 SwingOffset: 0, 0 SwingSpeed: 0, 0 SwingAmplitude: 0, 0 diff --git a/mods/ra/maps/a-nuclear-winter/rules.yaml b/mods/ra/maps/a-nuclear-winter/rules.yaml index d43c18baaf..7eb2868642 100644 --- a/mods/ra/maps/a-nuclear-winter/rules.yaml +++ b/mods/ra/maps/a-nuclear-winter/rules.yaml @@ -1,16 +1,10 @@ World: WeatherOverlay: ChangingWindLevel: true - WindLevels: -5, -3, -2, 0, 2, 3, 5, 6 - WindTick: 150, 550 InstantWindChanges: false UseSquares: true ParticleSize: 2, 3 ScatterDirection: -1, 1 - Gravity: 1.00, 2.00 - SwingOffset: 1.0, 1.5 - SwingSpeed: 0.001, 0.025 - SwingAmplitude: 1.0, 1.5 ParticleColors: ECECEC, E4E4E4, D0D0D0, BCBCBC LineTailAlphaValue: 0 GlobalLightingPaletteEffect: diff --git a/mods/ra/maps/fort-lonestar/rules.yaml b/mods/ra/maps/fort-lonestar/rules.yaml index 88ecfaf4a7..93a14b31b5 100644 --- a/mods/ra/maps/fort-lonestar/rules.yaml +++ b/mods/ra/maps/fort-lonestar/rules.yaml @@ -10,7 +10,7 @@ World: WindTick: 150, 550 UseSquares: false ScatterDirection: 0, 0 - Gravity: 8.00, 12.00 + Gravity: 15, 25 SwingOffset: 0, 0 SwingSpeed: 0, 0 SwingAmplitude: 0, 0 diff --git a/mods/ra/maps/shattered-mountain/rules.yaml b/mods/ra/maps/shattered-mountain/rules.yaml index bf37c5cfbb..fa53327a7f 100644 --- a/mods/ra/maps/shattered-mountain/rules.yaml +++ b/mods/ra/maps/shattered-mountain/rules.yaml @@ -1,17 +1,10 @@ World: WeatherOverlay: ChangingWindLevel: true - WindLevels: -5, -3, -2, 0, 2, 3, 5, 6 - WindTick: 150, 550 InstantWindChanges: false UseSquares: true ParticleSize: 2, 3 ParticleDensityFactor: 8 - ScatterDirection: -1, 1 - Gravity: 1.00, 2.00 - SwingOffset: 1.0, 1.5 - SwingSpeed: 0.001, 0.025 - SwingAmplitude: 1.0, 1.5 ParticleColors: ECECEC, E4E4E4, D0D0D0, BCBCBC LineTailAlphaValue: 0 GlobalLightingPaletteEffect: diff --git a/mods/ra/maps/snow-town/rules.yaml b/mods/ra/maps/snow-town/rules.yaml index 80146bdd71..0c568b5b2e 100644 --- a/mods/ra/maps/snow-town/rules.yaml +++ b/mods/ra/maps/snow-town/rules.yaml @@ -1,16 +1,8 @@ World: WeatherOverlay: ChangingWindLevel: true - WindLevels: -5, -3, -2, 0, 2, 3, 5 - WindTick: 150, 550 InstantWindChanges: false UseSquares: true - ParticleSize: 1, 3 - ScatterDirection: -1, 1 - Gravity: 1.00, 2.00 - SwingOffset: 1.0, 1.5 - SwingSpeed: 0.001, 0.025 - SwingAmplitude: 1.0, 1.5 ParticleColors: ECECEC, E4E4E4, D0D0D0, BCBCBC LineTailAlphaValue: 0 GlobalLightingPaletteEffect: