AI - Mass raid platoon rework
- Dominant language
- Lua
- Stars
- 264
- Forks
- 260
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 21
Description
**Describe the feature**
The default AI leverages a platoon function called `GuardMarker` for mass hunting. This request is for making the platoon function a little smarter when it comes to not running directly into enemy units.
After some previous discussion with Jip we thought that being able to have the platoons behavior be slightly different depending on the AI difficulty would be beneficial.
My first thought at an approach is to have a dedicated movement function that will avoid stronger enemy unit groups and focus on attacking enemy mass points over anything.
I'll aim to keep as much of the existing logic as possible and focus on a smarter way to move to positions.
The main point of insertion will be this logic here.
```
if not usedTransports then
local pathLength = table.getn(path)
for i=1, pathLength-1 do
if bAggroMove then
self:AggressiveMoveToLocation(path[i])
else
self:MoveToLocation(path[i], false)
end
end
end
```
Rather than just queuing up the movement commands the platoon will manage itself while moving so that it can detect and avoid enemy units.
How I've previously approached this.
The platoon will start a loop after each movement command which will run on a defined timer (this could be modified depending on difficulty or a minimum set for performance requirements). If enemy units are detected within a certain radius (again difficult or performance requirements) the platoon will compare its threat to the enemy units and make a decision on if it should avoid the enemy or attack them.
There are a few ways we can do the attacking depending on the performance requirements.
There are also different methods of performing the enemy unit query. IMAP vs GetNumUnitsAroundPoint.
The other part of the logic is what the units will do once they arrive at the location.
Because this is a multipurpose function rather than purely mass raiding some logic will need to be based on platoon data properties.
**Additional context**
I've done this as an issue so that I can get feedback from others prior to setting to work on this feature. Though I'm also happy to just go for it and do the PR to see how it is received.
Contributor guide
Assessment
This issue has not been assessed yet.