-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Initial version of attack/support rework #2383
Initial version of attack/support rework #2383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some stuff I saw. Happy that the annoying incoming missile event is being killed.
["idleassets"] call A3A_fnc_getStatVariable; | ||
["enemyResources"] call A3A_fnc_getStatVariable; | ||
["HQKnowledge"] call A3A_fnc_getStatVariable; | ||
// ["idlebases"] call A3A_fnc_getStatVariable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one in particular will stay, because I'm still in two minds as to whether to use it more. The others are very dead.
- Fix bad macro argument counts on mortar & artillery - Add a lot of missing headers - Fix SUP_SAMAvailable, wasn't updated to new system
- Fixed broken code for reducing knowledge of old HQ positions - Fixed UAVs being added to active supports and breaking stuff - Fixed debug timeout value on client idle checker - Fixed swapped success/fail conditions for rebels on wavedAttack - Fixed bad no-landbase check in wavedAttack - Changed enemy vs enemy wavedAttack to create notification rather than task
- Fixed formatting in attackHQ - Increased AREA type support accuracy and reduced setup times - Increased the reveal value for UAVs so that enemies search buildings
- Added some new intel types to selectIntel, made traitor intel text less evil - Fixed some fire mode, target completion and timeout issues in CAS support - Fixed issue where interrogating was never a good option - Added partial fix for heli crew remaining in downed heli
- Fixed wrong function name in timingCA->resource translation - Fixed some vanilla vehicles in APC list that lacked cargo slots - Added basic override system for vehicle cost & threat values - Added some cost overrides for trash vanilla attack helis
…ity#2047 - Remove minefield clearance repair vehicle exploit
- Added cost overrides for RHS APCs and attack helis. - Moved zu-23 trucks to light armed (more appropriate in current system). - Removed some attack helis which were inferior variants of weak attack helis.
- Fixed client/HC initFuncs load order - Doubled all enemy resource income - Added an extra resource difficulty category at the bottom - Increased permitted callForSupport call rate - Other defence response balance tweaks
- Added vehiclesLightAPCs, vehiclesIFVs and vehiclesHelisLightAttack categories - Filled them out for vanilla & RHS modsets - Reworked air support vehicle selection to use light attack helis and CAS supports - Adjusted land transport vehicle selection to use light APCs and IFVs if present
- Reduce IFV chance - Move RHSUSF M2 trucks into light APCs
- Fix wavedAttack UAV spam bug. - Fix downed heli EH removal. - Update attackHQ for attack heli balance.
Getting pretty close to done. Remaining test/cleanup:
|
- Make vehicle attributes work with verifyAssets. - Give enemy attacks some distance-from-airfield preference. - Adjust how players are accounted for in attack decisions.
- 7x optimization of getNearestNavNode - Add nav nodes on roads near markers if there aren't any already - Added function to quickly find minimum road path distances
- Refactor waved attack, punishment, HQ attack and singleAttack to merge spawning code. - Punishment and HQ attack can now spawn land vehicles. - All attacks use more land vehicles for factions with low air flag. - Improved nav distance search functionality, search further with low air. - Lower chance of air-based supports, higher chance of land with low air. Unrelated changes: - Split enemy and rebel skill parameters. - Changed game info display to show resource balance rather than skill. - requestSupport now more likely to re-use CAS supports. - Reduce spotting distance for HQ when no large bunker present. - Prevented adding units direct to garrison when targeted by attack/punishment. - Fixed old refactor bug where fleeing happened too early. - Fleeing units now count towards attack/QRF failure termination conditions. - Fix old createVehicleCrew bug with VN gun trucks. - Fix spawner race condition with NATOinit cargo vs despawners. - Eventually kick units out of vehicles after they're destroyed.
- Fixed copypaste typo for Unsung A1J CAS main gun. - Added light helis into createAttackForceAir (forgot). - Fixed case where the create functions didn't work correctly for all-attack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went through all the stuff and marked the ones where I have some questions and to check ToDos marked by you, just to check them off. I also didn't mark every ToDo, just so you know.
In addition to that I saw that there are some headers not completely set up or fully missing. Hence I'd like you to go through the files and clean up the headers a bit. The ones I marked are exemplary.
Other than that nothing special jumped into my eye. No typos, no obvious wrong content in texts.
…e checks. - Rewrite patrol vehicle choice, add support for low air factions. - Expanded input options for some pathfinding functions. - Workaround paradrops sometimes losing their waypoints after landing. - Workaround Unsung AN-2 cargo seat definition bug.
- Trucks now unload & RTB instead of crew/cargo merge. - Added partial stuck handler to AAFRoadPatrol. - Separated land vehicle spawns more to reduce spawn collisions.
…y#2383) * Initial version of attack/support rework * Don't count vehicles towards enemy garrison strength * Fix missing client idle checker and mission distance attack chance boost * - Add player movement speed as condition for clientIdleChecker - Fix bad macro argument counts on mortar & artillery - Add a lot of missing headers - Fix SUP_SAMAvailable, wasn't updated to new system * - Fixed dead function entries in CfgFunctions - Fixed broken code for reducing knowledge of old HQ positions - Fixed UAVs being added to active supports and breaking stuff - Fixed debug timeout value on client idle checker - Fixed swapped success/fail conditions for rebels on wavedAttack - Fixed bad no-landbase check in wavedAttack - Changed enemy vs enemy wavedAttack to create notification rather than task * - Fixed targpos/destpos issues in attackHQ - Fixed formatting in attackHQ - Increased AREA type support accuracy and reduced setup times - Increased the reveal value for UAVs so that enemies search buildings * - Moved selectIntel to server side - Added some new intel types to selectIntel, made traitor intel text less evil - Fixed some fire mode, target completion and timeout issues in CAS support - Fixed issue where interrogating was never a good option - Added partial fix for heli crew remaining in downed heli * - Fixed some no-land-base bugs in singleAttack - Fixed wrong function name in timingCA->resource translation - Fixed some vanilla vehicles in APC list that lacked cargo slots - Added basic override system for vehicle cost & threat values - Added some cost overrides for trash vanilla attack helis * - Fix minefield clearance bug probably from official-antistasi-community#2047 - Remove minefield clearance repair vehicle exploit * - Reworked CAS acquisition, run distance and altitude management. - Added cost overrides for RHS APCs and attack helis. - Moved zu-23 trucks to light armed (more appropriate in current system). - Removed some attack helis which were inferior variants of weak attack helis. * - Fixed scheduler typos - Fixed client/HC initFuncs load order - Doubled all enemy resource income - Added an extra resource difficulty category at the bottom - Increased permitted callForSupport call rate - Other defence response balance tweaks * Vehicle selection rebalance: - Added vehiclesLightAPCs, vehiclesIFVs and vehiclesHelisLightAttack categories - Filled them out for vanilla & RHS modsets - Reworked air support vehicle selection to use light attack helis and CAS supports - Adjusted land transport vehicle selection to use light APCs and IFVs if present * - Fix bugs in air support vehicle selection - Reduce IFV chance - Move RHSUSF M2 trucks into light APCs * CUP template updates and related vehicle mix balance tweaks * - Workaround probable Arma bug with adding multiple UAV crew. - Fix wavedAttack UAV spam bug. - Fix downed heli EH removal. - Update attackHQ for attack heli balance. * Fix CUP template typos * Bug fixes: - Fix RHS A10 not using the pylon version. - Fix vehicle deletion handler for vehicles with no selections. - Make CAS repeat fire more reliable. - Increase CAS circle distance and increase approach angle a bit so CUP works. - Fix typos in convoy spawning. - Fallback properly when pathfinding fails. - Fix multiple issues with HQ reposition effects on HQ knowledge. - Fix destroyed invader resources/factories having black markers. - Possible fix for UPSMON garrison reinf not moving. Features & balance changes: - Refresh 3CB Factions templates for APC/AH/attributes changes. - Prevent parked civvy cars spawning on junctions and bridges. - Prevent fresh CAS being called against infantry targets. - Increase proportion of light attack helis used. - Move RG31s into light APC. * - Fix some template typos. - Add simple patrol script for groups added to enemy garrisons. - Fix & improve (probably) reb vs enemy target choice. - Remove markerChange recapture monitor, add ability for QRFs to flip markers. - Make civ car count dependent on sqrt of pop and reduce with war level. - Improve cleanserVeh. - Added a hard timeout for QRFs to fix case where they refuse to advance. - Fix militia cars using the wrong behaviour. * - APC/heli updates for 3CB BAF templates. - Reduce chance of calling CAS against unarmed vehicles. - Increase callForSupport cooldown a bit. * - Fixed bug where QRFs >500m from markers threw RPT errors and failed to despawn. - Fixed bug where mortars and artillery didn't work for subsequent support calls. - Reduced invader advantage and moved it to params for load/save support. - Cleaned up some unnecessary var broadcasts. - Added some vehicle category explanations to the faction template example. * Balance tweaks to attack/support rework: - Increase costs of RHS/3CBF BMP2/3 and Bradley a bit. - Decrease cost of Mystere AA planes. - Decrease enemy resource tier scaling by 50%. - Decrease cost of simulated attacks by 0.25x. - Reduce chance of spawning CAS planes as part of attack force. - Add medium-range AA missiles to L39s because they couldn't kill anything faster. - Decrease values of radio outpot, seaport and airport relative to other locations. - Slightly decrease importance of value in attack choice weighting. - Fix old bug caused by mortar team stopping in location with no valid mortar positions. * Balance tweaks plus fixes for old despawning issues. General balance: - Reduced defence resources by 2x and attack resources by 3x. - Enemies now trade between attack and defence depending on current defence resources. - Reduced simulated attack cost a bit. - Reduced attack target value dependence on garrison size. - Increased target value of towns. - Made invader vs occupant balance a first-class parameter. - Added div10 adjuster for parameters to make the formulas more readable. CAS tuning: - Fixed issue where CAS could skip firing on late acquisitions. - Allowed CAS to attack nearby units instead when targeting meatsacks. - CAS now only uses guns against meatsacks, and closer ranges only. Fixes for new bugs: - Fixed input type case sensitivity and bracket issue in convoys. - Fixed reversed parameters for punishments in chooseAttack. Despawn fixes: - Switched rebel vehicle despawn to garbage cleaner (was broken). - Fixed issue where statics recaptured by enemy didn't despawn. - Removed old reportedVehs array, replaced with A3A_reported setVar * Various attack/support fixes: - Fix flipped parameters in requestArtillery (not sure how, maybe miscommit). - Fix various places where light attack helis weren't considered. - Fix bad side var in invaderPunish. * Balance & template tweaks to attack/support: - Increase player count scaling a bit. - Remove defence -> attack resource conversion penalty. - Set 3CB Factions vt7 to LDF vs HIDF. - Remove Super Tacano until hellfires can be made to work. - Add cold war AH1Zs to HIDF. * Bugfixes and balance tweaks to attack/support rework: - Aggro now has some direct impact on enemy resource income with reb vs gov vs inv. - Available defence resources now adjust immediately on player count changes. - Added marker value for towns to reduce QRFs supporting punishments. - Radio keys now consume one per support/attack, not one per message. - Fixed bug where anti-aircraft supports didn't count towards anti-air spend. - Fixed bug where positional artillery calls didn't work. - Fixed bug where attack forces used more support vehicles than intended. - Fixed bug where BAF attack heli arrays were unfinished. - Increased Apache costs. * VN template update for attack/support rework and related tweaks: - Allow vehicles in tank category to carry infantry if they have cargo seats - Add light attack vehicles with 4+ cargo seats to transport vehicle array - Switch cargo-only ground vehicles from GETOUT to MOVE, seems to work better - Improve handling of missing UAV/CAS/ASF cases - Allowed crews to stay in rebel AT & AA vehicls when immobilized - Removed a few dead vehicle categories - Removed obsolete artillery detection EH and old AI artillery function. * Add doc headers to support routine functions * Cleanup some load/save vars for attack/support rework * Fix defence resources changing on load/save cycle * Attack/support fixes: - Make wheeled armour breachable again. - Re-add intel-searching payment. - Fix broken QRF calls in bank and invader-refugee missions - Adjust convoy vehicle count by playerScale * Fix missing comma in RHS vehicle attributes * Fix copypaste error in markerChange * Bugfixes and balance tweaks for attack/support: - Implemented min/max artillery range properly so that BM-21 etc works. - Rewrote threat balance cap for better defence response scaling. - Added mechanic to reduce QRF trickling. - Increased overall enemy resources by ~20%. - Reduced effect of war tier on chance of enemies attacking rebel targets. - Fixed excessive intel corpse search reward. - Removed broken singleAttack calls in intel code. - Fixed rare createAttackForceAir vehicle count bug. Not strictly related stuff: - Fixed bug in no-path fallback waypoint creation. - Fixed specops hill-dwellers being spawners. - Added some logging to HC disconnect function. * Increase chance of enemy attacks against locations with players nearby, and improve AFK checking for commander * Reduce support delays * Hopefully final attack/support tweaks: - Make vehicle attributes work with verifyAssets. - Give enemy attacks some distance-from-airfield preference. - Adjust how players are accounted for in attack decisions. * Partial pathfinding rework: - 7x optimization of getNearestNavNode - Add nav nodes on roads near markers if there aren't any already - Added function to quickly find minimum road path distances * Implement low-air flag for factions (eg. PAVN, WW2 stuff): - Refactor waved attack, punishment, HQ attack and singleAttack to merge spawning code. - Punishment and HQ attack can now spawn land vehicles. - All attacks use more land vehicles for factions with low air flag. - Improved nav distance search functionality, search further with low air. - Lower chance of air-based supports, higher chance of land with low air. Unrelated changes: - Split enemy and rebel skill parameters. - Changed game info display to show resource balance rather than skill. - requestSupport now more likely to re-use CAS supports. - Reduce spotting distance for HQ when no large bunker present. - Prevented adding units direct to garrison when targeted by attack/punishment. - Fixed old refactor bug where fleeing happened too early. - Fleeing units now count towards attack/QRF failure termination conditions. - Fix old createVehicleCrew bug with VN gun trucks. - Fix spawner race condition with NATOinit cargo vs despawners. - Eventually kick units out of vehicles after they're destroyed. * Unsung template fixup for attack/support, plus fixes: - Fixed copypaste typo for Unsung A1J CAS main gun. - Added light helis into createAttackForceAir (forgot). - Fixed case where the create functions didn't work correctly for all-attack. * Restore unit skills properly on callForSupport, plus comment and header cleanup * - Fix up reinforcements for low air factions and new land support base checks. - Rewrite patrol vehicle choice, add support for low air factions. - Expanded input options for some pathfinding functions. - Workaround paradrops sometimes losing their waypoints after landing. - Workaround Unsung AN-2 cargo seat definition bug. * Clean up some hanging comments * Refactor to move support availability checks into init * Light ground vehicle behaviour improvements: - Trucks now unload & RTB instead of crew/cargo merge. - Added partial stuck handler to AAFRoadPatrol. - Separated land vehicle spawns more to reduce spawn collisions. * Increase enemy skill variance with player count a bit * Make orbital strike support work again
What type of PR is this.
What have you changed and why?
This is a general rework of all enemy supports and attacks to draw from limited resource pools. Key files and systems:
Resource pools
Enemy resources are split into two types, "attack" and "defence". Units generated as part of an attack or support are paid for up-front and have their "A3A_resPool" variable set accordingly. If despawned in good condition, they are partially refunded. Mission units have A3A_resPool set to "legacy" and are free to spawn (as they're effectively ambient units with no particular task), and paid for equally from both pools on destruction. Garrison units are paid for on creation and not refunded on despawn for obvious reasons. Attack and defence resources are saved, and updated appropriately on save: Pre-paid units are refunded according to damage level.
Attack and defence pools are used differently. An attack is launched once an enemy faction hits >0 attack resources, typically leaving that faction with a large negative value, which is slowly increased back to zero before the next attack can be launched. Defence resources typically have a positive buffer which is used up as reinforcements and supports are generated.
AggressionUpdateLoop
This file (basically a 60-second loop) is now responsible for updating all the balance variables, incrementing the four resource pools and launching attacks. Descriptions of balance variables:
ResourceCheck (the 10-minute loop) still has most of its former responsibilities, although it now runs with any active players (not necessarily a commander), and no longer generates supply convoys against flipped towns (now the responsibility of chooseAttack).
Support system
This is the call/response system rather than the limited-knowledge system, as I got it mostly working first. Might be replaced in the future as limited-knowledge does have advantages. Key files:
initSupports set up various arrays and hashmaps used by the support system, including marker values and static support type data. They're all documented there, so I won't repeat it here.
maxDefenceSpend determines how many resources can be spent against a particular target or marker. It takes account of the importance of the location (based on nearby friendly and enemy markers), aggregate threat (based on live friendly garrisons and enemy troops nearby, plus recent casualties taken), available resources, and support resources already spent against that target/area.
requestSupport takes dumb support requests against targets (typically from callForSupport or airspaceControl), uses maxDefenceSpend to decide how many resources to spend, and then chooses a support type dependening on base types (area, troops, target) already called nearby. It also uses the SUP_*Available functions to generate weights for each support based on target type and other support-specific factors. There is a similar but simpler function (requestArtillery) used to choose artillery type supports for attacks. requestSupport always uses the defence pool.
createSupport is a worker function to force-create a support of a specific type. It will use already-active supports by preference, if they don't currently have a target.
Each support typically has an availability function (actually returns a weight now, could be renamed), a creation function (intended to be called by createSupport, and so returns fairly quickly), and a persistently spawned routine that manages the support while active. Multi-target supports update the A3A_activeSupports array to indicate readiness and completion.
All working supports from the previous system have been preserved except for Gunship and the orbital laser, which need updating to new systems.
Individual supports have been heavily refactored and in some cases rewritten. Some common trends:
The CAS support had a major overhaul, rewriting the pre-run loop to a semi-proper state engine and converting CASRun to an onEachFrame handler so that it behaves properly under moderate script load.
callForSupport is now only triggered by damage, not spotting. Unconsciousness triggers have been cleaned up to call AIReactOnKill more consistently with and without ACE. These triggers also add to the recentDamage arrays on the server, to improve the decision making of maxDefenceSpend.
Marker recapture counterattacks now use maxDefenceSpend to calculate how large a counterattack to send. If the capture was a hard fight with multiple supports called, or the flag was reflipped shortly after a counterattack was cleared, it's likely that nothing further will be sent.
QRF and attack vehicle spawning
QRFs, counterattacks (singleAttack), major attacks, punishments and HQ attacks have all been rewritten to use the same code paths for spawning and vehicle/troop behaviour.
Vehicle choice is based on splitting vehicles into transport (contains cargo units) and support types. Any attack force must contain at least one transport vehicle, typically more than half. Only attack helis are generated as air supports. CAS and ASF must be called separately.
Land forces are spawned using the vehicle spawn places system, patched up so that it mostly works. Maps without sufficient vehicle spawn places defined will need them added, otherwise land vehicles will be minimal. Air vehicles are restricted to spawning at airfields or the carrier marker.
Various changes to previous QRF/singleAttack vehicle behaviour:
Attack choice system
Once a faction has positive attack resources, it will call chooseAttack to launch an attack. Target selection is handled with findAttackTargets, which weights potential attacks depending on target value and threat. Main differences:
HQ attack system
HQ attacks can now only be launched once an enemy faction has full knowledge of your HQ. Knowledge is currently added when a traitor mission is failed, or when a support is called against a target near HQ. Knowledge diminishes slowly over time as long as it hasn't reached 1. Moving HQ will reset knowledge, as long as their wasn't a previous HQ nearby recently.
The attacks themselves are still specops air, but benefit from improvements to combat behaviour. Support artillery and UAVs are also used to assist.
Aggro system changes
Aggression from kills is now inversely adjusted by balancePlayerScale. This means that aggro should work similarly for low and high player counts. High activity means high aggro, low activity means low aggro.
There is typically no longer any direct aggro from defeating supports or attacks. Destroying vehicles and killing troops is assumed to be sufficient. This should also be applied to most missions, but wasn't addressed yet to cut down on file changes. Capturing markers still increases aggro, by a flat amount rather than player scaled.
In the reb vs gov game mode, aggro now affects resource rates directly. In reb vs gov vs inv, aggro doesn't change the total resource rates but affects the quantity that enemies will spend on rebels as against the other enemy faction. Aggro also affects delay times on supports, and the chance of attacks being launched on rebels.
Remaining stuff
AI functions have been added to make enemy units terminate their current AI scripts (eg attackDrillAI) and return to base or garrison at a nearby friendly marker. These are pretty bad due to various garrison organisation and marker data problems, but they'll do for the moment.
There is now no direct use of maxUnits. The assumption is that the resource limits will manage active troop counts appropriately.
The scheduler has been tweaked to use the server when it's not heavily loaded.
timingCA calls (typically mission rewards) now just diminish enemy resource pools. Temporary.
Please specify which Issue this PR Resolves.
TODO
Please verify the following and ensure all checks are completed.
Is further testing or are further changes required?
How can the changes be tested?
TODO