Xilmi
433c58f8b1
Workaround for previously masked issue
...
A recent fix made it so that towns that weren't supposed to be defended are now no longer defended.
This caused scouts with minimal army to also go after them in addition to the main-hero.
Problem is when two heroes go for the same town it's a massive waste of movement-points. So for the time being only main-heroes will go for faraway captures.
Better solution would be to memorize who was sent to attack what on the same turn and filter out tasks going for the same target.
2024-09-23 18:42:31 +02:00
Xilmi
d87f195bc7
Update AINodeStorage.cpp
...
Nodes along the path are now also considered for how dangerous it is.
2024-09-23 18:39:18 +02:00
Xilmi
71504a3140
Hire despite hero present
...
Only if both the garrison and the outside of a town are blocked are hires of heros being blocked.
2024-09-23 17:25:17 +02:00
Xilmi
20f7751e16
Weekend-decisions
...
When attacking non-neutral towns that are far away, the AI now considers whether their attack would arrive in the same week. If it wouldn't, it means there's a high risk that newly bought troops might flip around who is stronger. So they now refrain from sending a hero towards an enemy town that is too far away.
2024-09-23 01:25:58 +02:00
Xilmi
9ef2c6f8a0
Merge remote-tracking branch 'upstream/develop' into develop
2024-09-22 23:43:29 +02:00
Andrii Danylchenko
894c88defc
Merge pull request #4612 from vcmi/nkai-treat-pandora-as-blocker
...
NKAI: pandora as blocker object
2024-09-22 15:30:17 +03:00
Xilmi
90d72a4458
Chase & FFA-changes
...
The AI should no longer chase enemy heroes that are not reachable in the same turn, when there's other options as this behavior was quite exploitable.
The AI should now take their overall strength into account when deciding whether to attack or not.
Previously it would attack as long as their assumed army-loss was at most 25%.
Now that is 50% times the ratio of their power compared to the total power of everyone.
2024-09-22 13:06:07 +02:00
Andrii Danylchenko
ce0f51672a
NKAI: replace hardcoded pandora with more flexible solution
2024-09-20 16:05:57 +03:00
Ivan Savenko
bbeaf0ad01
NKAI: Do not visit town on recruiting hero
...
Currently this may lead to a case where player have received a query
(such as levelup query from Battle Academy in Dungeon), but still
attempts to move
2024-09-19 16:44:48 +00:00
Andrii Danylchenko
ec6c84b0e0
NKAI: pandora as blocker object
2024-09-17 15:25:13 +03:00
Xilmi
1495ec56f6
Update AINodeStorage.cpp
...
The node of a disembark-action can no longer be part of a hero-chain since sea-to-land-trade isn't possible and landing first eats up all movement-points.
2024-09-15 20:46:17 +02:00
Xilmi
c88165f900
Update PriorityEvaluator.cpp
...
Whirlpools are no longer explorePriority 1 as the AI would then try out all of it's 5 entries on both sides.
2024-09-14 13:41:14 +02:00
Xilmi
22222f0fba
Priorization-improvements
...
Manarecoveryreward now uses float instead of unsigned int in order to avoid extremely high instead of negative scores when the hero has more mana than his mana-limit for example due to mana-vortex.
Moved upgrading armies to a lower priority tier as otherwise the AI would go back to their cities all the time even though there were plenty of other things to do.
Improved exploration logic by putting different kinds of exploration to different priority-tiers.
Looking at the other side of a portal has high priority, visiting an observatory has medium priority and scouting by visiting nearby tiles has low priority.
2024-09-14 02:58:23 +02:00
Xilmi
9b9a50c0ae
Update StayAtTown.cpp
...
Showing mana-limit too for Stay At Town.
2024-09-14 02:51:33 +02:00
Xilmi
ab441d8e67
Update PriorityEvaluator.cpp
...
AI now should no longer ignore spell-scrolls and artifacts of the treasure-class.
2024-09-13 23:06:49 +02:00
Xilmi
af2df5763f
Update PriorityEvaluator.cpp
...
Only if there is a high gold-pressure a buildings' cost will deter from its score.
2024-09-12 22:53:45 +02:00
Xilmi
ab64edf7dd
Update RecruitHero.cpp
...
Remove code that, according to Ivan shouldn't do anything but cause errors.
No noticable regressing in playing-strength was observed.
2024-09-12 20:08:07 +02:00
Xilmi
5ed888b284
Update BuyArmyBehavior.cpp
...
Accomplish the same but with simpler code.
2024-09-12 20:07:22 +02:00
Xilmi
a1a03d4b74
Merge remote-tracking branch 'upstream/develop' into develop
2024-09-12 14:54:39 +02:00
Ivan Savenko
29f393e024
Removed hardcoded checks for map objects in favor of analyzing
...
rewardable object content
2024-09-12 12:11:18 +00:00
Ivan Savenko
503b87561e
Converted all h3 banks to rewardable, remove most of hardcoded checks
2024-09-12 12:11:18 +00:00
Xilmi
aefe2fda36
Update BuildingBehavior.cpp
...
No longer rush a fort in a threatened town.
2024-09-10 23:42:51 +02:00
Xilmi
065125e770
Merge remote-tracking branch 'upstream/develop' into develop
2024-09-10 14:57:27 +02:00
Xilmi
df119370c7
Exploration
...
Slightly adjust the value of exploring within the hunter-gather-prirority.
2024-09-10 00:23:17 +02:00
Xilmi
37f9f93948
Update RecruitHeroBehavior.cpp
...
Modified how to score what hero to hire to make it more likely to rehire fled heroes with high levels when the army-gain from the hero would be rather insignificant.
2024-09-09 23:38:28 +02:00
Xilmi
faa5a02659
Update RecruitHeroBehavior.cpp
...
Fix potential division by zero.
2024-09-09 23:25:09 +02:00
Xilmi
a329f607c9
Update Nullkiller.cpp
...
No more map-hack on 3rd difficulty-level. Only starting from the fourth.
2024-09-09 23:23:28 +02:00
Xilmi
f8e4aa1d25
Update Nullkiller.cpp
...
Use Enum for Gold.
2024-09-09 23:20:53 +02:00
Xilmi
e7e3f6dcbe
Update DefenceBehavior.cpp
...
Only hire heroes for defence if the enemy is already really close. (Otherwise AI hired too many heroes from defensebehavior)
2024-09-09 19:55:03 +02:00
Xilmi
8c3f6fc1e2
Update RecruitHeroBehavior.cpp
...
Fixed crash caused by mistakenly assuming that "pos" is the position of a hero on the map and not its bottom-right-corner that can be outside of the map.
2024-09-08 02:19:19 +02:00
Xilmi
0edc17b7d8
Going to town when nothing to do.
...
The StayAtTown-behavior now always creates tasks for all heroes to go and stay at a town. It will be treated differently than going to a town for mana in the sense that it is only considered at the lowest priority-tier. So it will only happen when the AI doesn't find anything else to do. It should resolve one of the two main-reasons for losing weak heros.
The hunter-gather-priority-tier now goes strictly by distance for all taks that are considered above 0 in value.
2024-09-06 22:14:59 +02:00
Xilmi
099341e143
Update Nullkiller.cpp
...
Fixed incorrect trace-message at end of turn.
2024-09-06 22:10:14 +02:00
Xilmi
06f894140c
Update BuildAnalyzer.cpp
...
Modified goldPressure-formula to no longer use completely arbitrary part of lockedresources/5000.
Lockedresources is now just divided by a factor of the free gold like everything else.
2024-09-06 21:42:15 +02:00
Xilmi
cf338e04ad
Update Nullkiller.cpp
...
AI can now also buy resources that it has income for.
2024-09-06 21:40:23 +02:00
Xilmi
35d8705fea
Update Nullkiller.cpp
...
prioOfTask-variable-usage bound to trace-level as otherwise a warning will ensue.
2024-09-06 17:20:12 +02:00
Xilmi
e43492d8b5
Update PriorityEvaluator.cpp
...
Fixed affordabilitycheck not being negated.
2024-09-06 00:12:44 +02:00
Xilmi
db2416cb6b
Update Nullkiller.cpp
...
Readded prioOfTask because it's needed in trace-messages.
2024-09-05 23:41:05 +02:00
Xilmi
5488a0a29c
Removed the "GATHER"-priorityTier
...
There was no real need for it to be a separated tier from Hunter_gather.
2024-09-05 19:35:47 +02:00
Ivan Savenko
8225eb454e
Added GameSettings to gamestate, potentially allowing to define game
...
settings per map (or in random map template)
2024-09-05 15:16:27 +00:00
Xilmi
d9fe8d7fa0
Update BuyArmyBehavior.cpp
...
Removed pointless check for hero-army being more valuable than buying army directly as it was never the case anyways.
2024-09-05 16:50:22 +02:00
Xilmi
b3115f65c5
Update BuildingBehavior.cpp
...
Use std::numeric_limits<uint8_t>::max(); instead of UINT8_MAX; and remove some leftover-trace-messages from debugging.
2024-09-05 16:45:45 +02:00
Xilmi
d5d9f3cb7d
Merge branch 'develop' of https://github.com/xilmi/vcmi into develop
2024-09-05 16:40:21 +02:00
Xilmi
dafc9cd8a8
Update PriorityEvaluator.cpp
...
Replace float-comparisons with zero by vstd::isAlmostZero
2024-09-05 16:40:06 +02:00
Xilmi
c186de2d52
Update AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp
...
Avoid checking float against an exact value.
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
2024-09-05 16:36:07 +02:00
Xilmi
23cd54c998
Preparations for merge
...
No longer using FuzzyEngine just to create a log-message. It's now only used when isUseFuzzy is set.
Also:
Removed < operator and instead use already existing "canAfford"-Method.
2024-09-05 16:22:25 +02:00
Xilmi
b32c9615ed
Update Nullkiller.cpp
...
Removed unused variable.
2024-09-05 15:59:09 +02:00
Xilmi
db16a9d234
A bit of clean-up for merge
...
Set back trace level to 0
Removed EvaluationContexts that weren't used
Encapsulated many debug-messages behinde trace-levels
2024-09-04 16:41:47 +02:00
Xilmi
d0aefdfbe6
Update RecruitHero.cpp
...
Removed a A
2024-09-03 21:17:06 +02:00
Xilmi
9361278f81
Merge remote-tracking branch 'upstream/develop' into develop
2024-09-03 21:16:01 +02:00
Xilmi
64fad53532
Revert "Merge branch 'pr/4528' into develop"
...
This reverts commit f4578c6d3a
, reversing
changes made to ac8e5b3711
.
2024-09-03 20:51:13 +02:00
Andrii Danylchenko
07ae33b8f4
BattleAI: missing lock
2024-09-03 13:02:58 +03:00
Xilmi
1176628a88
Update PriorityEvaluator.cpp
...
Workaround for weird -nan(ind) closestWayRatios.
2024-09-02 01:37:21 +02:00
Xilmi
09badeb5be
Enum for PriorityTiers
...
In order to not confuse PriorityTiers, especially after adding new ones, now using an enum to identify them.
2024-09-02 00:16:19 +02:00
Xilmi
c667ca46d1
Using correct priorityTier for Clusterization
...
Clusterizer now uses PriorityTier = 5 for evaluation, which is used to generate priority for guarded objects
2024-09-02 00:00:36 +02:00
Xilmi
64c3fbd519
Update ExecuteHeroChain.cpp
...
Now resetting the ObjectClusterizer as killing something might change the situation.
2024-09-01 23:58:47 +02:00
Xilmi
7c6f96344a
Update Nullkiller.cpp
...
Removed resetAiState from loop cause it has too many side-effects. Such as the loop going through all passes.
2024-09-01 19:33:43 +02:00
Xilmi
0e91f10bbc
Update Nullkiller.cpp
...
ResetAIState so that units realize what they can do after unlocking a cluster.
2024-09-01 17:21:53 +02:00
Xilmi
1ef5e8ab1b
Update PriorityEvaluator.cpp
...
Prevent building more buildings when we are saving for our favorite building.
2024-09-01 13:47:30 +02:00
Xilmi
751f3b0e7d
Update BuildingBehavior.cpp
...
Fixed an issue that prevented generating more building-tasks when there already were tasks.
2024-09-01 13:46:44 +02:00
Xilmi
be43c4d5f0
New hero-not acting
...
Fixed an issue that caused newly hired heroes to do nothing on the turn they were hired under certain circumstances.
2024-09-01 12:33:54 +02:00
Xilmi
0c488145b9
Update BuildAnalyzer.cpp
...
Revert unintentionally commited changes
2024-09-01 00:02:47 +02:00
Xilmi
72597b549b
hero spread
...
Prefer hiring heroes at towns that don't have heroes nearby.
2024-08-31 23:00:27 +02:00
Xilmi
f4578c6d3a
Merge branch 'pr/4528' into develop
2024-08-30 22:09:43 +02:00
Xilmi
ac8e5b3711
Update PriorityEvaluator.cpp
...
AI should score citadels and castles higher for better developed towns so that it focuses on finishing the main-town quicker as opposed to developing several smaller towns simultaneously.
2024-08-30 21:02:50 +02:00
Xilmi
56988e054a
New priority
...
1. Take / kill what is reachable in same turn
2. Defend
3. Take / kill what is further away
2024-08-30 18:05:47 +02:00
Xilmi
05d948b582
Priorities
...
Swapped priority of attacking and defending.
Troop-delivery-missions will check safety of the delivering hero.
2024-08-30 16:46:36 +02:00
MichalZ
e769e0a856
Merge branch 'vcmi:develop' into bug_fixes
2024-08-29 23:59:54 +02:00
Xilmi
dcec5637cd
Fix for defense-evaluation.
...
Defense-evaluation didn't fill armyInvolvement but it was what created the score for it. So there was only score if it also included a HeroExchange.
2024-08-29 21:01:06 +02:00
Xilmi
b8dacfc0be
Update Nullkiller.cpp
...
Fixed trade no longer working and changed log-output.
2024-08-29 20:49:01 +02:00
Xilmi
aea05b3fb8
Merge remote-tracking branch 'upstream/develop' into develop
2024-08-29 14:42:37 +02:00
MichalZr6
ca3d81f047
fix crash on heroRoles.clear()
2024-08-28 15:22:00 +02:00
Ivan Savenko
0fd9dbf240
Unified income handling, added IOwnableObject interface
2024-08-28 12:40:44 +00:00
Ivan Savenko
01396b62b7
Extracted handling of type ID's from serializer into a separate class
2024-08-26 19:48:46 +00:00
Ivan Savenko
b84af1a6de
Significantly simplify packs applying
...
Apparently our logic for packs applying with types registration is
overcomplicated and by now completely unnecessary - it became redundant
after introduction of visitor pattern.
2024-08-26 19:48:46 +00:00
Ivan Savenko
11e8b04ac5
Merge pull request #4463 from SoundSSGood/IMarket-refactoring
...
IMarket refactoring
2024-08-26 22:48:23 +03:00
Xilmi
b92862c04d
New priorities
...
Added more priority-tiers
2024-08-24 14:55:26 +02:00
Xilmi
1d494f049d
Fix closest way ratio not initialized for ExecuteHeroChain
...
Fix closest way ratio not initialized for ExecuteHeroChain
2024-08-24 14:54:00 +02:00
Xilmi
bfd6ee2b09
Merge remote-tracking branch 'upstream/develop' into develop
2024-08-24 12:25:03 +02:00
Andrii Danylchenko
01b6828df6
BattleAI: fix init env
2024-08-22 21:20:22 +03:00
Andrii Danylchenko
bc80532f29
BattleAI: improve movement towards unreachable
2024-08-21 22:18:40 +03:00
SoundSSGood
2e3e6b1553
market->getObjInstanceID()
2024-08-21 01:01:23 +03:00
SoundSSGood
58bb2b58e3
IMarket suggestions
...
Co-authored-by: Ivan Savenko <saven.ivan@gmail.com>
2024-08-20 18:49:48 +03:00
SoundSSGood
fd45b5144d
IMarket serializeable
2024-08-20 18:49:47 +03:00
Xilmi
11cec347f3
Merge remote-tracking branch 'upstream/develop' into develop
2024-08-20 16:17:29 +02:00
Xilmi
8cf99616d0
Update BuildingBehavior.cpp
...
Fixed a warning which, in this case, was actually also a logical error! :o
2024-08-19 21:21:56 +02:00
Xilmi
e86ca49c37
Update BuildingBehavior.cpp
...
Fixed warning
2024-08-19 21:15:25 +02:00
Xilmi
00e5770aa3
Update PriorityEvaluator.cpp
...
Revert change that made AI too passive.
2024-08-18 21:22:05 +02:00
Xilmi
e6d907af55
Merge remote-tracking branch 'upstream/develop' into develop
2024-08-18 09:52:59 +02:00
Xilmi
af7d5c7f7f
Update RecruitHeroBehavior.cpp
...
Don't hire a hero in a town where another hero is currently defending against a threat. This would mean one of them has to stay outside and be exposed.
2024-08-18 09:50:32 +02:00
Xilmi
bdbb9d02fc
Update DefenceBehavior.cpp
...
Fixed an issue where heroes that were leaving towns were still considered as defending the town.
2024-08-18 09:49:38 +02:00
Xilmi
65b8576687
Update BuyArmyBehavior.cpp
...
Allow building army in threatened town even when it wants to save for a building.
2024-08-18 09:49:02 +02:00
Xilmi
ea5ee039ca
Update BuildingBehavior.cpp
...
Prioritize defensive buildings in threatened towns.
2024-08-18 09:48:16 +02:00
Xilmi
284f276108
Update Nullkiller.cpp
...
Don't trade away gold when the gold-pressure is high.
2024-08-18 09:47:37 +02:00
Xilmi
3be25d9414
Update PriorityEvaluator.cpp
...
Defend towns 1 turn earlier.
2024-08-18 09:47:05 +02:00
Ivan Savenko
f0448acaa3
TBB is now a dependency of lib. Implemented multithreaded xBRZ scale
2024-08-17 15:25:26 +00:00
Xilmi
8ad6d712c0
lowered aggression
...
Being less willing to rush across half the map to attack an enemy town only to find it too well defended when arriving there.
2024-08-15 18:16:23 +02:00
Xilmi
a79f76f32b
Update Nullkiller.cpp
...
Fix issue with selling/buying the same resources back and forth. But probably leads to not using the market early on. (needs more testing)
2024-08-15 18:15:29 +02:00
Xilmi
6193e6224f
Update FuzzyHelper.cpp
...
Added Multiplicative danger-modifier to citadels and castles.
2024-08-15 18:14:48 +02:00
Xilmi
f0ca1c6112
Update BuildAnalyzer.cpp
...
Removed the restrictions of the greedy-playstyle.
Only count forts as gold-producing prerequisites when no same- or higher-level fort exists somewhere else in the empire.
2024-08-15 18:13:44 +02:00
Xilmi
b7e4219fde
More purposeful defending
...
Avoid defending towns that are out of reach for the enemy.
2024-08-14 22:53:48 +02:00