1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00
Commit Graph

216 Commits

Author SHA1 Message Date
a061ed04de Remove usage of ConstTransitivePtr from CTown 2025-03-08 14:04:51 +00:00
4a6a8f9496 Merge pull request #5496 from IvanSavenko/std_thread
Replace boost::thread with std::thread
2025-03-08 16:03:55 +02:00
9f713a0914 Rename int3::valid to isValid for consistency 2025-03-03 10:46:00 +00:00
948abfb04c AI now uses std::thread, added custom thread interruption logic 2025-03-02 14:33:11 +00:00
844dfb1604 Removed usage of boost::thread from vcmi, except for AI 2025-03-02 14:33:11 +00:00
645b95ba02 Renamed LibClasses * VLC to GameLibrary * LIBRARY 2025-02-21 16:54:56 +00:00
2362c6da21 Fixes for multiple new issues from Sonar 2025-02-21 15:57:39 +00:00
0548f325e4 Merge branch 'master' into 'develop' 2025-02-21 13:59:34 +00:00
f238d89601 NKAI - Prefer giving fast units to scouts
Nullkiller AI will now prefer giving its scout heroes faster units to
optimize their movement points on next turns.

Unit selection logic:
- AI prefers to give 'weak' units that won't affect army strength of main
hero. Unit is considered 'weak' if its level below 4 or if its AI value
is below 1% of total army strength. So AI can give high-tier unit to
scout, but only if main hero already has massive army.

- Within weak units, if hero is moving on terrain with penalty, AI will
always prefer units that are native to this terrain. So on snow AI will
always prefer unit from Tower even if its speed is lower than unit from
another faction.

- Within remaining candidates, AI will prefer unit that will give higher
movement points limit. This also means that in case of H3 rules, all
units with 11+ speed will be viewed as equally good

- If there are multiple units with same speed, AI will prefer unit with
lowest AI value
2025-02-11 16:37:54 +00:00
82ab49495e Fixed an issue that prevented AI from building stables
Prerequisites of dwellings now also inherit the armyStrength of their respective dwelling for the purpose of their evaluation.
2025-02-09 17:33:39 +00:00
6b55401fde Swapped order of Defend and Far-Hunter-Gather 2025-02-09 17:33:39 +00:00
b0e87f01ed Fix cluster prio
Clusters are now checked against all priority-tiers instead of just hunter-gather.
2025-02-09 17:33:39 +00:00
1c6fbe4200 Reduce excessive NKAI logging 2025-01-12 12:21:10 +00:00
ec9dbfd667 Remove excessive recomputations of tile owners 2025-01-08 20:07:42 +00:00
82e8db3037 Do not compute threats that are too far away to be useful 2025-01-08 20:07:42 +00:00
3d3dd70a11 Simplify code, fix AI not building dwelling upgrades 2025-01-06 18:59:37 +00:00
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
4e9f052e98 Fix creature upgrades in Fort and town's dwellings 2024-12-30 01:14:57 +01:00
95a07ee5cb Use bonus system cache whenever possible 2024-12-21 18:47:11 +00:00
0e1f8f99bc Reduce excessive logging 2024-12-21 14:43:08 +00:00
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
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
5ff834aac2 Remove debug-outputs
Debug-outputs removed
2024-12-13 22:13:27 +01:00
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
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
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
df069bf14f Merge remote-tracking branch 'upstream/develop' into develop 2024-12-07 13:32:19 +01:00
7da5c08f74 Update ObjectClusterizer.cpp
Actually fix the warning now.
2024-12-04 15:07:13 +01:00
66bc6c0d52 Update ObjectClusterizer.cpp
Fixed warning that prevents compilation on GitHub.
2024-12-04 14:57:46 +01:00
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
d9f82c22f4 Recalculate tile owners on hitmap update 2024-12-01 21:30:44 +00:00
90536a5fbe Remove hardcoded morale chance constant 2024-11-28 12:11:32 +00:00
be2327d000 Removed no longer used or redundant constants 2024-11-28 12:11:13 +00:00
b25702f15e expose safeAttackRatio to AI config 2024-11-28 11:53:51 +00:00
a70f5de8c6 Merge remote-tracking branch 'upstream/develop' into develop 2024-11-07 14:35:13 +01:00
d3af9f1c67 Removed pointer to VLC entity from CStackBasicDescriptor 2024-10-30 16:47:02 +00:00
2b99414793 Using hero's stats instead of level to determine their role.
Since there are custom maps/campaigns in which heroes have pretty high base-stats even at level 1.
2024-10-21 09:37:44 +02:00
5d6877e06d Merge remote-tracking branch 'upstream/develop' into develop 2024-10-20 00:49:17 +02:00
10ad0fc760 Split CHeroHandler.cpp/.h into 1 file per class
All parts of CHeroHandler.cpp are now in lib/entities/hero
Adjusted includes to use new paths
No functionality changes
2024-10-13 14:01:09 +00:00
61fba1fedd Merge remote-tracking branch 'upstream/develop' into develop 2024-10-10 17:23:39 +02:00
3dd4fa2528 Reduce usage of pointers to VLC entities
Final goal (of multiple PR's) is to remove all remaining pointers from
serializeable game state, and replace them with either identifiers or
with shared/unique pointers.

CGTownInstance::town and CGHeroInstance::type members have been removed.
Now this data is computed dynamically using subID member.

VLC entity of a town can now be accessed via following methods:
- getFactionID() returns ID of a faction
- getFaction() returns pointer to a faction
- getTown() returns pointer to a town

VLC entity of a hero can now be accessed via following methods:
- getHeroTypeID() returns ID of a hero
- getHeroClassID() returns ID of a hero class
- getHeroType() returns pointer to a hero
- getHeroClass() returns pointer to a hero class
2024-10-10 12:28:08 +00:00
f2b8b40925 Being less dismissive
Reduced the amount of circumstances under which the AI dismisses heroes. Among others to prevent a loop through all passes where it repeatedly hires and dismisses heroes.
2024-10-01 17:20:54 +02:00
2d783211ce Fixed a crash
Fixed a crash from trying to access nonexisting map-element.
2024-10-01 01:11:17 +02:00
9c52e3a0b2 Fix for inconsistency in planned and performed army-merge.
Removed the usage of BonusModifiers because depending on the case the function was sometimes called with and sometimes without an actual hero as first parameter.
This lead to inconsistencies between planned and performed army-merge and got the AI stuck in a loop where it ordered an army-merge over and over that then would not conclude.
The inclusion of bonuses of the hero for determining which army is better on them is unnecessarily convoluted and just causes issues. It took me like 4 hours to figure out why the AI didn't act.
2024-10-01 00:42:01 +02:00
a01e84214f Fixed errors
AI no longer tries to access tiles it cannot see while clusterizing objects.
2024-09-30 21:00:50 +02:00
769268cfe3 Eternal Garrison
Fixed an issue that caused heroes to stay garrisoned for ever when hero-cap was reached.
2024-09-29 01:15:09 +02:00
9ef2c6f8a0 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-22 23:43:29 +02:00
ce0f51672a NKAI: replace hardcoded pandora with more flexible solution 2024-09-20 16:05:57 +03:00
ec6c84b0e0 NKAI: pandora as blocker object 2024-09-17 15:25:13 +03:00
065125e770 Merge remote-tracking branch 'upstream/develop' into develop 2024-09-10 14:57:27 +02:00