Compare commits

...

5 commits

Author SHA1 Message Date
Anuken
65c63c292e WIP tank sounds 2025-12-05 21:01:12 -05:00
Anuken
06943d822d Merge remote-tracking branch 'origin/master' 2025-12-05 20:36:09 -05:00
Anuken
2aeebb5aea Step sounds for smaller mechs (bad) 2025-12-05 20:35:59 -05:00
Anuken
ee8a258447 Revert "Log an error and skip shadows instead of crashing when mods set maxSchematicSize too high"
This reverts commit 1dedefd56c.
2025-12-01 19:59:19 -05:00
Anuken
87f7e1f1c2 Revert "Defer shadow buffer init"
This reverts commit 34be5ffc6c.
2025-12-01 19:59:19 -05:00
15 changed files with 82 additions and 43 deletions

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

@ -55,13 +55,16 @@ public class SoundPriority{
sound.setMinConcurrentInterrupt(Math.min(0.25f, sound.getLength() * 0.5f));
}
mechStepSmall.setMinConcurrentInterrupt(0.5f);
mechStep.setMinConcurrentInterrupt(0.5f);
walkerStep.setMinConcurrentInterrupt(0.6f);
mechStepHeavy.setMinConcurrentInterrupt(0.6f);
shieldHit.setMaxConcurrent(4);
max(4, mechStep, mechStepHeavy, walkerStep);
max(4, mechStep, mechStepHeavy, walkerStep, walkerStepSmall, walkerStepTiny, mechStepSmall);
//step sounds are low priority
set(-1f, mechStep, mechStepHeavy, walkerStep, walkerStepSmall, walkerStepTiny, mechStepSmall);
}
static void max(int max, Sound... sounds){

View file

@ -102,6 +102,8 @@ public class UnitTypes{
speed = 0.5f;
hitSize = 8f;
health = 150;
stepSoundVolume = 0.4f;
weapons.add(new Weapon("large-weapon"){{
shootSound = Sounds.shootDagger;
reload = 13f;
@ -159,6 +161,8 @@ public class UnitTypes{
armor = 9f;
mechFrontSway = 0.55f;
ammoType = new ItemAmmoType(Items.graphite);
stepSoundPitch = 0.8f;
stepSoundVolume = 0.65f;
weapons.add(new Weapon("artillery"){{
top = false;
@ -372,6 +376,7 @@ public class UnitTypes{
mineTier = 2;
mineSpeed = 3f;
stepSound = Sounds.mechStepSmall;
abilities.add(new ShieldRegenFieldAbility(20f, 40f, 60f * 5, 60f));
ammoType = new PowerAmmoType(1300);
@ -428,6 +433,8 @@ public class UnitTypes{
mechFrontSway = 0.55f;
ammoType = new PowerAmmoType(1500);
stepSoundPitch = 0.9f;
stepSoundVolume = 0.6f;
speed = 0.5f;
hitSize = 13f;
@ -635,6 +642,8 @@ public class UnitTypes{
mechSideSway = 0.25f;
range = 40f;
ammoType = new ItemAmmoType(Items.coal);
stepSound = Sounds.walkerStepTiny;
stepSoundVolume = 0.4f;
weapons.add(new Weapon(){{
shootOnDeath = true;
@ -672,6 +681,10 @@ public class UnitTypes{
health = 600;
immunities = ObjectSet.with(StatusEffects.burning, StatusEffects.melting);
stepSound = Sounds.walkerStepSmall;
stepSoundPitch = 1f;
stepSoundVolume = 0.3f;
legCount = 4;
legLength = 9f;
legForwardScl = 0.6f;
@ -721,6 +734,10 @@ public class UnitTypes{
shadowElevation = 0.3f;
groundLayer = Layer.legUnit;
stepSound = Sounds.walkerStepSmall;
stepSoundPitch = 0.7f;
stepSoundVolume = 0.35f;
weapons.add(new Weapon("spiroct-weapon"){{
shootY = 4f;
reload = 14f;
@ -788,7 +805,7 @@ public class UnitTypes{
ammoType = new PowerAmmoType(2000);
stepSound = Sounds.walkerStep;
stepSoundVolume = 0.75f;
stepSoundVolume = 0.85f;
stepSoundPitch = 1.1f;
legSplashDamage = 32;
@ -2573,6 +2590,9 @@ public class UnitTypes{
treadRects = new Rect[]{new Rect(12 - 32f, 7 - 32f, 14, 51)};
researchCostMultiplier = 0f;
tankMoveVolume *= 0.6f;
tankMoveSound = Sounds.tankMoveSmall;
weapons.add(new Weapon("stell-weapon"){{
shootSound = Sounds.shootStell;
layerOffset = 0.0001f;
@ -2616,6 +2636,9 @@ public class UnitTypes{
treadRects = new Rect[]{new Rect(17 - 96f/2f, 10 - 96f/2f, 19, 76)};
researchCostMultiplier = 0f;
tankMoveVolume *= 0.75f;
tankMoveSound = Sounds.tankMove;
weapons.add(new Weapon("locus-weapon"){{
shootSound = Sounds.bolt;
layerOffset = 0.0001f;
@ -2769,6 +2792,9 @@ public class UnitTypes{
immunities.addAll(StatusEffects.burning, StatusEffects.melting);
treadRects = new Rect[]{new Rect(22 - 154f/2f, 16 - 154f/2f, 28, 130)};
tankMoveVolume *= 1.25f;
tankMoveSound = Sounds.tankMoveHeavy;
weapons.add(new Weapon("vanquish-weapon"){{
shootSound = Sounds.mediumCannon;
layerOffset = 0.0001f;
@ -2867,6 +2893,9 @@ public class UnitTypes{
floorMultiplier = 0.3f;
immunities.addAll(StatusEffects.burning, StatusEffects.melting);
tankMoveVolume *= 1.5f;
tankMoveSound = Sounds.tankMoveHeavy;
float xo = 231f/2f, yo = 231f/2f;
treadRects = new Rect[]{new Rect(27 - xo, 152 - yo, 56, 73), new Rect(24 - xo, 51 - 9 - yo, 29, 17), new Rect(59 - xo, 18 - 9 - yo, 39, 19)};
@ -3043,6 +3072,8 @@ public class UnitTypes{
armor = 4f;
legStraightness = 0.3f;
stepShake = 0f;
stepSound = Sounds.walkerStepTiny;
stepSoundVolume = 0.7f;
legCount = 6;
legLength = 8f;
@ -3127,6 +3158,8 @@ public class UnitTypes{
armor = 5f;
stepShake = 0f;
stepSound = Sounds.walkerStepSmall;
legCount = 4;
legLength = 14f;
lockLegBase = true;
@ -3234,6 +3267,9 @@ public class UnitTypes{
fogRadius = 40f;
stepShake = 0f;
stepSound = Sounds.walkerStepSmall;
stepSoundPitch = 0.78f;
legCount = 6;
legLength = 18f;
legGroupSize = 3;
@ -3271,6 +3307,7 @@ public class UnitTypes{
weapons.add(new Weapon("anthicus-weapon"){{
shootSound = Sounds.missileLarge;
shootSoundVolume = 0.65f;
x = 29f / 4f;
y = -11f / 4f;
shootY = 1.5f;

View file

@ -179,7 +179,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Unitc{
floor.walkSound.at(x, y, 1f, floor.walkSoundVolume);
}else{
Fx.unitLandSmall.at(l.base.x, l.base.y, type.rippleScale, floor.mapColor);
type.stepSound.at(l.base.x, l.base.y, type.stepSoundPitch + Mathf.range(0.1f), type.stepSoundVolume);
type.stepSound.at(l.base.x, l.base.y, type.stepSoundPitch + Mathf.range(type.stepSoundPitchRange), type.stepSoundVolume);
}
//shake when legs contact ground

View file

@ -50,6 +50,8 @@ abstract class TankComp implements Posc, Hitboxc, Unitc, ElevationMovec{
treadEffectTime = 0f;
}
control.sound.loop(type.tankMoveSound, this, type.tankMoveVolume);
}
lastDeepFloor = null;

View file

@ -379,7 +379,7 @@ public class AIController implements UnitController{
if(arrive){
Tmp.v3.set(-unit.vel.x / unit.type.accel * 2f, -unit.vel.y / unit.type.accel * 2f).add((target.getX() - unit.x), (target.getY() - unit.y));
if(unit.type.omniMovement){
if(unit.type.omniMovement || unit.type.rotateMoveFirst){
vec.add(Tmp.v3).limit(speed * length);
}else{
//directly move the unit to prevent a backwards movement vector from messing things up

View file

@ -59,8 +59,7 @@ public class Schematics implements Loadable{
private ObjectSet<Schematic> errored = new ObjectSet<>();
private ObjectMap<CoreBlock, Seq<Schematic>> loadouts = new ObjectMap<>();
private ObjectMap<CoreBlock, Schematic> defaultLoadouts = new ObjectMap<>();
private @Nullable FrameBuffer shadowBuffer;
private boolean triedCreatingShadowBuffer;
private FrameBuffer shadowBuffer;
private Texture errorTexture;
private long lastClearTime;
@ -98,6 +97,10 @@ public class Schematics implements Loadable{
});
all.sort();
if(shadowBuffer == null && !headless){
Core.app.post(() -> shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8));
}
}
private void loadLoadouts(){
@ -212,49 +215,35 @@ public class Schematics implements Loadable{
Tmp.m2.set(Draw.trans());
FrameBuffer buffer = new FrameBuffer((schematic.width + padding) * resolution, (schematic.height + padding) * resolution);
if(shadowBuffer == null && !triedCreatingShadowBuffer){
triedCreatingShadowBuffer = true;
try{
shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8);
}catch(Exception e){
Log.err(Strings.format("Failed to create shadow buffer (@x@): @. This is likely because a mod is setting maxSchematicSize too high. Don't do that.",
maxSchematicSize + padding + 8, maxSchematicSize + padding + 8, Strings.getSimpleMessage(e)));
}
}
shadowBuffer.begin(Color.clear);
if(shadowBuffer != null){
shadowBuffer.begin(Color.clear);
Draw.trans().idt();
Draw.proj().setOrtho(0, 0, shadowBuffer.getWidth(), shadowBuffer.getHeight());
Draw.trans().idt();
Draw.proj().setOrtho(0, 0, shadowBuffer.getWidth(), shadowBuffer.getHeight());
Draw.color();
schematic.tiles.each(t -> {
int size = t.block.size;
int offsetx = -(size - 1) / 2;
int offsety = -(size - 1) / 2;
for(int dx = 0; dx < size; dx++){
for(int dy = 0; dy < size; dy++){
int wx = t.x + dx + offsetx;
int wy = t.y + dy + offsety;
Fill.square(padding/2f + wx + 0.5f, padding/2f + wy + 0.5f, 0.5f);
}
Draw.color();
schematic.tiles.each(t -> {
int size = t.block.size;
int offsetx = -(size - 1) / 2;
int offsety = -(size - 1) / 2;
for(int dx = 0; dx < size; dx++){
for(int dy = 0; dy < size; dy++){
int wx = t.x + dx + offsetx;
int wy = t.y + dy + offsety;
Fill.square(padding/2f + wx + 0.5f, padding/2f + wy + 0.5f, 0.5f);
}
});
}
});
shadowBuffer.end();
}
shadowBuffer.end();
buffer.begin(Color.clear);
Draw.proj().setOrtho(0, buffer.getHeight(), buffer.getWidth(), -buffer.getHeight());
if(shadowBuffer != null){
Tmp.tr1.set(shadowBuffer.getTexture(), 0, 0, schematic.width + padding, schematic.height + padding);
Draw.color(0f, 0f, 0f, 1f);
Draw.rect(Tmp.tr1, buffer.getWidth()/2f, buffer.getHeight()/2f, buffer.getWidth(), -buffer.getHeight());
Draw.color();
}
Tmp.tr1.set(shadowBuffer.getTexture(), 0, 0, schematic.width + padding, schematic.height + padding);
Draw.color(0f, 0f, 0f, 1f);
Draw.rect(Tmp.tr1, buffer.getWidth()/2f, buffer.getHeight()/2f, buffer.getWidth(), -buffer.getHeight());
Draw.color();
Seq<BuildPlan> plans = schematic.tiles.map(t -> new BuildPlan(t.x, t.y, t.rotation, t.block, t.config));
@ -484,6 +473,10 @@ public class Schematics implements Loadable{
if(check && !(st.block instanceof CoreBlock)){
seq.clear();
tile.getLinkedTilesAs(st.block, seq);
//remove env blocks, or not?
//if(seq.contains(t -> !t.block().alwaysReplace && !t.synthetic())){
// return;
//}
for(var t : seq){
if(t.block() != Blocks.air){
t.remove();

View file

@ -301,11 +301,15 @@ public class UnitType extends UnlockableContent implements Senseable{
/** volume of loop sound */
public float loopSoundVolume = 0.5f;
/** sound played when this mech/insect unit does a step */
public Sound stepSound = Sounds.none;
public Sound stepSound = Sounds.mechStepSmall;
/** volume of step sound */
public float stepSoundVolume = 0.5f;
/** base pitch of step sound */
public float stepSoundPitch = 1f;
public float stepSoundPitch = 1f, stepSoundPitchRange = 0.1f;
/** sound looped when tank moves */
public Sound tankMoveSound = Sounds.tankMove;
/** volume of tank move sfx */
public float tankMoveVolume = 0.5f;
/** effect that this unit emits when falling */
public Effect fallEffect = Fx.fallSmoke;
/** effect created at engine when unit falls. */

View file

@ -88,6 +88,7 @@ public class DesktopLauncher extends ClientLauncher{
case "antialias" -> samples = 16;
case "debug" -> Log.level = LogLevel.debug;
case "maximized" -> maximized = Boolean.parseBoolean(arg[i + 1]);
case "testMobile" -> testMobile = true;
case "gltrace" -> {
Events.on(ClientCreateEvent.class, e -> {
var profiler = new GLProfiler(Core.graphics);
@ -115,7 +116,6 @@ public class DesktopLauncher extends ClientLauncher{
Version.init();
boolean useSteam = Version.modifier.contains("steam");
testMobile = Seq.with(args).contains("-testMobile");
if(useDiscord){
Threads.daemon(() -> {