1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
Commit Graph

552 Commits

Author SHA1 Message Date
Xilmi
909c308614 Update Nullkiller.cpp
Removed unused variable.
2024-07-24 21:46:18 +02:00
Xilmi
1e2021fb6d Update RecruitHero.h
Fix warning.
2024-07-24 21:41:49 +02:00
Xilmi
8152b003fe Update Nullkiller.cpp
Fixed a bug that caused tasks that are generated with an initial priority not being executed.
Fixed an error-message wrongfully claiming a hero was locked by STARTUP, when infact the hero was locked by something else (usually a hero-chain).
Recruiting-heros is now handled alongside buying army and buildings.
2024-07-24 21:26:53 +02:00
Xilmi
e2e3cd281c Update RecruitHero.h
Multiple orders for the same hero by different towns are now handled properly instead of trying to buy the same hero several times.
2024-07-24 21:23:20 +02:00
Xilmi
19b969406c Update PriorityEvaluator.cpp
Delivering troops to mains is now considered a priority 0 task that should immediately be fulfilled.
Defending nearby towns against nearby enemies is now also considered a priority 0 task.
Priority 0 tasks are now exclusively scored by distance and armyloss has only a cut-off-point instead of lowering the score.

Building-cost now has more impact on their score.
2024-07-24 21:22:14 +02:00
Xilmi
bbb5157f74 Update RecruitHeroBehavior.cpp
Reworked recruit-behavior to be a bit more conservative and avoid recruiting-sprees. Stuff like buying several heros in a row because the next one is always slightly better than the last but using up the whole starting-bank for that.
2024-07-24 21:17:04 +02:00
Xilmi
aade79720f Update BuildAnalyzer.cpp
Allow queuing citadels and castles on other days than satur- and sunday.
2024-07-24 21:14:27 +02:00
Xilmi
69b64a3241 Update ExplorationBehavior.cpp
Added missing bracked and changed indenting to make it less confusing.
2024-07-24 15:40:20 +02:00
Xilmi
34e4ab45ee Fixed what merge-conflict-handling had broken.
Restored exploration-without relying on memory but with included whirlpool
2024-07-24 15:21:17 +02:00
Xilmi
b83a214763 Merge remote-tracking branch 'upstream/develop' into develop 2024-07-24 14:59:24 +02:00
Andrii Danylchenko
dbcd7677ac
Merge pull request #4313 from vcmi/nkai-whirlpool
NKAI: whirlpool
2024-07-24 00:03:11 +03:00
Xilmi
69efe9cfda Merge remote-tracking branch 'upstream/develop' into develop 2024-07-22 20:15:40 +02:00
Ivan Savenko
4aa73b40c9 Split CTownHandler into smaller chunks 2024-07-21 18:21:48 +00:00
Xilmi
6f9309696d Merge remote-tracking branch 'upstream/develop' into develop 2024-07-21 19:06:14 +02:00
Andrii Danylchenko
683c363946 NKAI: whirlpool 2024-07-21 17:20:54 +03:00
Xilmi
945de7c369 More warnings
Removed unused code
2024-07-20 21:12:43 +02:00
Xilmi
ed82e2bf4a Warnings
Removed unused variable.
2024-07-20 21:02:39 +02:00
Ivan Savenko
1aa391fdf8 Split CGeneralTextHandler file into 1 file per class form
All text processing code is now located in lib/texts.
No changes other than code being moved around and adjustment of includes

Moved without changes:
Languages.h           -> texts/Languages.h
MetaString.*          -> texts/MetaString.*
TextOperations.*      -> texts/TextOperations.*

Split into parts:
CGeneralTextHandler.* -> texts/CGeneralTextHandler.*
                      -> texts/CLegacyConfigParser.*
                      -> texts/TextLocalizationContainer.*
                      -> texts/TextIdentifier.h
2024-07-20 12:55:17 +00:00
Xilmi
2bf7b3200b Merge remote-tracking branch 'upstream/develop' into develop 2024-07-19 22:05:58 +02:00
Xilmi
f0f40660c4 reverse getTotalArmyLoss()-change
Due to a recent fix in army-loss calculations this method should now work correctly the way it was.
2024-07-19 15:59:57 +02:00
Xilmi
fa2f883361 Merge remote-tracking branch 'upstream/develop' into develop 2024-07-19 15:26:31 +02:00
Xilmi
eb26b16823 Trace level
Increased AI-trace-level because I need it for debugging.
2024-07-19 15:26:14 +02:00
Xilmi
e374f24016 complete Building-costs as evaluation-context
Added building-cost including all resoruces as evaluation-context for more sophisticated building-selection and also as a countermeasure to softlocking a build-order by having no ways to obtain certain resources.
For example, if the AI would drop below 5 wood, while having no market-place and no wood-income it will avoid building any buildings that neither allow trading nor produce wood.
2024-07-19 15:25:24 +02:00
Xilmi
2d715f4d7e Trading logic
Added trading-logic to Nullkiller-AI.
The AI can now identify which resources it is lacking the most and buy them to fix softlocks in their build-order. It can also sell excess resources that it doesn't have a need for.
2024-07-19 15:21:56 +02:00
Xilmi
f094bf9602 Added marketplace to buildable buildings
Before marketplaces could only be built as part of a requirement for other buildings but not on their own when that other building already existed like it is the case in certain campaign-missions.
2024-07-19 15:19:27 +02:00
Xilmi
9c6d8762c5 Lowered restrictions from hero-hiring.
Removed two restrictions from hero-hiring, that prevented AI from hiring heros in certain scenarios.
2024-07-19 15:18:02 +02:00
Andrii Danylchenko
e9e5948d61 NKAI: take into account 7lvl creature cost when we consider what resources we need 2024-07-18 20:24:24 +03:00
Andrii Danylchenko
37dc2a38e8 NKAI: reduce double army loss cases 2024-07-18 13:38:25 +03:00
Andrii Danylchenko
7571fb7046 NKAI: fix gosolo when human is lead by gosolo AI + multiplayer 2024-07-17 17:09:04 +03:00
Ivan Savenko
1072356002
Merge pull request #4268 from IvanSavenko/pathnode_reduce
Reduce size of CGPathNode and AIPathNode
2024-07-17 13:08:05 +03:00
Xilmi
455ad648ae More warning fixes
heroRole is no longer needed here.
2024-07-15 20:09:11 +02:00
Xilmi
d4b4a6c4db Warnings
Commented out relics from debugging that were causing warnings for unused variables.
2024-07-15 19:57:33 +02:00
Xilmi
fbe1e171fe Merge remote-tracking branch 'upstream/develop' into develop 2024-07-15 18:36:19 +02:00
Xilmi
4a552d411c Decisionmaking-changes
There's 3 new evaluation-contexts that are now taken into account:
Whether an action is building, whether an action involves sailing and the newly introduced threat.

The value-evaluation of creatures now also takes special resources into account.

No longer treating other AIs differently than players when it comes to how afraid we shall be of them.

The cost of buildings for decision-making now determines missing resources. Available resources are ignored when it comes to how they impact the cost. But missing-resources will heftily impact the assumed price by calculating their market-value. This shall encourage the AI to rather build what it currently can build instead of saving up for something that it lacking the special resources for.

AI is no longer willing to sacrifice more than 25% of their army for any attack except when it has no towns left.

Revamped the priority-tiers of AI decision-making.

Higest priority is conquering enemy towns and killing enemy heroes. However, the AI will no longer try to do so when the target is more than one turn away and protected by a nearby enemy-hero that could kill the one tasked with dealing with the target. Except when they have no towns left. Then they get desperate and try everything.

As a general rule of thumb one could say the AI will prioritize conquest over collecting freebies over investing army to get something that isn't a city. It's a bit more complex than that but this is roughly what can be expected. It will also highly value their own heroes safety during all this.
2024-07-15 18:12:52 +02:00
Xilmi
95ba57dfe2 No more Startup-behavior
Startup-behavior was messing with my intended logic. Mostly by getting excess heroes for no real purpose other than that it could.
This wasted a lot of money that could be better invested on subsequent turns.
I removed it and playing-strength actually went up.
2024-07-15 17:50:30 +02:00
Xilmi
f8f10adb2e Take magic-capability into account for overall strength-estimation of hero-lead-armies
The magic-strength of a hero now checks if the hero has a spellbook and at least one combat-spell.
The impact of knowledge and spellpower to the hero's magic-strength is now also depending on it's current and max mana-pool-size as an empty mana-pool does not exactly contribute well to fights.

Replaced every call of getFightingStrength() with getHeroStrength() which uses both the fightingStrength and the (reworked) magicStrength to guess how much stronger a hero-lead army is.
2024-07-15 17:42:02 +02:00
Xilmi
83ffbdff2b Fix for double army-loss
Fixed that army loss was taken into account both for the path and the target-object. In certain cases, like a hero defending a town, this could lead to armyloss being twice as high as it should be.
2024-07-15 17:35:54 +02:00
Xilmi
e2e3f9e638 Take hero-stats into account for attacking hero-defended entities
Instead of using just the strength of the raw army, the hero-stats are now taking into account for the generation of the danger-map.
2024-07-15 17:30:42 +02:00
Xilmi
48ecbd4cbf Threat in DangerHitMap
Added new value threat to DangerHitMapAnalayzer. The purpose is to allow decisions to be less binary around enemy heros.
2024-07-15 17:28:10 +02:00
Xilmi
53c51b4278 Allow all buildings
Added resource-silo and special buildings to things that AI can theoretically build.
2024-07-15 17:26:06 +02:00
Ivan Savenko
04a81fee87 Reduce size of CGPathNode and AIPathNode 2024-07-15 07:49:04 +00:00
Andrii Danylchenko
6f5710e809
Merge pull request #4110 from vcmi/rewardables
NKAI: rewardables
2024-07-14 09:02:37 +03:00
Xilmi
d878d0ce18 Avoid being killed
Heroes with conquest-tasks will only endanger themselves to be killed when they can execute a conquest in the same turn.

Heroes with other tasks will dismiss any tasks except of defending when they'd be within one turn of an enemy hero that could kill them.
2024-07-12 23:36:41 +02:00
Xilmi
102b537353 Recruit-behavior
Moved recruit-behavior back to tasks that plans get made for since otherwise it can mess up plans by blocking town-exits.
2024-07-12 23:33:58 +02:00
Xilmi
a821978d4e Merge remote-tracking branch 'upstream/develop' into develop 2024-07-12 17:43:04 +02:00
Xilmi
92bed2305e priority-tiers
Tasks are now in different priority-tiers. For now there's 2 tiers. One for regular tasks and one for tasks of the new "conquest"-type. Regular tasks will only be considered when no possible conquest-type tasks were found.

Slightly reworked scoring heuristics.
2024-07-12 17:41:46 +02:00
Xilmi
9456ab41da Priority-tier
Openmap is no longer tied to difficulty-level due to being configurable anyways.

Tasks are now in different priority-tiers. For now there's 2 tiers. One for regular tasks and one for tasks of the new "conquest"-type. Regular tasks will only be considered when no possible conquest-type tasks were found.

Recruit-hero-behavior is now evaluated before movement to make it more likely a new hero can exchange their stuff with others.
2024-07-12 17:39:52 +02:00
Xilmi
638c1350b8 Path-safety
No longer excluding paths for exposing a hero to an enemy in the behaviors. There definitely are reasons for doing something anyways, even if threatened. The logic for that should be done in the PriorityEvaluator.
2024-07-12 15:43:40 +02:00
Xilmi
663ca23f6f Army-hiring
Supressing hiring army on turn one seems just bad. Starting the main-hero as strong as possible seems like a good idea to me and hiring the available troops outright will help achieve that goal.

However, if there's a hero for hire, who has army with him that is a better deal, we hire that one first.
2024-07-12 15:41:55 +02:00
Xilmi
fdaac9d3c3 Hero-hiring
When we have no hero, we will definitely want to hire one.
We will also want to hire heroes who already pay for more than themselves by coming with an army that has more value than the hero costs.
2024-07-12 15:39:50 +02:00