Progress on new SFX (WIP)

Pitch is broken in the sound engine - this has already been fixed, but I haven't updated the natives
This commit is contained in:
Anuken 2025-11-07 15:53:13 -05:00
parent 5397d8426c
commit 3f2aba4123
23 changed files with 86 additions and 46 deletions

Binary file not shown.

BIN
core/assets/sounds/fuse.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -3,7 +3,6 @@ package mindustry.audio;
import arc.*; import arc.*;
import arc.audio.*; import arc.audio.*;
import arc.struct.*; import arc.struct.*;
import mindustry.gen.*;
import static mindustry.gen.Sounds.*; import static mindustry.gen.Sounds.*;
@ -36,13 +35,13 @@ public class SoundPriority{
respawning respawning
); );
//this is spammed a LOT
Sounds.shootBig.setMinConcurrentInterrupt(shootBig.getLength() * 0.9f);
for(var sound : Core.assets.getAll(Sound.class, new Seq<>())){ for(var sound : Core.assets.getAll(Sound.class, new Seq<>())){
sound.setMinConcurrentInterrupt(Math.min(0.25f, sound.getLength() * 0.5f)); sound.setMinConcurrentInterrupt(Math.min(0.25f, sound.getLength() * 0.5f));
sound.setMaxConcurrent(7);
} }
mechStep.setMinConcurrentInterrupt(0.3f);
mechStep.setMaxConcurrent(3);
} }
static void set(float value, Sound... sounds){ static void set(float value, Sound... sounds){

View file

@ -3290,6 +3290,7 @@ public class Blocks{
} }
}}; }};
shootSound = Sounds.shootDuo;
recoil = 0.5f; recoil = 0.5f;
shootY = 3f; shootY = 3f;
reload = 20f; reload = 20f;
@ -3792,7 +3793,7 @@ public class Blocks{
ammoUseEffect = Fx.casing2; ammoUseEffect = Fx.casing2;
scaledHealth = 240; scaledHealth = 240;
shootSound = Sounds.shootBig; shootSound = Sounds.shootFast;
limitRange(); limitRange();
coolant = consumeCoolant(0.2f); coolant = consumeCoolant(0.2f);
@ -3891,7 +3892,7 @@ public class Blocks{
envEnabled |= Env.space; envEnabled |= Env.space;
scaledHealth = 220; scaledHealth = 220;
shootSound = Sounds.shotgun; shootSound = Sounds.fuse;
coolant = consumeCoolant(0.3f); coolant = consumeCoolant(0.3f);
float brange = range + 10f; float brange = range + 10f;
@ -3917,25 +3918,31 @@ public class Blocks{
ripple = new ItemTurret("ripple"){{ ripple = new ItemTurret("ripple"){{
requirements(Category.turret, with(Items.copper, 150, Items.graphite, 135, Items.titanium, 60)); requirements(Category.turret, with(Items.copper, 150, Items.graphite, 135, Items.titanium, 60));
ammo( ammo(
Items.graphite, new ArtilleryBulletType(3f, 20){{ Items.graphite, new ArtilleryBulletType(3f, 40){{
hitEffect = new MultiEffect(Fx.flakExplosion, Fx.shockwaveSmaller);
knockback = 0.8f; knockback = 0.8f;
lifetime = 80f; lifetime = 80f;
width = height = 11f; width = 12f;
height = 14f;
collidesTiles = false; collidesTiles = false;
splashDamageRadius = 25f * 0.75f; splashDamageRadius = 30f * 0.75f;
splashDamage = 33f; splashDamage = 70f;
backColor = hitColor = trailColor = Pal.graphiteAmmoBack; backColor = hitColor = trailColor = Pal.graphiteAmmoBack;
frontColor = Pal.graphiteAmmoFront; frontColor = Pal.graphiteAmmoFront;
despawnEffect = Fx.hitBulletColor; despawnEffect = Fx.hitBulletColor;
lifeScaleRandMax = 1.08f;
lifeScaleRandMin = 0.95f;
}}, }},
Items.silicon, new ArtilleryBulletType(3f, 20){{ Items.silicon, new ArtilleryBulletType(3f, 40){{
hitEffect = new MultiEffect(Fx.flakExplosion, Fx.shockwaveSmaller);
knockback = 0.8f; knockback = 0.8f;
lifetime = 80f; lifetime = 80f;
width = height = 11f; width = 12f;
height = 14f;
collidesTiles = false; collidesTiles = false;
splashDamageRadius = 25f * 0.75f; splashDamageRadius = 30f * 0.75f;
splashDamage = 33f; splashDamage = 70f;
reloadMultiplier = 1.2f; reloadMultiplier = 1.2f;
ammoMultiplier = 3f; ammoMultiplier = 3f;
homingPower = 0.08f; homingPower = 0.08f;
@ -3947,15 +3954,18 @@ public class Blocks{
despawnEffect = Fx.hitBulletColor; despawnEffect = Fx.hitBulletColor;
backColor = hitColor = trailColor = Pal.siliconAmmoBack; backColor = hitColor = trailColor = Pal.siliconAmmoBack;
frontColor = Pal.siliconAmmoFront; frontColor = Pal.siliconAmmoFront;
lifeScaleRandMax = 1.08f;
lifeScaleRandMin = 0.95f;
}}, }},
Items.pyratite, new ArtilleryBulletType(3f, 24){{ Items.pyratite, new ArtilleryBulletType(3f, 48){{
hitEffect = Fx.blastExplosion; hitEffect = new MultiEffect(Fx.blastExplosion, Fx.shockwave);
knockback = 0.8f; knockback = 0.8f;
lifetime = 80f; lifetime = 80f;
width = height = 13f; width = 13f;
height = 15f;
collidesTiles = false; collidesTiles = false;
splashDamageRadius = 25f * 0.75f; splashDamageRadius = 30f * 0.75f;
splashDamage = 45f; splashDamage = 90f;
status = StatusEffects.burning; status = StatusEffects.burning;
statusDuration = 60f * 12f; statusDuration = 60f * 12f;
frontColor = Pal.lightishOrange; frontColor = Pal.lightishOrange;
@ -3964,31 +3974,37 @@ public class Blocks{
trailEffect = Fx.incendTrail; trailEffect = Fx.incendTrail;
ammoMultiplier = 4f; ammoMultiplier = 4f;
despawnEffect = Fx.hitBulletColor; despawnEffect = Fx.hitBulletColor;
lifeScaleRandMax = 1.08f;
lifeScaleRandMin = 0.95f;
}}, }},
Items.blastCompound, new ArtilleryBulletType(2f, 20, "shell"){{ Items.blastCompound, new ArtilleryBulletType(2f, 40, "shell"){{
hitEffect = Fx.blastExplosion; hitEffect = new MultiEffect(Fx.blastExplosion, Fx.shockwave);
knockback = 0.8f; knockback = 0.8f;
lifetime = 80f; lifetime = 80f;
width = height = 14f; width = 14f;
height = 16f;
collidesTiles = false; collidesTiles = false;
ammoMultiplier = 4f; ammoMultiplier = 4f;
splashDamageRadius = 45f * 0.75f; splashDamageRadius = 50f * 0.75f;
splashDamage = 55f; splashDamage = 90f;
status = StatusEffects.blasted; status = StatusEffects.blasted;
lifeScaleRandMax = 1.08f;
lifeScaleRandMin = 0.95f;
despawnEffect = Fx.hitBulletColor; despawnEffect = Fx.hitBulletColor;
backColor = hitColor = trailColor = Pal.blastAmmoBack; backColor = hitColor = trailColor = Pal.blastAmmoBack;
frontColor = Pal.blastAmmoFront; frontColor = Pal.blastAmmoFront;
}}, }},
Items.plastanium, new ArtilleryBulletType(3.4f, 20, "shell"){{ Items.plastanium, new ArtilleryBulletType(3.4f, 40, "shell"){{
hitEffect = Fx.plasticExplosion; hitEffect = new MultiEffect(Fx.plasticExplosion, Fx.shockwave);
knockback = 1f; knockback = 1f;
lifetime = 80f; lifetime = 80f;
width = height = 13f; width = 13f;
height = 15f;
collidesTiles = false; collidesTiles = false;
splashDamageRadius = 35f * 0.75f; splashDamageRadius = 40f * 0.75f;
splashDamage = 45f; splashDamage = 90f;
fragBullet = new BasicBulletType(2.5f, 10, "bullet"){{ fragBullet = new BasicBulletType(2.5f, 10, "bullet"){{
width = 10f; width = 10f;
height = 12f; height = 12f;
@ -4002,18 +4018,21 @@ public class Blocks{
fragBullets = 10; fragBullets = 10;
backColor = Pal.plastaniumBack; backColor = Pal.plastaniumBack;
frontColor = Pal.plastaniumFront; frontColor = Pal.plastaniumFront;
lifeScaleRandMax = 1.08f;
lifeScaleRandMin = 0.95f;
}} }}
); );
targetAir = false; targetAir = false;
size = 3; size = 3;
shoot.shots = 4; shoot.shots = 4;
inaccuracy = 12f; inaccuracy = 11f;
reload = 60f; reload = 120f;
ammoEjectBack = 5f; ammoEjectBack = 5f;
ammoUseEffect = Fx.casing3Double; ammoUseEffect = Fx.casing3Double;
ammoPerShot = 2; ammoPerShot = 2;
velocityRnd = 0.2f; velocityRnd = 0.2f;
scaleLifetimeOffset = 1f / 9f; scaleLifetimeOffset = 1f / 9f;
recoil = 6f; recoil = 6f;
shake = 2f; shake = 2f;
@ -4135,7 +4154,7 @@ public class Blocks{
rotateSpeed = 10f; rotateSpeed = 10f;
inaccuracy = 10f; inaccuracy = 10f;
shootCone = 30f; shootCone = 30f;
shootSound = Sounds.shootSnap; shootSound = Sounds.shootCyclone;
coolant = consumeCoolant(0.3f); coolant = consumeCoolant(0.3f);
scaledHealth = 145; scaledHealth = 145;
@ -4243,7 +4262,7 @@ public class Blocks{
shake = 2f; shake = 2f;
size = 4; size = 4;
shootCone = 24f; shootCone = 24f;
shootSound = Sounds.shootBig; shootSound = Sounds.shootSpectre;
scaledHealth = 160; scaledHealth = 160;
coolant = consumeCoolant(1f); coolant = consumeCoolant(1f);

View file

@ -1530,6 +1530,12 @@ public class Fx{
Lines.circle(e.x, e.y, e.fin() * 28f); Lines.circle(e.x, e.y, e.fin() * 28f);
}), }),
shockwaveSmaller = new Effect(9f, 80f, e -> {
color(Color.white, Color.lightGray, e.fin());
stroke(e.fout() * 2f + 0.2f);
Lines.circle(e.x, e.y, e.fin() * 22f);
}),
bigShockwave = new Effect(10f, 80f, e -> { bigShockwave = new Effect(10f, 80f, e -> {
color(Color.white, Color.lightGray, e.fin()); color(Color.white, Color.lightGray, e.fin());
stroke(e.fout() * 3f); stroke(e.fout() * 3f);

View file

@ -197,6 +197,8 @@ public class UnitTypes{
stepShake = 0.15f; stepShake = 0.15f;
singleTarget = true; singleTarget = true;
drownTimeMultiplier = 1.5f; drownTimeMultiplier = 1.5f;
stepSound = Sounds.mechStep;
stepSoundVolume = 0.25f;
abilities.add(new ShieldRegenFieldAbility(25f, 250f, 60f * 1, 60f)); abilities.add(new ShieldRegenFieldAbility(25f, 250f, 60f * 1, 60f));
@ -266,6 +268,7 @@ public class UnitTypes{
mechFrontSway = 1.9f; mechFrontSway = 1.9f;
mechSideSway = 0.6f; mechSideSway = 0.6f;
ammoType = new ItemAmmoType(Items.thorium); ammoType = new ItemAmmoType(Items.thorium);
stepSound = Sounds.mechStep;
weapons.add( weapons.add(
new Weapon("reign-weapon"){{ new Weapon("reign-weapon"){{
@ -475,6 +478,8 @@ public class UnitTypes{
immunities = ObjectSet.with(StatusEffects.burning); immunities = ObjectSet.with(StatusEffects.burning);
singleTarget = true; singleTarget = true;
stepSound = Sounds.mechStep;
stepSoundVolume = 0.25f;
weapons.add(new Weapon("vela-weapon"){{ weapons.add(new Weapon("vela-weapon"){{
mirror = false; mirror = false;
@ -1813,7 +1818,7 @@ public class UnitTypes{
shake = 6f; shake = 6f;
recoil = 10.5f; recoil = 10.5f;
shadow = 50f; shadow = 50f;
shootSound = Sounds.railgun; shootSound = Sounds.shootOmura;
ejectEffect = Fx.none; ejectEffect = Fx.none;

View file

@ -14,14 +14,14 @@ public class ArtilleryBulletType extends BasicBulletType{
collidesAir = false; collidesAir = false;
scaleLife = true; scaleLife = true;
hitShake = 1f; hitShake = 1f;
hitSound = Sounds.explosion; hitSound = Sounds.artilleryExplosion;
hitEffect = Fx.flakExplosion; hitEffect = Fx.flakExplosion;
shootEffect = Fx.shootBig; shootEffect = Fx.shootBig;
trailEffect = Fx.artilleryTrail; trailEffect = Fx.artilleryTrail;
//default settings: //default settings:
shrinkX = 0.15f; shrinkX = 0.15f;
shrinkY = 0.63f; shrinkY = 0.5f;
shrinkInterp = Interp.slope; shrinkInterp = Interp.slope;
//for trail: //for trail:

View file

@ -80,9 +80,9 @@ public class BulletType extends Content implements Cloneable{
public Sound hitSound = Sounds.none; public Sound hitSound = Sounds.none;
/** Sound made when hitting something or getting removed.*/ /** Sound made when hitting something or getting removed.*/
public Sound despawnSound = Sounds.none; public Sound despawnSound = Sounds.none;
/** Pitch of the sound made when hitting something*/ /** Pitch of the sound made when hitting something */
public float hitSoundPitch = 1; public float hitSoundPitch = 1, hitSoundPitchRange = 0.1f;
/** Volume of the sound made when hitting something*/ /** Volume of the sound made when hitting something */
public float hitSoundVolume = 1; public float hitSoundVolume = 1;
/** Extra inaccuracy when firing. */ /** Extra inaccuracy when firing. */
public float inaccuracy = 0f; public float inaccuracy = 0f;
@ -511,7 +511,7 @@ public class BulletType extends Content implements Cloneable{
public void hit(Bullet b, float x, float y){ public void hit(Bullet b, float x, float y){
hitEffect.at(x, y, b.rotation(), hitColor); hitEffect.at(x, y, b.rotation(), hitColor);
hitSound.at(x, y, hitSoundPitch, hitSoundVolume); hitSound.at(x, y, hitSoundPitch + Mathf.range(hitSoundPitchRange), hitSoundVolume);
Effect.shake(hitShake, hitShake, b); Effect.shake(hitShake, hitShake, b);

View file

@ -51,6 +51,7 @@ abstract class MechComp implements Posc, Hitboxc, Unitc, Mechc, ElevationMovec{
if(type.mechStepParticles){ if(type.mechStepParticles){
Effect.floorDust(cx, cy, hitSize/8f); Effect.floorDust(cx, cy, hitSize/8f);
} }
type.stepSound.at(cx, cy, 1f + Mathf.range(0.1f), type.stepSoundVolume);
} }
walkExtension = extendScl; walkExtension = extendScl;

View file

@ -298,6 +298,10 @@ public class UnitType extends UnlockableContent implements Senseable{
public Sound loopSound = Sounds.none; public Sound loopSound = Sounds.none;
/** volume of loop sound */ /** volume of loop sound */
public float loopSoundVolume = 0.5f; public float loopSoundVolume = 0.5f;
/** sound played when this mech unit does a step */
public Sound stepSound = Sounds.none;
/** volume of step sound */
public float stepSoundVolume = 0.5f;
/** effect that this unit emits when falling */ /** effect that this unit emits when falling */
public Effect fallEffect = Fx.fallSmoke; public Effect fallEffect = Fx.fallSmoke;
/** effect created at engine when unit falls. */ /** effect created at engine when unit falls. */

View file

@ -36,7 +36,9 @@ public class MassDriver extends Block{
public Effect shootEffect = Fx.shootBig2; public Effect shootEffect = Fx.shootBig2;
public Effect smokeEffect = Fx.shootBigSmoke2; public Effect smokeEffect = Fx.shootBigSmoke2;
public Effect receiveEffect = Fx.mineBig; public Effect receiveEffect = Fx.mineBig;
public Sound shootSound = Sounds.shootBig; public Sound shootSound = Sounds.massdriver;
public Sound receiveSound = Sounds.massdriverReceive;
public float shootSoundVolume = 0.5f;
public float shake = 3f; public float shake = 3f;
public @Load("@-base") TextureRegion baseRegion; public @Load("@-base") TextureRegion baseRegion;
@ -306,7 +308,7 @@ public class MassDriver extends Block{
Effect.shake(shake, shake, this); Effect.shake(shake, shake, this);
shootSound.at(tile, Mathf.random(0.9f, 1.1f)); shootSound.at(x, y, 1f + Mathf.range(0.2f), shootSoundVolume);
} }
public void handlePayload(Bullet bullet, DriverBulletData data){ public void handlePayload(Bullet bullet, DriverBulletData data){
@ -326,6 +328,7 @@ public class MassDriver extends Block{
Effect.shake(shake, shake, this); Effect.shake(shake, shake, this);
receiveEffect.at(bullet); receiveEffect.at(bullet);
receiveSound.at(x, y, 1f + Mathf.range(0.2f), shootSoundVolume);
reloadCounter = 1f; reloadCounter = 1f;
bullet.remove(); bullet.remove();

View file

@ -32,7 +32,9 @@ public class PayloadMassDriver extends PayloadBlock{
public Effect shootEffect = Fx.shootBig2; public Effect shootEffect = Fx.shootBig2;
public Effect smokeEffect = Fx.shootPayloadDriver; public Effect smokeEffect = Fx.shootPayloadDriver;
public Effect receiveEffect = Fx.payloadReceive; public Effect receiveEffect = Fx.payloadReceive;
public Sound shootSound = Sounds.shootBig; public Sound shootSound = Sounds.massdriver;
public Sound receiveSound = Sounds.massdriverReceive;
public float shootSoundVolume = 0.7f;
public float shake = 3f; public float shake = 3f;
public Effect transferEffect = new Effect(11f, 600f, e -> { public Effect transferEffect = new Effect(11f, 600f, e -> {
@ -176,6 +178,7 @@ public class PayloadMassDriver extends PayloadBlock{
receiveEffect.at(x - cx/2f, y - cy/2f, turretRotation); receiveEffect.at(x - cx/2f, y - cy/2f, turretRotation);
reloadCounter = 1f; reloadCounter = 1f;
Effect.shake(shake, shake, this); Effect.shake(shake, shake, this);
receiveSound.at(x, y, 1f + Mathf.range(0.2f), shootSoundVolume);
} }
charging = false; charging = false;
@ -294,7 +297,7 @@ public class PayloadMassDriver extends PayloadBlock{
smokeEffect.at(x, y, turretRotation); smokeEffect.at(x, y, turretRotation);
Effect.shake(shake, shake, this); Effect.shake(shake, shake, this);
shootSound.at(this, Mathf.random(0.9f, 1.1f)); shootSound.at(x, y, Mathf.random(0.9f, 1.1f), shootSoundVolume);
transferEffect.at(x + cx, y + cy, turretRotation, new PayloadMassDriverData(x + cx, y + cy, other.x - cx, other.y - cy, payload)); transferEffect.at(x + cx, y + cy, turretRotation, new PayloadMassDriverData(x + cx, y + cy, other.x - cx, other.y - cy, payload));
Payload pay = payload; Payload pay = payload;
other.recPayload = payload; other.recPayload = payload;

View file

@ -26,4 +26,4 @@ org.gradle.caching=true
org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000 org.gradle.internal.http.connectionTimeout=100000
android.enableR8.fullMode=false android.enableR8.fullMode=false
archash=9b4648505a archash=01973bdfd5