Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit cd6edf2

Browse files
committed
Merge branch 'development' into pawnis-penetration-sounds
# Conflicts: # Credits.txt Resolved manually
2 parents 0f20935 + 8f3869e commit cd6edf2

File tree

764 files changed

+4554
-2460
lines changed

Some content is hidden

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

764 files changed

+4554
-2460
lines changed

.gitignore

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,27 @@ luac.out
4242
*.x86_64
4343
*.hex
4444

45+
# Manifest files
46+
*.manifest
47+
4548
.vs/
49+
_Screenshots/
4650
Base.rte/Settings.ini
4751
Benchmark.rte/
4852
Scenes.rte/
4953
Metagames.rte/
50-
Microsoft.VC90.CRT.manifest
5154
DedicatedServer.bat
55+
DedicatedServerDebug.bat
5256

5357
Cortex Command Experimental Multiplayer Operations Guide.docx
5458

5559
allegro.log
56-
Cortex Command.exe.manifest
57-
Cortex Command.debug.ilk
5860
abortscreen.bmp
59-
MemCleanupInfo.txt
6061

62+
MemCleanupInfo.txt
6163
LogPublish.txt
6264
LogLoading.txt
65+
LogLoadingWarning.txt
6366
LogConsole.txt
6467
Console.dump.log
6568
Console.input.log

Base.rte/AI/DropShipAI.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,13 @@ end
1010
function UpdateAI(self)
1111
self.AI:Update(self)
1212
end
13+
14+
function Update(self)
15+
--Re-orient the craft at 180 degrees to help rotational AI
16+
if self.RotAngle > math.pi then
17+
self.RotAngle = self.RotAngle - (math.pi * 2);
18+
end
19+
if self.RotAngle < -math.pi then
20+
self.RotAngle = self.RotAngle + (math.pi * 2);
21+
end
22+
end

Base.rte/AI/HumanAI.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ function Create(self)
1111
self.visibleInventory = true;
1212
end
1313
function Update(self)
14-
1514
self.controller = self:GetController();
1615

1716
if self.alternativeGib then
@@ -21,7 +20,7 @@ function Update(self)
2120
HumanFunctions.DoAutomaticEquip(self);
2221
end
2322
if self.armSway then
24-
HumanFunctions.DoArmSway(self, (self.Health / self.MaxHealth)); --Argument: shove strength
23+
HumanFunctions.DoArmSway(self, (self.Health/self.MaxHealth)); --Argument: shove strength
2524
end
2625
if self.visibleInventory then
2726
HumanFunctions.DoVisibleInventory(self, false); --Argument: whether to show all items

Base.rte/AI/HumanBehaviors.lua

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@ function HumanBehaviors.GetTeamShootingSkill(team)
99
end
1010

1111
local aimSpeed, aimSkill
12-
if skill < Activity.AVERAGESKILL then -- the AI shoot later and tracks the target slower
13-
aimSpeed = -0.025 * skill + 3.3 -- affects the delay before the shooting starts [3.30 .. 1.55]
14-
aimSkill = -0.011 * skill + 2.2 -- affects the precision of the shots [2.20 .. 1.43]
15-
elseif skill >= Activity.UNFAIRSKILL then
16-
aimSpeed = 0.05
17-
aimSkill = 0.05
12+
if skill >= Activity.UNFAIRSKILL then
13+
aimSpeed = 0.04
14+
aimSkill = 0.04
1815
else
1916
-- the AI shoot sooner and with slightly better precision
20-
aimSpeed = 1/(0.55/(2.9-math.exp(skill*0.01))) -- [1.42 .. 0.38]
21-
aimSkill = 1/(0.65/(3.0-math.exp(skill*0.01))) -- [1.36 .. 0.48]
17+
aimSpeed = 1/(0.65/(2.9-math.exp(skill*0.01)))
18+
aimSkill = 1/(0.75/(3.0-math.exp(skill*0.01)))
2219
end
23-
2420
return aimSpeed, aimSkill, skill
2521
end
2622

@@ -36,10 +32,10 @@ end
3632

3733
-- spot targets by casting a ray in a random direction
3834
function HumanBehaviors.LookForTargets(AI, Owner, Skill)
39-
local viewAngDeg = RangeRand(50, 120) * Owner.Perceptiveness * (0.5 + Skill / 200)
35+
local viewAngDeg = RangeRand(50, 120) * Owner.Perceptiveness * (0.5 + Skill/200)
4036
if AI.deviceState == AHuman.AIMING then
4137
AI.Ctrl:SetState(Controller.AIM_SHARP, true) -- reinforce sharp aim controller state to enable SharpLength in LookForMOs
42-
viewAngDeg = 15 * Owner.Perceptiveness + (Skill / 10)
38+
viewAngDeg = 15 * Owner.Perceptiveness + (Skill/10)
4339
end
4440

4541
local FoundMO = Owner:LookForMOs(viewAngDeg, rte.grassID, false)
@@ -84,6 +80,8 @@ function HumanBehaviors.CheckEnemyLOS(AI, Owner, Skill)
8480

8581
local LookTarget
8682
if Enemy.ClassName == "ADoor" then
83+
-- TO-DO: use explosive weapons on doors?
84+
8785
local Door = ToADoor(Enemy).Door
8886
if Door and Door:IsAttached() then
8987
LookTarget = Door.Pos
@@ -257,7 +255,7 @@ function HumanBehaviors.GetGrenadeAngle(AimPoint, TargetVel, StartPos, muzVel)
257255
Dist = SceneMan:ShortestDistance(StartPos, AimPoint, false)
258256
end
259257

260-
Dist = Dist / FrameMan.PPM -- convert from pixels to meters
258+
Dist = Dist / GetPPM() -- convert from pixels to meters
261259
local velSqr = math.pow(muzVel, 2)
262260
local gravity = SceneMan.GlobalAcc.Y * 0.67 -- underestimate gravity
263261
local root = math.sqrt(velSqr*velSqr - gravity*(gravity*Dist.X*Dist.X+2*-Dist.Y*velSqr))
@@ -500,8 +498,7 @@ function HumanBehaviors.Sentry(AI, Owner, Abort)
500498
elseif AI.SentryFacing and Owner.HFlipped ~= AI.SentryFacing then
501499
Owner.HFlipped = AI.SentryFacing -- turn to the direction we have been order to guard
502500
break -- restart this behavior
503-
elseif math.random() < Owner.Perceptiveness then
504-
501+
elseif AI.Target == nil and math.random() < Owner.Perceptiveness then
505502
-- turn around occasionally if there is open space behind our back
506503
local backAreaRay = Vector(-math.random(FrameMan.PlayerScreenWidth/4, FrameMan.PlayerScreenWidth/2) * Owner.FlipFactor, 0):DegRotate(math.random(-25, 25) * Owner.Perceptiveness)
507504
if not SceneMan:CastStrengthRay(Owner.EyePos, backAreaRay, 10, Vector(), 10, rte.grassID, SceneMan.SceneWrapsX) then
@@ -1682,13 +1679,12 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
16821679
else
16831680
nextLatMove = Actor.LAT_STILL
16841681
end
1685-
if not (Owner.FGLeg and Owner.BGLeg) and not AI.jump then
1686-
Owner:GetController():SetState(Controller.BODY_CROUCH,true) -- crawl if no legs
1687-
end
16881682
end
16891683
elseif ((CurrDist.X < -5 and Owner.HFlipped) or (CurrDist.X > 5 and not Owner.HFlipped)) and math.abs(Owner.Vel.X) < 1 then
16901684
-- no legs, jump forward
16911685
AI.jump = true
1686+
elseif not AI.jump then
1687+
AI.proneState = AHuman.GOPRONE
16921688
end
16931689

16941690
if Waypoint.Type == "right" then
@@ -1715,8 +1711,8 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
17151711
-- predict jetpack movement when jumping and there is a target (check one direction)
17161712
local jetStrength = AI.jetImpulseFactor / Owner.Mass
17171713
local t = math.min(0.4, Owner.JetTimeLeft*0.001)
1718-
local PixelVel = Owner.Vel * (FrameMan.PPM * t)
1719-
local Accel = SceneMan.GlobalAcc * FrameMan.PPM
1714+
local PixelVel = Owner.Vel * (GetPPM() * t)
1715+
local Accel = SceneMan.GlobalAcc * GetPPM()
17201716

17211717
-- a burst use 10x more fuel
17221718
if Owner.Jetpack:CanTriggerBurst() then
@@ -1779,8 +1775,8 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
17791775
-- predict jetpack movement...
17801776
local jetStrength = AI.jetImpulseFactor / Owner.Mass
17811777
local t = math.min(0.4, Owner.JetTimeLeft*0.001)
1782-
local PixelVel = Owner.Vel * (FrameMan.PPM * t)
1783-
local Accel = SceneMan.GlobalAcc * FrameMan.PPM
1778+
local PixelVel = Owner.Vel * (GetPPM() * t)
1779+
local Accel = SceneMan.GlobalAcc * GetPPM()
17841780

17851781
-- a burst use 10x more fuel
17861782
if Owner.Jetpack:CanTriggerBurst() then
@@ -1821,7 +1817,7 @@ function HumanBehaviors.GoToWpt(AI, Owner, Abort)
18211817
local delta = SceneMan:ShortestDistance(Waypoint.Pos, FallPos, false).Magnitude - Facings[1].range
18221818
if delta < 1 then
18231819
AI.jump = false
1824-
elseif AI.flying or delta > 15 then
1820+
elseif AI.flying or delta > 25 then
18251821
AI.jump = true
18261822
nextAimAngle = Owner:GetAimAngle(false) * 0.5 + Facings[1].aim * 0.5 -- adjust jetpack nozzle direction
18271823
nextLatMove = Actor.LAT_STILL
@@ -2146,32 +2142,32 @@ function HumanBehaviors.GetProjectileData(Owner)
21462142

21472143
-- find muzzle velocity
21482144
PrjDat.vel = Weapon:GetAIFireVel()
2149-
21502145
-- half of the theoretical upper limit for the total amount of material strength this weapon can destroy in 250ms
2151-
PrjDat.pen = Weapon:GetAIPenetration() * math.max((Weapon.RateOfFire / 240), 1)
21522146

21532147
PrjDat.g = SceneMan.GlobalAcc.Y * 0.67 * Weapon:GetBulletAccScalar() -- underestimate gravity
21542148
PrjDat.vsq = PrjDat.vel^2 -- muzzle velocity squared
21552149
PrjDat.vqu = PrjDat.vsq^2 -- muzzle velocity quad
21562150
PrjDat.drg = 1 - Projectile.AirResistance * TimerMan.DeltaTimeSecs -- AirResistance is stored as the ini-value times 60
21572151
PrjDat.thr = math.min(Projectile.AirThreshold, PrjDat.vel)
2152+
PrjDat.pen = (Projectile.Mass * Projectile.Sharpness * PrjDat.vel) * PrjDat.drg
21582153

21592154
-- estimate theoretical max range with ...
21602155
local lifeTime = Weapon:GetAIBulletLifeTime()
21612156
if lifeTime < 1 then -- infinite life time
21622157
PrjDat.rng = math.huge
21632158
elseif PrjDat.drg < 1 then -- AirResistance
21642159
PrjDat.rng = 0
2165-
local threshold = PrjDat.thr * FrameMan.PPM * TimerMan.DeltaTimeSecs -- AirThreshold in pixels/frame
2166-
local vel = PrjDat.vel * FrameMan.PPM * TimerMan.DeltaTimeSecs -- muzzle velocity in pixels/frame
2160+
local threshold = PrjDat.thr * rte.PxTravelledPerFrame -- AirThreshold in pixels/frame
2161+
local vel = PrjDat.vel * rte.PxTravelledPerFrame -- muzzle velocity in pixels/frame
2162+
21672163
for _ = 0, math.ceil(lifeTime/TimerMan.DeltaTimeMS) do
21682164
PrjDat.rng = PrjDat.rng + vel
21692165
if vel > threshold then
21702166
vel = vel * PrjDat.drg
21712167
end
21722168
end
21732169
else -- no AirResistance
2174-
PrjDat.rng = PrjDat.vel * FrameMan.PPM * TimerMan.DeltaTimeSecs * (lifeTime / TimerMan.DeltaTimeMS)
2170+
PrjDat.rng = PrjDat.vel * rte.PxTravelledPerFrame * (lifeTime / TimerMan.DeltaTimeMS)
21752171
end
21762172

21772173
-- Artificially decrease reported range to make sure AI
@@ -2633,9 +2629,9 @@ function HumanBehaviors.ThrowTarget(AI, Owner, Abort)
26332629
local scan = 0
26342630
local miss = 0 -- stop scanning after a few missed attempts
26352631
local AimPoint, Dist, MO, ID, rootID, LOS, aim
2636-
2632+
26372633
AI.TargetLostTimer:SetSimTimeLimitMS(1500)
2638-
2634+
26392635
while true do
26402636
if not MovableMan:ValidMO(AI.Target) then
26412637
break
@@ -2747,7 +2743,7 @@ function HumanBehaviors.ThrowTarget(AI, Owner, Abort)
27472743
aim = HumanBehaviors.GetGrenadeAngle(AimPoint, Vector(), Grenade.MuzzlePos, Grenade.MaxThrowVel)
27482744
if aim then
27492745
ThrowTimer:Reset()
2750-
aimTime = RangeRand(1000, 1200)
2746+
aimTime = RangeRand(900, 1100)
27512747
local maxAim = aim
27522748

27532749
-- try again with an average throw vel
@@ -2829,24 +2825,22 @@ function HumanBehaviors.AttackTarget(AI, Owner, Abort)
28292825
local meleeDist = 0
28302826
local startPos = Vector(Owner.EyePos.X, Owner.EyePos.Y)
28312827

2832-
if Owner.EquippedItem then
2833-
if Owner.EquippedItem:HasObjectInGroup("Tools - Diggers") or Owner.EquippedItem:HasObjectInGroup("Weapons - Melee") then
2834-
meleeDist = Owner.Radius + 25
2835-
startPos = Vector(Owner.EquippedItem.Pos.X, Owner.EquippedItem.Pos.Y)
2836-
end
2828+
if Owner:EquipDeviceInGroup("Tools - Diggers", true) or Owner:EquipDeviceInGroup("Weapons - Melee", true) then
2829+
meleeDist = Owner.Radius + 25
2830+
startPos = Vector(Owner.EquippedItem.Pos.X, Owner.EquippedItem.Pos.Y)
28372831
elseif Owner.armSway then
2838-
if Owner.FGArm then
2839-
meleeDist = Owner.Radius + Owner.FGArm.Radius
2840-
startPos = Owner.FGArm.Pos
2841-
elseif Owner.BGArm then
2842-
meleeDist = Owner.Radius + Owner.BGArm.Radius
2843-
startPos = Owner.BGArm.Pos
2832+
local arm = Owner.FGArm or Owner.BGArm
2833+
if arm then
2834+
meleeDist = arm.Radius + arm.Radius
2835+
startPos = arm.Pos
28442836
end
28452837
end
28462838
if meleeDist > 0 then
2847-
local dist = SceneMan:ShortestDistance(startPos, AI.Target.Pos, false)
2839+
local attackPos = (AI.Target.ClassName == "ADoor" and ToADoor(AI.Target).Door and ToADoor(AI.Target).Door:IsAttached()) and ToADoor(AI.Target).Door.Pos or AI.Target.Pos
2840+
local dist = SceneMan:ShortestDistance(startPos, attackPos, false)
28482841
if dist.Magnitude < meleeDist then
2849-
AI.Ctrl.AnalogAim = SceneMan:ShortestDistance(Owner.EyePos, AI.Target.Pos, false).Normalized
2842+
AI.lateralMoveState = Actor.LAT_STILL
2843+
AI.Ctrl.AnalogAim = SceneMan:ShortestDistance(Owner.EyePos, attackPos, false).Normalized
28502844
AI.fire = true
28512845
else
28522846
AI.fire = false
@@ -2931,7 +2925,7 @@ function HumanBehaviors.GetAngleToHit(PrjDat, Dist)
29312925
return Dist.AbsRadAngle
29322926
else -- compensate for gravity
29332927
local rootSq, muzVelSq
2934-
local D = Dist / FrameMan.PPM -- convert from pixels to meters
2928+
local D = Dist / GetPPM() -- convert from pixels to meters
29352929
if PrjDat.drg < 1 then -- compensate for air resistance
29362930
local rng = D.Magnitude
29372931
local timeToTarget = math.floor((rng / math.max(PrjDat.vel*PrjDat.drg^math.floor(rng/(PrjDat.vel+1)+0.5), PrjDat.thr)) / TimerMan.DeltaTimeSecs) -- estimate time of flight in frames

0 commit comments

Comments
 (0)