Skip to content
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 files that use globals instead of locals #4717

Closed
2 of 30 tasks
relent0r opened this issue Feb 20, 2023 · 1 comment · Fixed by #4774
Closed
2 of 30 tasks

AI files that use globals instead of locals #4717

relent0r opened this issue Feb 20, 2023 · 1 comment · Fixed by #4774
Labels
area: AI related to AI functions area: sim Area that is affected by the Simulation of the Game status: new issue Is added to every issue to indicate that it has not been reviewed yet type: bug

Comments

@relent0r
Copy link
Contributor

relent0r commented Feb 20, 2023

Describe the bug
While investigating a dead loop and looking for oddities I found a bunch of varaibles related to AI that are set as global instead of local. This could be causing issues with AI where they are sharing/modifying each others variables during games which would cause strange behavior.

I'll go through and look to fix the AI specific ones that I understand and consult others for ones that are not directly AI. The biggest culprits are the Sorian functions.

List of noted fuctions and associated vars

aibehavours.lua

function GetNavalPlatoonMaxRange

  • isTech1 is not local
  • selectedWeaponArc is not local

function CDRRunAway

  • cmd is not local

function CDROverCharge

  • searchRadius is not local
  • enemyCdrThreat is not local
  • friendlyThreat is not local

TempestBehavior = function(self)

  • scoutPath is not local

function CDROverChargeSorian

  • shieldPercent is not local
  • enemyCdrThreat is not local
  • friendlyThreat is not local

function CommanderThreadSorian

  • moveOnNext is not local
  • moveWait is not local

AhwassaBehaviorSorian

  • cmd is not local

aibuildstructures.lua

function DoHackyLogic

  • [ ]aiBrain is not local

aiutilities.lua

function AIGetSortedScoutingLocations

  • rand is not local

function GetNearestPathingPoint

  • retPos is not local

function AIFindPingTargetInRangeSorian

  • unit is not local

function AIFindAirAttackTargetInRangeSorian

  • unit is not local

function AIFindBrainTargetInRangeSorian

  • unit is not local

function AIFindUndefendedBrainTargetInRangeSorian

  • unit is not local

sorianutilities.lua

function AIHandleLandIntel

  • nextBase is not local

function AIRandomizeTaunt

  • tauntid is not local

function AIHandlePing

  • nextping is not local

function FindUnfinishedUnits

  • donePercent is not local

function FindDamagedShield
shieldPercent is not local

function Round(x, places)

  • shift is not local
  • result is not local

function CreateExplosionMesh

  • proj is not local

navgenerator.lua

  • 451 z is not local
  • 466 z is not local

maputil.lua
function GetStartPositions

  • 204 pos is not local

unicountbuildconditions.lua
function UnfinishedUnits

  • 1395 donePercent
@relent0r relent0r added the status: new issue Is added to every issue to indicate that it has not been reviewed yet label Feb 20, 2023
@Garanas Garanas added type: bug area: sim Area that is affected by the Simulation of the Game area: AI related to AI functions labels Feb 21, 2023
@Garanas
Copy link
Member

Garanas commented Mar 2, 2023

Tackled the issue with navgenerator.lua via #4761

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: AI related to AI functions area: sim Area that is affected by the Simulation of the Game status: new issue Is added to every issue to indicate that it has not been reviewed yet type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants