1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-23 21:29:13 +02:00

784 Commits

Author SHA1 Message Date
Ivan Savenko
1c6fbe4200 Reduce excessive NKAI logging 2025-01-12 12:21:10 +00:00
Ivan Savenko
ca21adc93f
Merge pull request #5227 from kambala-decapitator/cmake-improvements
CMake improvements
2025-01-10 15:24:44 +02:00
Ivan Savenko
ec9dbfd667 Remove excessive recomputations of tile owners 2025-01-08 20:07:42 +00:00
Ivan Savenko
82e8db3037 Do not compute threats that are too far away to be useful 2025-01-08 20:07:42 +00:00
Andrey Filipenkov
2ec518fdf0 [cmake] link NKAI to TBB 2025-01-08 15:37:17 +03:00
Ivan Savenko
9f1cd69480 Fix visualization of AI object graph 2025-01-07 14:06:09 +00:00
Ivan Savenko
3d3dd70a11 Simplify code, fix AI not building dwelling upgrades 2025-01-06 18:59:37 +00:00
Ivan Savenko
8468469976 Fixes for AI town building logic
- Fixes AI not considering non-built dwellings
- AI will now skip evaluation of towns in which construction today is no
longer possible
2025-01-06 16:20:53 +00:00
Ivan Savenko
c3952b31f1
Merge pull request #5158 from IvanSavenko/bonus_caching
[1.6.3] Bonus caching improvements
2025-01-06 14:38:34 +02:00
Ivan Savenko
f6f99d2384 Correctly initialize graph cost in turns instead of default 255 turns 2025-01-05 18:05:28 +00:00
Ivan Savenko
dea1eba20b Rework and optimize turnInfo used by pathfinder 2025-01-04 15:09:50 +00:00
Ivan Savenko
f9ce95756f Fix potentially infinite attempts to upgrade units by AI 2024-12-31 13:27:12 +00:00
MichalZr6
4e9f052e98 Fix creature upgrades in Fort and town's dwellings 2024-12-30 01:14:57 +01:00
Ivan Savenko
1caab5100a Try to reduce amount of time AI spends on pathfinding 2024-12-23 13:26:54 +00:00
Ivan Savenko
95a07ee5cb Use bonus system cache whenever possible 2024-12-21 18:47:11 +00:00
Ivan Savenko
0e1f8f99bc Reduce excessive logging 2024-12-21 14:43:08 +00:00
Ivan Savenko
ab45c58e26 Use small_vector for bonus list to reduce allocations 2024-12-21 14:43:08 +00:00
Ivan Savenko
c401eca7c4
Merge pull request #5105 from Xilmi/develop
AI is now able to deal with Coven and Factory special building-behavior's.
2024-12-21 15:57:50 +02:00
MichalZr6
f893c80192 Move UpgradeInfo class to header and source files 2024-12-19 14:13:09 +01:00
MichalZr6
af9445c16f Fixes following review 2024-12-17 22:34:06 +01:00
MichalZr6
d8d3948ac3 Fix AI to use hillFort all available upgrades. UpgradeInfo refactor. 2024-12-17 22:34:06 +01:00
Xilmi
64ad060846 Update RecruitHeroBehavior.cpp
closestThreat was supposed to be < 1, not < 0
2024-12-17 12:03:46 +01:00
Xilmi
aff73b6e65 Be less wasteful with hiring heroes
When an enemy is near our city that currently has a hero hiding in it, we don't buy a hero without army as that one would be forced to wait outside and likely be killed.
2024-12-17 12:02:58 +01:00
Xilmi
99fcf136ec Nullkiller AI is now also capable of upgrading dwellings a second time if that's possible 2024-12-16 23:45:21 +01:00
Xilmi
9012560e38 Fix for AI not recognizing 2nd T7-building of Factory as dwelling
This lead to it being built dead-last in the build-order instead of the AI trying to go for it quite early.
2024-12-16 17:19:07 +01:00
Xilmi
5ff834aac2 Remove debug-outputs
Debug-outputs removed
2024-12-13 22:13:27 +01:00
Xilmi
33f5b473b3 Defender should not run off for troop-delivery
Fixed a rare case in which a town-defender could become an indirect part of a troop-delivery-task by doing a sub-task like capturing a shipyard that takes less than 1 turn but leaves him out in the open.
2024-12-13 21:50:45 +01:00
Xilmi
79fb5faa2e Fixed a freeze
It was happening when all slots were full but no unit even needed disbanding because the unit to be bought is part of the units that are inside of the existing slots.

(This commit contains excessive debugging but I don't want to remove it just yet incase another issue pops up.)
2024-12-13 12:23:13 +01:00
Xilmi
fac18d953e Fixed and improved disband-logic
The score for buying army now scales with the cost of that army.
The cost of the units that need to be disbanded in order to hire the new units is subtracted from the army-hiring-score so the AI will prefer hiring armies where the amount of troops to disband is low or non-existent.
Fixed a bug that also disbanded troops when there still were free slots available.
2024-12-13 00:09:10 +01:00
Xilmi
2ad9038709 AI can now disband units that block slots for buying better units
When the AI cannot buy units in a city because all slots are blocked and the units in the slot are cheaper than the units it wants to buy, the AI will now get rid of the units that block that slot in order to be able to buy the better units.
2024-12-12 20:06:33 +01:00
Xilmi
6536c9a18e Satisfy SonarCube 2024-12-12 14:58:29 +01:00
Xilmi
59497db428 Fixed isEnemy becoming true for things it shouldn't
Not sure whether it actually impacts behavior but better fix it either way.
2024-12-12 13:40:50 +01:00
Xilmi
32d85ce6ff Fix for retreating-behavior generally not working
Fixed that armyInvolvement was only filled in when the action involved a target to interact with rather than just a tile.
Since armyInvolvement was used for scoring actions such as retreating towards the closest town, this caused the AI to never retreat to their towns when they were supposed to.
2024-12-12 11:07:56 +01:00
Xilmi
347efa98a0 Introduced new priority-tiers for handling attacking and gathering near enemies that are really far away
So that the AI won't become too passive on giant maps.
2024-12-11 14:47:08 +01:00
Xilmi
650db73300 Ignore all ExceuteHeroChain-tasks with 0 movement-cost
These can happen when an enemy spawns ontop of an AI-hero. If the action would win, it wouldn't be executed anyways. So now AI does the next best thing instead, which likely what it wanted to do anyways.
2024-12-11 13:05:51 +01:00
Xilmi
eab6de4686 Fixed an issue that could cause the AI to skip almost their entire turn
If the best Task is to recruit a hero this now triggers pathfinding again as the newly bought hero may impair other heroe's paths.
2024-12-10 19:21:23 +01:00
Xilmi
df069bf14f Merge remote-tracking branch 'upstream/develop' into develop 2024-12-07 13:32:19 +01:00
Ivan Savenko
8c293ce156 First attempt to make per-difficulty configurations for AI 2024-12-05 15:08:04 +00:00
Xilmi
7da5c08f74 Update ObjectClusterizer.cpp
Actually fix the warning now.
2024-12-04 15:07:13 +01:00
Xilmi
66bc6c0d52 Update ObjectClusterizer.cpp
Fixed warning that prevents compilation on GitHub.
2024-12-04 14:57:46 +01:00
Xilmi
c007bbbcd8 AI improvements
AI will no longer skip turns with heroes that are waiting for a delivery that takes more than one turn. Instead they will do something until their delivery is close enough to get it at the same turn.

Fixed an issue where a bunch of heroes all tried to do the same tasks:
Tasks that involve no fighting will now always be performed by the closest eligible hero while all other heroes look for something else to do.
2024-12-03 23:09:13 +01:00
Xilmi
34b8123fba Hero hiring adjustments
The AI is now a lot more likely to buy a hero early on when that hero's army is worth more than half the cost of the hero, regardless of other circumstances.
2024-12-02 15:11:39 +01:00
Xilmi
2df9861076 Update DefenceBehavior.cpp
Stop iterating over tasks when the curent hero has been found in one.
2024-12-01 23:05:56 +01:00
Xilmi
1d79946825 Fix for AI not defending in some cases
Instead of skipping the defense of other towns entirely when hiring a hero was considered as a way of defending, now only hiring the same hero twice will be avoided.
2024-12-01 23:00:35 +01:00
Ivan Savenko
01dd1858e4 Add option to recalculate hitmap on tile reveal 2024-12-01 21:50:28 +00:00
Ivan Savenko
d9f82c22f4 Recalculate tile owners on hitmap update 2024-12-01 21:30:44 +00:00
Ivan Savenko
7574842e93 Replace defines with constexpr 2024-11-28 15:08:15 +00:00
Ivan Savenko
40aa49acff Fix typo: Absoolute -> Absolute 2024-11-28 14:44:12 +00:00
Ivan Savenko
90536a5fbe Remove hardcoded morale chance constant 2024-11-28 12:11:32 +00:00
Ivan Savenko
be2327d000 Removed no longer used or redundant constants 2024-11-28 12:11:13 +00:00