Skip to content

Commit 5e5b2fa

Browse files
committed
Merge branch 'development' into balance-improvements
2 parents dbdef55 + 9fc4440 commit 5e5b2fa

File tree

138 files changed

+368
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+368
-139
lines changed

Data/Base.rte/AI/HumanBehaviors.lua

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
12611261

12621262
if AI.refuel and Owner.Jetpack then
12631263
-- if jetpack is full or we are falling we can stop refuelling
1264-
if Owner.JetTimeLeft > Owner.JetTimeTotal * 0.98 or (AI.flying and Owner.Vel.Y < -3 and Owner.JetTimeLeft > AI.minBurstTime*2) then
1264+
if Owner.Jetpack.JetTimeLeft > Owner.Jetpack.JetTimeTotal * 0.98 or (AI.flying and Owner.Vel.Y < -3 and Owner.Jetpack.JetTimeLeft > AI.minBurstTime*2) then
12651265
AI.refuel = false;
12661266
elseif not AI.flying then
12671267
AI.jump = false;
@@ -1279,7 +1279,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
12791279
WptList = nil; -- update the path
12801280
elseif StuckTimer:IsPastSimTimeLimit() then -- dislodge
12811281
if AI.jump then
1282-
if Owner.Jetpack and Owner.JetTimeLeft < AI.minBurstTime then -- out of fuel
1282+
if Owner.Jetpack and Owner.Jetpack.JetTimeLeft < AI.minBurstTime then -- out of fuel
12831283
AI.jump = false;
12841284
AI.refuel = true;
12851285
nextLatMove = Actor.LAT_STILL;
@@ -1295,6 +1295,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
12951295
end
12961296
else
12971297
local updateInterval = SettingsMan.AIUpdateInterval;
1298+
12981299
-- Try swapping direction, with a 15% random chance per tick while we're stuck
12991300
if PosRand() > (1 - 0.15) / updateInterval then
13001301
nextLatMove = AI.lateralMoveState == Actor.LAT_LEFT and Actor.LAT_RIGHT or Actor.LAT_LEFT;
@@ -1306,7 +1307,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
13061307
end
13071308

13081309
-- refuelling done
1309-
if AI.refuel and Owner.Jetpack and Owner.JetTimeLeft >= Owner.JetTimeTotal * 0.99 then
1310+
if AI.refuel and Owner.Jetpack and Owner.Jetpack.JetpackType == AEJetpack.Standard and Owner.Jetpack.JetTimeLeft >= Owner.Jetpack.JetTimeTotal * 0.99 then
13101311
AI.jump = true;
13111312
end
13121313
end
@@ -1761,7 +1762,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
17611762
end
17621763

17631764
if Owner.Jetpack and Owner.Head and Owner.Head:IsAttached() then
1764-
if Owner.JetTimeLeft < AI.minBurstTime then
1765+
if Owner.Jetpack.JetTimeLeft < AI.minBurstTime then
17651766
AI.jump = false; -- not enough fuel left, no point in jumping yet
17661767
if not AI.flying or Owner.Vel.Y > 1 then
17671768
AI.refuel = true;
@@ -1770,16 +1771,16 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
17701771
-- do we have a target we want to shoot at?
17711772
if (AI.Target and AI.canHitTarget and AI.BehaviorName ~= "AttackTarget") then
17721773
-- are we also flying
1773-
if AI.flying then
1774+
if AI.flying and Owner.Jetpack.JetpackType == AEJetpack.Standard then
17741775
-- predict jetpack movement when jumping and there is a target (check one direction)
17751776
local jetStrength = AI.jetImpulseFactor / Owner.Mass;
1776-
local t = math.min(0.4, Owner.JetTimeLeft*0.001);
1777+
local t = math.min(0.4, Owner.Jetpack.JetTimeLeft*0.001);
17771778
local PixelVel = Owner.Vel * (GetPPM() * t);
17781779
local Accel = SceneMan.GlobalAcc * GetPPM();
17791780

17801781
-- a burst use 10x more fuel
17811782
if Owner.Jetpack:CanTriggerBurst() then
1782-
t = math.max(math.min(0.4, Owner.JetTimeLeft*0.001-TimerMan.AIDeltaTimeSecs*10), TimerMan.AIDeltaTimeSecs);
1783+
t = math.max(math.min(0.4, Owner.Jetpack.JetTimeLeft*0.001-TimerMan.AIDeltaTimeSecs*10), TimerMan.AIDeltaTimeSecs);
17831784
end
17841785

17851786
-- test jumping
@@ -1816,7 +1817,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
18161817
AI.jump = false;
18171818
end
18181819
else
1819-
if Waypoint.Type ~= "drop" and not Lower(Waypoint, Owner, 20) then
1820+
if Waypoint.Type ~= "drop" and not Lower(Waypoint, Owner, 20) and Owner.Jetpack.JetpackType == AEJetpack.Standard then
18201821
-- jump over low obstacles unless we want to jump off a ledge
18211822
if nextLatMove == Actor.LAT_RIGHT and (Obstacles[Obst.R_LOW] or Obstacles[Obst.R_FRONT]) and not Obstacles[Obst.R_UP] then
18221823
AI.jump = true;
@@ -1833,13 +1834,13 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
18331834

18341835
-- predict jetpack movement...
18351836
local jetStrength = AI.jetImpulseFactor / Owner.Mass;
1836-
local t = math.min(0.4, Owner.JetTimeLeft*0.001);
1837+
local t = math.min(0.4, Owner.Jetpack.JetTimeLeft*0.001);
18371838
local PixelVel = Owner.Vel * (GetPPM() * t);
18381839
local Accel = SceneMan.GlobalAcc * GetPPM();
18391840

18401841
-- a burst use 10x more fuel
18411842
if Owner.Jetpack:CanTriggerBurst() then
1842-
t = math.max(math.min(0.4, Owner.JetTimeLeft*0.001-TimerMan.AIDeltaTimeSecs*10), TimerMan.AIDeltaTimeSecs);
1843+
t = math.max(math.min(0.4, Owner.Jetpack.JetTimeLeft*0.001-TimerMan.AIDeltaTimeSecs*10), TimerMan.AIDeltaTimeSecs);
18431844
end
18441845

18451846
-- when jumping (check four directions)
@@ -1872,11 +1873,16 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
18721873
local Trace = SceneMan:ShortestDistance(Owner.Head.Pos, FallPos, false);
18731874
SceneMan:CastObstacleRay(Owner.Head.Pos, Trace, FallPos, Vector(), Owner.ID, Owner.IgnoresWhichTeam, rte.grassID, 3);
18741875

1876+
local deltaToJump = 25;
1877+
if Owner.Jetpack.JetpackType == AEJetpack.JumpPack then
1878+
deltaToJump = deltaToJump * 1.4;
1879+
end
1880+
18751881
table.sort(Facings, function(A, B) return A.range < B.range end);
18761882
local delta = SceneMan:ShortestDistance(Waypoint.Pos, FallPos, false).Magnitude - Facings[1].range;
18771883
if delta < 1 then
18781884
AI.jump = false;
1879-
elseif AI.flying or delta > 25 then
1885+
elseif delta > deltaToJump or (AI.flying and Owner.Jetpack.JetpackType == AEJetpack.Standard) then
18801886
AI.jump = true;
18811887
nextAimAngle = Owner:GetAimAngle(false) * 0.5 + Facings[1].aim * 0.5; -- adjust jetpack nozzle direction
18821888
nextLatMove = Actor.LAT_STILL;

Data/Base.rte/AI/NativeHumanAI.lua

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,10 @@ function NativeHumanAI:Create(Owner)
5151
-- the native AI assume the jetpack cannot be destroyed
5252
if Owner.Jetpack then
5353
if not Members.isPlayerOwned then
54-
Owner.Jetpack.Throttle = Owner.Jetpack.Throttle + 0.15 -- increase jetpack strength slightly to compensate for AI ineptitude
54+
Owner.Jetpack.JetTimeTotal = Owner.Jetpack.JetTimeTotal * 1.2; -- increase jetpack fuel to compensate for extra fuel spend
5555
end
5656

57-
Members.jetImpulseFactor = Owner.Jetpack:EstimateImpulse(false) * GetPPM() / TimerMan.DeltaTimeSecs;
58-
Members.jetBurstFactor = (Owner.Jetpack:EstimateImpulse(true) * GetPPM() / TimerMan.DeltaTimeSecs - Members.jetImpulseFactor) * math.pow(TimerMan.DeltaTimeSecs, 2) * 0.5;
59-
Members.minBurstTime = math.min(Owner.Jetpack.BurstSpacing*2, Owner.JetTimeTotal*0.99); -- in milliseconds
57+
Members.minBurstTime = math.min(Owner.Jetpack.BurstSpacing*2, Owner.Jetpack.JetTimeTotal*0.99); -- in milliseconds
6058
end
6159

6260
setmetatable(Members, self);
@@ -67,6 +65,12 @@ end
6765
function NativeHumanAI:Update(Owner)
6866
self.Ctrl = Owner:GetController();
6967

68+
-- Our jetpack might have thrust balancing enabled, so update for our current mass
69+
if Owner.Jetpack then
70+
self.jetImpulseFactor = Owner.Jetpack:EstimateImpulse(false) * GetPPM() / TimerMan.DeltaTimeSecs;
71+
self.jetBurstFactor = (Owner.Jetpack:EstimateImpulse(true) * GetPPM() / TimerMan.DeltaTimeSecs - self.jetImpulseFactor) * math.pow(TimerMan.DeltaTimeSecs, 2) * 0.5;
72+
end
73+
7074
if self.isPlayerOwned then
7175
if self.PlayerInterferedTimer:IsPastSimTimeLimit() then
7276
-- Tell the coroutines to abort to avoid memory leaks
@@ -216,7 +220,7 @@ function NativeHumanAI:Update(Owner)
216220

217221

218222
-- check if the feet reach the ground
219-
if self.AirTimer:IsPastSimMS(120) then
223+
if self.AirTimer:IsPastSimMS(250) then
220224
self.AirTimer:Reset();
221225

222226
local Origin = {};
@@ -455,7 +459,12 @@ function NativeHumanAI:Update(Owner)
455459
end
456460
end
457461
elseif self.flying then -- avoid falling damage
458-
if (not self.jump and Owner.Vel.Y > 9) or (self.jump and Owner.Vel.Y > 6) then
462+
local jumpThreshold = 9;
463+
if Owner.Jetpack and Owner.Jetpack.JetpackType == AEJetpack.JumpPack then
464+
jumpThreshold = jumpThreshold * 3;
465+
end
466+
467+
if (not self.jump and Owner.Vel.Y > jumpThreshold) or (self.jump and Owner.Vel.Y > jumpThreshold * 0.66) then
459468
self.jump = true;
460469

461470
-- try falling straight down
@@ -580,7 +589,7 @@ function NativeHumanAI:Update(Owner)
580589
if (not self.jump and Owner.Vel.Y > 18) then
581590
self.jump = true;
582591
end
583-
if self.jump and Owner.JetTimeLeft > TimerMan.AIDeltaTimeMS then
592+
if self.jump and Owner.Jetpack and Owner.Jetpack.JetTimeLeft > TimerMan.AIDeltaTimeMS then
584593
if self.jumpState == AHuman.PREJUMP then
585594
self.jumpState = AHuman.UPJUMP;
586595
elseif self.jumpState ~= AHuman.UPJUMP then -- the jetpack is off

Data/Base.rte/Activities.ini

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ AddActivity = GAScripted
3838
LuaClassName = BrainvsBrain
3939
Team1Name = Red Team
4040
Team2Name = Green Team
41-
MinTeamsRequired = 1
41+
MinTeamsRequired = 2
4242
DefaultRequireClearPathToOrbit = 1
4343
4444
@@ -108,7 +108,6 @@ AddActivity = GAScripted
108108
ScriptPath = Base.rte/Activities/OneManArmy.lua
109109
TeamOfPlayer1 = 0
110110
CPUTeam = 1
111-
MaxPlayerSupport = 1
112111
LuaClassName = OneManArmy
113112
DeployUnitsSwitchEnabled = 1
114113
DefaultDeployUnits = 0
@@ -121,7 +120,6 @@ AddActivity = GAScripted
121120
ScriptPath = Base.rte/Activities/OneManArmyDiggers.lua
122121
TeamOfPlayer1 = 0
123122
CPUTeam = 1
124-
MaxPlayerSupport = 1
125123
LuaClassName = OneManArmy
126124
DeployUnitsSwitchEnabled = 1
127125
DefaultDeployUnits = 0
@@ -134,7 +132,6 @@ AddActivity = GAScripted
134132
ScriptPath = Base.rte/Activities/OneManArmyZeroG.lua
135133
TeamOfPlayer1 = 0
136134
CPUTeam = 1
137-
MaxPlayerSupport = 1
138135
LuaClassName = OneManArmyZeroG
139136
SceneName = Zero-G Battle
140137
DeployUnitsSwitchEnabled = 1
@@ -148,7 +145,6 @@ AddActivity = GAScripted
148145
ScriptPath = Base.rte/Activities/OneManArmyZeroG.lua
149146
TeamOfPlayer1 = 0
150147
CPUTeam = 1
151-
MaxPlayerSupport = 1
152148
LuaClassName = OneManArmyZeroG
153149
SceneName = Zero-G Battle
154150
DeployUnitsSwitchEnabled = 1

Data/Base.rte/Activities/LandingZoneMap.lua

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -483,25 +483,31 @@ function LandingZoneMap.SearchForLZ(self, team, Destination, digStrenght)
483483
end
484484
end
485485

486-
coroutine.yield(); -- wait until next frame
486+
local pathRequestsCompleted = 0;
487+
local completedPathRequests = {};
487488

488489
-- measure the distance to the destination
489490
for k, LZ in pairs(GoodLZs) do
490-
if SceneMan.Scene:CalculatePath(Vector(LZ.X, LZ.Y), Destination, false, digStrenght, team) > -1 then
491-
local Path = {};
492-
for Wpt in SceneMan.Scene:GetScenePath() do
493-
table.insert(Path, Wpt);
494-
end
491+
SceneMan.Scene:CalculatePathAsync(
492+
function(pathRequest)
493+
pathRequestsCompleted = pathRequestsCompleted + 1;
494+
completedPathRequests[k] = pathRequest;
495+
end,
496+
Vector(LZ.X, LZ.Y), Destination, false, digStrenght, team);
497+
end
495498

496-
coroutine.yield(); -- wait until the next frame
499+
while pathRequestsCompleted ~= #GoodLZs do
500+
coroutine.yield(); -- wait until all paths are complete
501+
end
497502

503+
for k, LZ in pairs(GoodLZs) do
504+
pathRequest = completedPathRequests[k];
505+
if pathRequest.PathLength > -1 then
498506
local NextWpt, PrevWpt, deltaY;
499507
local height = 0;
500-
local pathLength = 0;
501508
local pathObstMaxHeight = 0;
502509

503-
for _, Wpt in pairs(Path) do
504-
pathLength = pathLength + 1;
510+
for Wpt in pathRequest.Path do
505511
NextWpt = SceneMan:MovePointToGround(Wpt, 20, 12);
506512

507513
if PrevWpt then
@@ -519,36 +525,27 @@ function LandingZoneMap.SearchForLZ(self, team, Destination, digStrenght)
519525
end
520526

521527
PrevWpt = NextWpt;
522-
if pathLength % 17 == 0 then
523-
coroutine.yield(); -- wait until the next frame
524-
end
525528
end
526529

527530
GoodLZs[k].terrainScore = LZ.score;
528-
GoodLZs[k].pathLength = pathLength;
531+
GoodLZs[k].pathLength = pathRequest.PathLength;
529532
GoodLZs[k].pathObstMaxHeight = pathObstMaxHeight;
530-
GoodLZs[k].score = LZ.score - (pathLength * 0.2 + math.floor(pathObstMaxHeight/15) * 12); -- recalculate the score so we can find a safe LZ that has an easy path to the destination
533+
GoodLZs[k].score = LZ.score - (pathRequest.PathLength * 0.2 + math.floor(pathObstMaxHeight/15) * 12); -- recalculate the score so we can find a safe LZ that has an easy path to the destination
531534
else
532535
-- unknown path
533536
GoodLZs[k].terrainScore = LZ.score;
534537
GoodLZs[k].pathLength = 200;
535538
GoodLZs[k].pathObstMaxHeight = 200;
536539
GoodLZs[k].score = LZ.score - 100;
537540
end
538-
539-
coroutine.yield(); -- wait until the next frame
540541
end
541542

542-
coroutine.yield(); -- wait until the next frame
543-
544543
table.sort(GoodLZs, function(A, B) return A.score > B.score end); -- the best LZ first
545544
local MobilityLZ, selected_index = self:SelectLZ(GoodLZs, 12);
546545
if selected_index then
547546
table.remove(GoodLZs, selected_index); -- don't select this LZ again
548547
end
549548

550-
coroutine.yield(); -- wait until the next frame
551-
552549
-- recalculate the score so we can find a safe LZ that is close to the destination
553550
for k, LZ in pairs(GoodLZs) do
554551
GoodLZs[k].score = LZ.terrainScore - (LZ.pathLength * 0.7 + math.floor(LZ.pathObstMaxHeight/20) * 8);

Data/Base.rte/Actors/Brains/Brainbot/Brainbot.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,14 +636,14 @@ AddActor = AHuman
636636
X = 1
637637
Y = -5
638638
LookToAimRatio = 0.2
639-
Jetpack = AEmitter
639+
Jetpack = AEJetpack
640640
CopyOf = Jetpack Robot
641641
ParentOffset = Vector
642642
X = -4
643643
Y = 6
644644
DrawAfterParent = 0
645-
JumpTime = 2.5
646-
JumpReplenishRate = 1.5
645+
JumpTime = 2.5
646+
JumpReplenishRate = 1.5
647647
FGArm = Arm
648648
CopyOf = Brainbot Arm FG
649649
ParentOffset = Vector

Data/Base.rte/Actors/Infantry/GreenDummy/GreenDummy.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,15 +664,15 @@ AddActor = AHuman
664664
ParentOffset = Vector
665665
X = -1
666666
Y = -13
667-
Jetpack = AEmitter
667+
Jetpack = AEJetpack
668668
CopyOf = Jetpack
669669
ParentOffset = Vector
670670
X = -6
671671
Y = -1
672672
ParticlesPerMinute = 8400
673-
JumpTime = 1.5
674-
JumpReplenishRate = 1.5
675-
JumpAngleRange = 0.2
673+
JumpTime = 1.5
674+
JumpReplenishRate = 1.5
675+
JumpAngleRange = 0.2
676676
FGArm = Arm
677677
CopyOf = Green Dummy Arm FG
678678
ParentOffset = Vector

Data/Base.rte/Actors/Mecha/AIBox/AIBox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ AddActor = ACrab
234234
ParentOffset = Vector
235235
X = 0
236236
Y = -5
237-
Jetpack = AEmitter
237+
Jetpack = AEJetpack
238238
CopyOf = Jump Light
239239
BurstSpacing = 1100
240240
ParentOffset = Vector
241241
X = 0
242242
Y = 0
243243
DrawAfterParent = 0
244-
JumpTime = 1
244+
JumpTime = 1
245245
LFGLeg = Leg
246246
CopyOf = AI Box Leg FG
247247
ParentOffset = Vector

Data/Base.rte/Actors/Mecha/Medic/MedicDrone.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ AddActor = ACrab
232232
ParentOffset = Vector
233233
X = 0
234234
Y = -3
235-
Jetpack = AEmitter
235+
Jetpack = AEJetpack
236236
CopyOf = Jump Light
237237
BurstSpacing = 1100
238238
ParentOffset = Vector
239239
X = 0
240240
Y = 0
241241
DrawAfterParent = 0
242-
JumpTime = 1
242+
JumpTime = 1
243243
LFGLeg = Leg
244244
CopyOf = Medic Drone Leg FG
245245
ParentOffset = Vector

0 commit comments

Comments
 (0)