Commit Graph

79 Commits

Author SHA1 Message Date
Oliver Brakmann
3e9bf7aa4d Turn Actor.GetCurrentActivity into a property 2016-10-31 18:46:27 +01:00
RoosterDragon
eb3f8c945c Make sure AI can deploy an MCV when it lacks a base. 2016-10-11 20:42:15 +01:00
Taryn Hill
852f0f790f Fix CanBeViewedByPlayer query in
HackyAI.GetVisibleActorsBelongingToPlayer
2016-08-13 07:42:15 -05:00
RoosterDragon
cc4ef736b0 Ensure HackyAI tries to attack and capture as frequently as it should.
Returning early in AssignRolesToIdleUnits would skip ticking down the counters that trigger new attack and capture attempts. This means they would be attempted far less often than intended.
2016-08-12 18:08:58 +01:00
Taryn Hill
c5e76a67dd HackyAI: Add basic capturing 2016-08-10 19:06:24 -05:00
reaperrr
abaa0f4da5 Allow to customize which terrain types are considered water by HackyAI
For naval structure placement.
2016-07-30 13:19:32 +02:00
reaperrr
8493b1deda Merge pull request #11512 from Nelax/ai-squadexclude
Added Squad Exclusion to HackyAI
2016-06-30 15:21:22 +02:00
reaperrr
e647af3dd1 Allow modders to choose AI MCV deployment base restriction
For some mods, a random map location might be a better choice for the AI than deploying the MCV inside the base, so we allow modders to customize it.
2016-06-27 18:17:51 +02:00
Bynnar18
dace814829 Added ExcludeFromSquads to HackyAI 2016-06-24 09:18:43 -05:00
reaperrr
8ba833777c Make AI deploy MCVs in the vincinity of existing construction yards
While the general idea of AIs building distant secondary bases might be tempting, in reality the AI would way too often send the MCV close to some enemy base, wasting the cash and potentially increased build speed/additional build queue.

Deploying MCVs close to the existing base ensures that the AI will actually have some benefit from building an MCV.
2016-06-20 20:52:04 +02:00
reaperrr
5992530655 Fix AI giving orders to MCVs that already have orders
Checking for IsMoving is a flawed approach no matter how you look at it. The MCV might just have temporarily stopped due to an obstacle, or about to be deployed.

Checking for IsIdle instead ensures that the MCV really isn't already in the process of doing something.
2016-06-20 20:52:04 +02:00
reaperrr
099c44f6f9 Remove ActorExtensionsForMove
And use IMove.IsMoving instead.
2016-06-04 16:34:47 +02:00
reaperrr
adc6095f9c Remove the rest of the unused AI Aggro left-overs 2016-06-01 22:48:50 +02:00
reaperrr
f1b8cf117a Remove dead code from HackyAI
Has been unused for three years...
2016-06-01 22:48:50 +02:00
Matthias Mailänder
15c2df2c69 Merge pull request #10943 from pchote/map-grid-tile-range
Move Map.TilesByDistance to MapGrid and un-static it.
2016-03-21 20:05:08 +01:00
Paul Chote
4052da3ea6 Move Map.TilesByDistance to MapGrid and make non-static. 2016-03-20 21:41:04 +00:00
Paul Chote
5741e53fe2 Fix AI stalling after losing its conyard and ref. 2016-03-18 18:16:24 +00:00
Paul Chote
602acabe47 Remove World.TileSet. 2016-03-12 19:47:07 +00:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
Oliver Brakmann
426bf0d975 Merge pull request #10731 from RoosterDragon/fuzzy-singletons
Create singletons for AttackOrFleeFuzzy rulesets
2016-02-17 21:25:03 +01:00
RoosterDragon
3b480ea4bb Create singletons for AttackOrFleeFuzzy rulesets.
This avoids the cost of recreating the engines and rules for every AI and AI squad.
2016-02-10 20:17:27 +00:00
reaperrr
ed3c0799d3 Do not consider waiting harvesters to be idle 2016-01-29 16:08:29 +01:00
Matthias Mailänder
922217271c don't actively attack nor defend with armed harvesters 2016-01-24 14:05:00 +01:00
Matthias Mailänder
03590b13cc check the cheap bool before expensive trait lookups 2016-01-24 13:52:44 +01:00
RoosterDragon
8e89a6a696 Simplify names, remove unused usings, remove redundant casts. 2016-01-17 21:35:36 +00:00
Paul Chote
bee77db1e3 Rename variables for clarity. 2016-01-17 00:02:49 +00:00
Paul Chote
bec059a3c7 Remove unnecessary assumption about non-mobile. 2016-01-17 00:02:49 +00:00
Paul Chote
d4815407f2 Remove hardcoded trait assumptions from MCV and ConYards. 2016-01-17 00:02:49 +00:00
Paul Chote
e026a0f00f Create proper data structures for hardcoded AI classes. 2016-01-17 00:02:49 +00:00
Pavel Penev
c51bad6050 Expose HackyAI's Squads and IsEnabled fields 2015-12-07 01:41:16 +02:00
atlimit8
b6f17df260 Add ActorsHavingTrait<TTrait>([Func<TTrait, bool]) 2015-10-28 16:36:45 -05:00
atlimit8
7de98ad6d8 Merge pull request #9635 from RoosterDragon/occupy-space-perf
Speed up checks for IOccupySpace trait
2015-10-22 18:28:57 -05:00
RoosterDragon
a4338d9350 Remove a redundant check in FindAndDeployBackupMcv.
This avoids enumerating the mcvs twice.
2015-10-14 21:06:37 +01:00
RoosterDragon
262ab408b5 Speed up checks for IOccupySpace trait.
Eagerly load the trait (if it exists) in Actor, and use this reference to avoid having to perform self.Info.HasTraitInfo<IOccupySpaceInfo>() checks.
2015-10-14 20:46:15 +01:00
abcdefg30
b0c1f95ef2 Merge pull request #9486 from reaperrr/fix-9403
Fix AI queueing structure build orders twice at higher game speeds due to lag
2015-10-11 13:51:02 +02:00
reaperrr
3711ef8eb5 Fix AI queueing build orders twice at higher game speeds due to lag
Fixes #9403.
2015-10-11 01:53:25 +02:00
Paul Chote
8954ac585c Merge pull request #9442 from Mailaender/ai-world-check
Fixed AI bots trying to assign orders to units not in the world
2015-10-10 20:21:10 +01:00
Matthias Mailänder
4579e8af06 don't let the AI assign orders to units not in the world 2015-10-10 19:06:20 +02:00
atlimit8
a000bf7805 Merge pull request #9400 from reaperrr/fix-airefplaceperf
Fixed massive AI base builder performance issue
2015-10-02 23:18:10 -05:00
reaperrr
74308c245c Add AI MinBaseRadius to give more control over and slightly increase performance of AI building placement checks 2015-09-29 22:19:21 +02:00
reaperrr
2b0920398f Add AI MaxResourceCellsToCheck for refinery placement decision 2015-09-29 22:19:20 +02:00
Taryn Hill
3d7e49655d Fix NullReferenceException in HackyAI.BuildUnit
HackyAIInfo grew a UnitLimits Dictionary that was not null-checked.
Also null-check UnitsToBuild.
2015-09-28 13:17:19 -05:00
RoosterDragon
108f2e9b6e Tweak some AI methods to avoid allocations. 2015-09-26 21:12:07 +01:00
reaperrr
5ad9eb852c Fix massive AI base builder performance issue
Previously, the Refinery placement check would first collect all cells
with resources inside the MaxBaseRadius, then perform a full findPos check
for each cell until one of them would not return null. The problem was
that if all of the cells returned null (for example if there wasn't enough
space between base center and resource, or if all suitable space was
otherwise occupied), it would basically check all tiles with resources
only to fail finding a suitable position and fall back to the normal
findPos check.

Since nearbyResources already performs a shuffle, I simply made the check
use the first cell from the list and use the basic findPos fallback if
that cell is null.

Closes #4717.
2015-09-26 16:48:03 +02:00
atlimit8
9acf121eb1 Replace ActorInfo.Traits.WithInterface with ActorInfo.TraitInfos<T>() 2015-09-21 15:50:57 -05:00
atlimit8
09984683a7 Add ActorInfo.TraitInfo[OrDefault]<T>() requiring ITraitIfo types 2015-09-19 09:56:14 -05:00
atlimit8
8162fa27ab Add ActorInfo.HasTraitInfo<T>() requiring ITraitInfo types 2015-09-19 09:49:24 -05:00
atlimit8
85fab45451 Remove Actor.HasTrait<T>() 2015-09-19 09:49:23 -05:00
reaperrr
a580e6846e Merge pull request #9328 from Mailaender/ai-common-names
Fixed BuildingCommonNames magic
2015-09-13 18:53:37 +02:00