1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

2119 Commits

Author SHA1 Message Date
Ivan Savenko
f858a6e04b
Merge pull request #5266 from MichalZr6/battlefield
Minor fixes to BattleHexArray. BattleHex'es as const reference where possible.
2025-01-25 17:44:14 +02:00
Ivan Savenko
df99645eca
Merge pull request #5301 from IvanSavenko/map_loading_fix
Map loading fixes
2025-01-25 17:23:54 +02:00
Ivan Savenko
5ea4014589
Merge pull request #5304 from IvanSavenko/oneway_ai
Enable one-way monoliths for AI
2025-01-25 13:42:31 +02:00
Ivan Savenko
09db3e4bef Reworked resource piles loading to fix wog maps with mithril 2025-01-25 11:40:21 +00:00
Ivan Savenko
32391dc7a9 Pathfinder cache is now stored separately per playerBlocked
- human player will now use pathfinder settings from config (as before)
- nullkiller AI will now use its own, modified settings
- added option to configure NKAI usage of monolith to config
- fixed pathfinder costs not updating on receiving levelup
2025-01-23 15:28:44 +00:00
Ivan Savenko
2ee5f2df02
Merge pull request #5295 from IvanSavenko/bugfixing
[1.6.4] Bugfixing for recently reported issues
2025-01-21 15:50:02 +02:00
MichalZr6
a1593948b7 Restore LF, use JsonKeys for logging, fix BattleHex description 2025-01-21 13:23:17 +01:00
MichalZr6
ecdd394bb1 Use BattleHex as const ref wherever possible
Minor Fixes
Drop unused function from BattleHexArray
2025-01-21 13:23:17 +01:00
MichalZr6
8f63a82d60 Minor changes with BattleHex and BattleHexArray 2025-01-21 13:23:17 +01:00
Ivan Savenko
ff2de1661a Enable one-way monoliths for AI 2025-01-20 21:34:10 +00:00
Ivan Savenko
54c86e0292
Merge pull request #5292 from IvanSavenko/nkai_artifact_score
Per-hero artifact scoring for NKAI
2025-01-20 15:47:40 +02:00
Ivan Savenko
7a0e8f95b9 Add quick workaround for NKAI not constructing resource silo 2025-01-19 19:41:38 +00:00
Ivan Savenko
2d6ae7859b Fixes BattleAI not selecting best hex when approaching nearest enemy 2025-01-19 16:38:50 +00:00
Ivan Savenko
3479ec9651 Per-hero artifact scoring for NKAI
AI now has better (but not perfect) system for scoring artifacts.

All artifacts now have their base score, based on bonuses provided by
the artifact. For composite artifacts, AI will also consider bonuses
from its components.

When exploring, AI will now weight artifacts as min(base score, price /
5), meaning even artifacts that AI can't score will still have some
priority, if only to sell them or deny them to enemy

AI will now also consider what to equip when trading with heroes or on
the end of AI pass. When considering what to equip, hero will use base
score of an artifact, adjusted by how relevant particular bonus /
artifact for a hero. Some examples:
- Morale-bonusing artifacts have their score reduced based on percentage
of undeads in the army, all the way to 0 for undead-only troops
- Artifacts that give spells (books, hat) will have score reduced based
on how many of these spells are already known by hero
- Land movement artifacts have zero score while on water and vice versa
- Necromancy artifacts will have zero score if hero does not have
necromancy
- Archery artifacts are scaled by amount of ranged troops, and only used
if hero has archery skill

AI may still equip 'bad' artifact, however this should only happen if
hero has no other artifacts to equip into said slot.

TODO's for future PR's (although not sure if / when I will work on
these):
- avoid equipping duplicates of the same artifact. Most notably with
scrolls, but may happen with other misc artifacts or rings.

- consideration for various spell-immunity neclaces

- consideration for birectional artifacts, like Shackles of War, or some
Spheres - since these artifacts need consideration on what our expected
enemy is to correctly estimate whether

- equipping artifacts based on immediate need - for example, equipping
recovery artifacts before end of day, equipping legion pieces only in
town on day 7, preparing for strong / weak enemies (or even preparing
for specific enemy in advance)

- transferring resource-generating artifacts and such to scout heroes,
allowing main hero to focus on combat

- ensure that AI can equip combined artifacts even if non-primary slots
are in use - by considering whether score of combined artifact is higher
than score of all used slots
2025-01-18 13:14:24 +00:00
Ivan Savenko
e829d723b2 Replace global bonus tree change counter with per-node counter 2025-01-12 12:23:07 +00:00
Ivan Savenko
1c6fbe4200 Reduce excessive NKAI logging 2025-01-12 12:21:10 +00:00
Ivan Savenko
3d1bf03a25 Fix potential concurrent access 2025-01-12 11:06:00 +00:00
Ivan Savenko
5cff9af236 Reduce BattleAI logging 2025-01-10 19:45:35 +00:00
Ivan Savenko
40bff74195 Use small vector for unit list 2025-01-10 18:58:46 +00:00
Ivan Savenko
797b62fd46 Try to implement lazy evaluation for reachability map 2025-01-10 17:43:45 +00:00
Ivan Savenko
2d5b5d94e7 Optimize computation of reachability map 2025-01-10 15:38:28 +00:00
Ivan Savenko
a44bbf4527
Merge pull request #5044 from MichalZr6/battle_hex_array
New container for BattleHexes. Refactors aiming for quick-battle better performance.
2025-01-10 15:32:05 +02: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
Andrey Filipenkov
db5d77362a [fuzzylite] force C++14 standard
doesn't build under C++17 due to using removed symbols
2025-01-08 15:22:21 +03:00
MichalZr6
dbe82b94f6 Changes following review:
- shared_ptr for destructibleEnemyTurns instead of raw pointer
- drop implicit int conversion for BattleHex class
  and implement toInt() instead
- implement necessary operators in BattleHex
- adjust code to work properly with JSON serializer
2025-01-08 07:24:43 +01:00
Ivan Savenko
9f1cd69480 Fix visualization of AI object graph 2025-01-07 14:06:09 +00:00
MichalZr6
dad6437661 Refactor BattleHex, remake the use of precomputed neighbouring tiles containers.
- Moved short, frequently used functions to the BattleHex header for inlining
- Made BattleHex a class with a private hex value
- Moved getClosestTile implementation back to BattleHex
- Enabled access to static precomputed data in BattleHexArray via BattleHex
(note: circular dependency prevented static precomputed containers being directly placed in BattleHex)
2025-01-06 23:28:46 +01:00
MichalZr6
ac8104d56d SonarCloud recomendations.
Code review follow-up:
- Replace std::vector with boost::small_vector
- Rename function merge to insert
2025-01-06 23:28:45 +01:00
MichalZr6
44a645b5e0 use bitset for presenceFlags and steady_clock for measurments 2025-01-06 23:28:45 +01:00
MichalZr6
fb9a3da651 Unit.cpp refactor and some other minor changes 2025-01-06 23:28:44 +01:00
MichalZr6
8c3a417527 Cleanup 2025-01-06 23:18:20 +01:00
MichalZr6
5f799d41b3 Use cached neighbouring tiles where possible 2025-01-06 23:18:19 +01:00
MichalZr6
a99274d72e BattleHexArray - new container for BattleHexes 2025-01-06 23:18:18 +01: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
78fc6d0e41 Remove unused code 2025-01-04 15:09:50 +00:00
Ivan Savenko
dea1eba20b Rework and optimize turnInfo used by pathfinder 2025-01-04 15:09:50 +00:00
Ivan Savenko
9f4e92b5f6 Fix computation of spell value when attacker can't reach enemies behind
walls in siege combat
2025-01-04 14:01:40 +00:00
Ivan Savenko
c4623aad0f Backported fix for BattleAI not casting spells that would kill entire
unit
2025-01-04 12:23:36 +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
65fc50d33b Simplified building ID logic
- Replaced overcomplicated and broken math on dwelling ID's with fixed
enum
- Fixed broken 2nd upgrades and 8th dwelling
- Removed no longer used enumeration values from building ID's
2024-12-25 19:16:21 +00: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