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

View File

@@ -3,7 +3,6 @@ package mindustry.audio;
import arc.*;
import arc.audio.*;
import arc.struct.*;
import mindustry.gen.*;
import static mindustry.gen.Sounds.*;
@@ -36,13 +35,13 @@ public class SoundPriority{
respawning
);
//this is spammed a LOT
Sounds.shootBig.setMinConcurrentInterrupt(shootBig.getLength() * 0.9f);
for(var sound : Core.assets.getAll(Sound.class, new Seq<>())){
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){

View File

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

View File

@@ -1530,6 +1530,12 @@ public class Fx{
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 -> {
color(Color.white, Color.lightGray, e.fin());
stroke(e.fout() * 3f);

View File

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

View File

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

View File

@@ -80,9 +80,9 @@ public class BulletType extends Content implements Cloneable{
public Sound hitSound = Sounds.none;
/** Sound made when hitting something or getting removed.*/
public Sound despawnSound = Sounds.none;
/** Pitch of the sound made when hitting something*/
public float hitSoundPitch = 1;
/** Volume of the sound made when hitting something*/
/** Pitch of the sound made when hitting something */
public float hitSoundPitch = 1, hitSoundPitchRange = 0.1f;
/** Volume of the sound made when hitting something */
public float hitSoundVolume = 1;
/** Extra inaccuracy when firing. */
public float inaccuracy = 0f;
@@ -511,7 +511,7 @@ public class BulletType extends Content implements Cloneable{
public void hit(Bullet b, float x, float y){
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);

View File

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

View File

@@ -298,6 +298,10 @@ public class UnitType extends UnlockableContent implements Senseable{
public Sound loopSound = Sounds.none;
/** volume of loop sound */
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 */
public Effect fallEffect = Fx.fallSmoke;
/** 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 smokeEffect = Fx.shootBigSmoke2;
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 @Load("@-base") TextureRegion baseRegion;
@@ -306,7 +308,7 @@ public class MassDriver extends Block{
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){
@@ -326,6 +328,7 @@ public class MassDriver extends Block{
Effect.shake(shake, shake, this);
receiveEffect.at(bullet);
receiveSound.at(x, y, 1f + Mathf.range(0.2f), shootSoundVolume);
reloadCounter = 1f;
bullet.remove();

View File

@@ -32,7 +32,9 @@ public class PayloadMassDriver extends PayloadBlock{
public Effect shootEffect = Fx.shootBig2;
public Effect smokeEffect = Fx.shootPayloadDriver;
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 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);
reloadCounter = 1f;
Effect.shake(shake, shake, this);
receiveSound.at(x, y, 1f + Mathf.range(0.2f), shootSoundVolume);
}
charging = false;
@@ -294,7 +297,7 @@ public class PayloadMassDriver extends PayloadBlock{
smokeEffect.at(x, y, turretRotation);
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));
Payload pay = payload;
other.recPayload = payload;