-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AI Update V8 #3114
Merged
Merged
AI Update V8 #3114
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uveso
changed the title
AI Update V8 - Rebased
AI Update V8 - Rebased DO NOT MERGE! (more updates are on the way)
May 30, 2020
Uveso
changed the title
AI Update V8 - Rebased DO NOT MERGE! (more updates are on the way)
AI Update V8
Jun 3, 2020
Finally this patch will fix the game slowdown on long AI games. Reason for the slowdown was the engineermanger while ping pong forking functions. This was causing in the end a engine slowdown a finally a stack buffer overrun. This patch also stores almost every forked thread to the corresponding unit/weapon, so it can be destroyed on unit dead to prevent parentless threads. The transport function is now using surfaceghight for the transportation target for faster unit drops. Also fixed an issue where the ACU is not moving on gamestart. This was caused by the `BlockCommandQueue` from the ACU WarpInAnimation Changelog: ------------------------------------------------------------------------------------ aiarchetype-managerloader.lua function ExecutePlan() -Opt: Storing Forked Thread inside the aiBrain Trashbag for better performance ------------------------------------------------------------------------------------ AIBehaviors.lua function CommanderThread() -Opt: Added check for 'BlockCommandQueue' to prevent stucked ACU after WarpInAnimation function CommanderThreadImproved() -Opt: Added check for 'BlockCommandQueue' to prevent stucked ACU after WarpInAnimation function GetClosestShieldProtectingTarget() -Opt: Added safeguard for dead attacker or target function CommanderThreadSorian() -Opt: Added check for 'BlockCommandQueue' to prevent stucked ACU after WarpInAnimation ------------------------------------------------------------------------------------ SorianStrategyBuilders.lua BuilderGroup 'Sorian Excess Mass Strategy' -Opt: Storing Forked Thread inside the aiBrain Trashbag for better performance ------------------------------------------------------------------------------------ AttackManager.lua function FormAttackPlatoon() -Opt: Storing Forked Thread inside the aiBrain Trashbag for better performance ------------------------------------------------------------------------------------ aiutilities.lua function UseTransports() -Opt: Changed command WaitTicks() to coroutine.yield() for better performance -Opt: Added surfacehight to trasnport location for faster unit unloading function EngineerTryReclaimCaptureArea() -Fix: Function now only returns true if we have valid unit for capture function UseTransports -Fix: Added IssueClearCommands for transports to prevent flightloops ------------------------------------------------------------------------------------ sorianutilities.lua function Nuke() -Opt: Storing Forked Thread inside the aiBrain Trashbag for better performance ------------------------------------------------------------------------------------ aibrain.lua function AddBuilderManagers() -Opt: Added a baseType to every expansion for faster expansion count function GetManagerCount() -Opt: To count expansions we are now searching for a baseType not 8 x name search function InitialAIThread -Fix: Delaying the AI so it can't reclaim the start area before it's cleared from the ACU landing blast. ------------------------------------------------------------------------------------ cybranunits.lua Class CConstructionEggUnit() -Opt: Storing Forked Thread inside the Unit Trashbag for better performance ------------------------------------------------------------------------------------ aiattackutilities.lua function GetBestThreatTarget() -Fix: changed missplaced variables in GetThreatAtPosition call ------------------------------------------------------------------------------------ defaultunits.lua function OnPrepareArmToBuild() (ConstructionUnit Class) -Opt: Storing Forked Thread inside the Unit Trashbag for better performance function OnPrepareArmToBuild() (CommandUnit Class) -Opt: Storing Forked Thread inside the Unit Trashbag for better performance ------------------------------------------------------------------------------------ platoon.lua several functions() -Opt: Changed command WaitTicks() to coroutine.yield() for better performance function AssistBody() -Opt: Moved safeguard for nonexisting platoons at the start of the function function EngineerBuildAI() -Opt: Removed old sorianfunction for delaying platoonbuilder -Fix: Excluded StationAssitPods from building tasks -Opt: Using now .Location instead of the functioncall :GetLocationCoords() -Fix: The safeguard at the end of the function is now working function WatchForNotBuilding() -Opt: Removed unused unitstate checks function ProcessBuildCommand() -Opt: replaced BuildToNormalLocation and NormalToBuildLocation and used numbers directly -Fix: Units now get capture/reclaim and buildcommands queued instead of looping the ProcessBuildCommand -Fix: Prevent disbanding a platoon while on a transport function EngineerBuildAISorian -Opt: Removed old sorianfunction for delaying platoonbuilder -Opt: Using now .Location instead of the functioncall :GetLocationCoords() ------------------------------------------------------------------------------------ ScenarioUtilities.lua function CommanderWarpDelay() -Opt: Removed BlockCommandQueue for AI brains ------------------------------------------------------------------------------------ EngineerManager.lua several functions() -Opt: Changed command WaitTicks() to coroutine.yield() for better performance function AddUnit() -Fix: Excluded StationAssitPods from building tasks -Fix: Changed the logic of forking threads to prevent gameslowdown at +1 hour function GetNumCategoryBeingBuilt() -Opt: returning a value directly without defining it local function TaskFinished() -Fix: Changed the logic of forking threads to prevent gameslowdown at +1 hour Removed functions: EngineerWaiting, InitialWait, DelayAssign, DelayAssignBody -Fix: Changed the logic of forking threads to prevent gameslowdown at +1 hour Replaced removed functiosn with new functions: ForkEngineerTask, DelayAssign, Wait, EngineerWaiting -Fix: Changed the logic of forking threads to prevent gameslowdown at +1 hour ------------------------------------------------------------------------------------ Unit.lua function DeathThread() -Opt: Destroy trashbags only if not already done function DestroyAllTrashBags() -New: This function clears all trashbags and unit effects function OnDestroy() -New: Destroy trashbags only if not already done inside DeathThread() function StopRocking() -Opt: Only kill a thread when it actual exist. ------------------------------------------------------------------------------------ Blueprints.lua function HandleUnitWithBuildPresets() -New: Adding SACU presets as unit category for AI builders ------------------------------------------------------------------------------------ CIFArtilleryProton01_script.lua function OnImpact() -Opt: Storing Forked Thread inside the Projectile Trashbag for better performance ------------------------------------------------------------------------------------ UEL0001_script.lua function CreateEnhancement() -Opt: Storing Forked Thread inside the Unit Trashbag for better performance ------------------------------------------------------------------------------------ UEL0301_script.lua function CreateEnhancement() -Opt: Storing Forked Thread inside the Unit Trashbag for better performance ------------------------------------------------------------------------------------ XRB2308_script.lua function OnStopBeingBuilt() -Opt: Storing Forked Thread inside the Unit Trashbag for better performance function StartSinking() -Opt: Storing Forked Thread inside the Unit Trashbag for better performance ------------------------------------------------------------------------------------ XRB2309_script.lua function StartSinking() -Opt: Storing Forked Thread inside the Unit Trashbag for better performance
Update for debug log, patch for ProcessBuildCommand (engineers first move to the destination and then decide if they need reclaim or capture.)
Platoons with priority 0 got deleted by the SortBuilderList function, but we need them running to check the priority function.
leftover from sorian strategy manager
happens often when noRush is activated
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(Rebased 25.May)
(Rebased 10.Aug)
Finally this patch will fix the game slowdown on long AI games.
Reason for the slowdown was the engineermanger while ping pong forking functions.
This was causing in the end a engine slowdown a finally a stack buffer overrun.
This patch also stores almost every forked thread to the corresponding unit/weapon,
so it can be destroyed on unit dead to prevent parentless threads.
The transport function is now using surfaceghight for the transportation target
for faster unit drops.
Also fixed an issue where the ACU is not moving on gamestart.
This was caused by the
BlockCommandQueue
from the ACU WarpInAnimationChangelog: (updated 11.Aug)
CAiBrain.lua
-Upd: fixed/updated some function information
aiarchetype-managerloader.lua
function ExecutePlan()
-Opt: Storing Forked Thread inside the aiBrain Trashbag for better performance
AIBehaviors.lua
function CommanderThread()
-Opt: Added check for 'BlockCommandQueue' to prevent stucked ACU after WarpInAnimation
function CommanderThreadImproved()
-Opt: Added check for 'BlockCommandQueue' to prevent stucked ACU after WarpInAnimation
function GetClosestShieldProtectingTarget()
-Opt: Added safeguard for dead attacker or target
function CommanderThreadSorian()
-Opt: Added check for 'BlockCommandQueue' to prevent stucked ACU after WarpInAnimation
SorianStrategyBuilders.lua
BuilderGroup 'Sorian Excess Mass Strategy'
-Opt: Storing Forked Thread inside the aiBrain Trashbag for better performance
AttackManager.lua
function FormAttackPlatoon()
-Opt: Storing Forked Thread inside the aiBrain Trashbag for better performance
aiutilities.lua
function UseTransports()
-Opt: Changed command WaitTicks() to coroutine.yield() for better performance
-Opt: Added surfacehight to trasnport location for faster unit unloading
function EngineerTryReclaimCaptureArea()
-Fix: Function now only returns true if we have valid unit for capture
function UseTransports
-Fix: Added IssueClearCommands for transports to prevent flightloops
sorianutilities.lua
function Nuke()
-Opt: Storing Forked Thread inside the aiBrain Trashbag for better performance
aibrain.lua
function AddBuilderManagers()
-Opt: Added a baseType to every expansion for faster expansion count
function GetManagerCount()
-Opt: To count expansions we are now searching for a baseType not 8 x name search
function InitialAIThread
-Fix: Delaying the AI so it can't reclaim the start area before it's cleared from the ACU landing blast.
function OnCreateAI
-Fix: removed AI-Uveso and AI-Dilli identifier (will be set from the AI mods now)
function OnDefeat
-Fix: Propper removing of AI threads and managers at game end.
BuilderManager.lua
function SortBuilderList
-Fix: Buiulder with priorty 0 will no longer ignored on sorting the builderlist
cybranunits.lua
Class CConstructionEggUnit()
-Opt: Storing Forked Thread inside the Unit Trashbag for better performance
aiattackutilities.lua
function GetBestThreatTarget()
-Fix: changed missplaced variables in GetThreatAtPosition call
defaultunits.lua
function OnPrepareArmToBuild() (ConstructionUnit Class)
-Opt: Storing Forked Thread inside the Unit Trashbag for better performance
function OnPrepareArmToBuild() (CommandUnit Class)
-Opt: Storing Forked Thread inside the Unit Trashbag for better performance
platoon.lua
several functions()
-Opt: Changed command WaitTicks() to coroutine.yield() for better performance
function AssistBody()
-Opt: Moved safeguard for nonexisting platoons at the start of the function
function EngineerBuildAI()
-Opt: Removed old sorianfunction for delaying platoonbuilder
-Fix: Excluded StationAssitPods from building tasks
-Opt: Using now .Location instead of the functioncall :GetLocationCoords()
-Fix: The safeguard at the end of the function is now working
function WatchForNotBuilding()
-Opt: Removed unused unitstate checks
function ProcessBuildCommand()
-Opt: replaced BuildToNormalLocation and NormalToBuildLocation and used numbers directly
-Fix: Units now get capture/reclaim and buildcommands queued instead of looping the ProcessBuildCommand
-Fix: Prevent disbanding a platoon while on a transport
function EngineerBuildAISorian
-Opt: Removed old sorianfunction for delaying platoonbuilder
-Opt: Using now .Location instead of the functioncall :GetLocationCoords()
ScenarioUtilities.lua
function CommanderWarpDelay()
-Opt: Removed BlockCommandQueue for AI brains
EngineerManager.lua
several functions()
-Opt: Changed command WaitTicks() to coroutine.yield() for better performance
function AddUnit()
-Fix: Excluded StationAssitPods from building tasks
-Fix: Changed the logic of forking threads to prevent gameslowdown at +1 hour
function GetNumCategoryBeingBuilt()
-Opt: returning a value directly without defining it local
function TaskFinished()
-Fix: Changed the logic of forking threads to prevent gameslowdown at +1 hour
function ManagerLoopBody
-Del: removed the function (was a leftover from sorians strategy manager)
Removed functions:
EngineerWaiting, InitialWait, DelayAssign, DelayAssignBody
-Fix: Changed the logic of forking threads to prevent gameslowdown at +1 hour
Replaced removed functiosn with new functions:
ForkEngineerTask, DelayAssign, Wait, EngineerWaiting
-Fix: Changed the logic of forking threads to prevent gameslowdown at +1 hour
Unit.lua
function DeathThread()
-Opt: Destroy trashbags only if not already done
function DestroyAllTrashBags()
-New: This function clears all trashbags and unit effects
function OnDestroy()
-New: Destroy trashbags only if not already done inside DeathThread()
function StopRocking()
-Opt: Only kill a thread when it actual exist.
Blueprints.lua
function HandleUnitWithBuildPresets()
-New: Adding SACU presets as unit category for AI builders
UEL0001_script.lua
function CreateEnhancement()
-Opt: Storing Forked Thread inside the Unit Trashbag for better performance
UEL0301_script.lua
function CreateEnhancement()
-Opt: Storing Forked Thread inside the Unit Trashbag for better performance
XRB2308_script.lua
function OnStopBeingBuilt()
-Opt: Storing Forked Thread inside the Unit Trashbag for better performance
function StartSinking()
-Opt: Storing Forked Thread inside the Unit Trashbag for better performance
XRB2309_script.lua
function StartSinking()
-Opt: Storing Forked Thread inside the Unit Trashbag for better performance