Giter Club home page Giter Club logo

Comments (8)

oleg-derevenetz avatar oleg-derevenetz commented on June 12, 2024

green hero Atlas leaves the castle and goes back

Atlas attacks Vampires for experience. There is nothing strange in this behavior.

Please note also strange behaviour of red hero Kilburn - his fog also should be discovered at that point.

But it's not (at least, not enough). He goes to take the ore mine near the Hillstone, but then he sees the Dawn with decent army and decides that his castle is in danger.

Atlas leaves its castle to visit Demon cave that is long time empty and I bet he should know it.

That's not really the case. Atlas leaves his castle to try to capture Blackburn, and his path is just paved through the empty Demon Cave. But visiting this object (in fact, any object) forces him to stop and re-assess his targets, and he decides to go back to his castle.

from fheroes2.

kitovyj avatar kitovyj commented on June 12, 2024

green hero Atlas leaves the castle and goes back

Atlas attacks Vampires for experience. There is nothing strange in this behavior.

I see! Somehow I missed that there is Vampires stack there.

Please note also strange behaviour of red hero Kilburn - his fog also should be discovered at that point.

But it's not (at least, not enough). He goes to take the ore mine near the Hillstone, but then he sees the Dawn with decent army and decides that his castle is in danger.

Got it!

Atlas leaves its castle to visit Demon cave that is long time empty and I bet he should know it.

That's not really the case. Atlas leaves his castle to try to capture Blackburn, and his path is just paved through the empty Demon Cave. But visiting this object (in fact, any object) forces him to stop and re-assess his targets, and he decides to go back to his castle.

Thank you for the clarifications. In general, maybe it's possible to make AI not recalculate priorities if the game state remains unchanged after the event: declined demon cave used just for a passage, text message event, event deducing resources when there is nothing to deduce, passing through a well having already maximum spell points, passing through the observartion tower visited before etc. Otherwise it creates an impression that AI visits the same object multiple times, going to it and then returning back to defend the castle. Also it would save some processor time.

from fheroes2.

oleg-derevenetz avatar oleg-derevenetz commented on June 12, 2024

if the game state remains unchanged

In fact, the state of the game does not remain unchanged - hero is in a different place now, so the distances between him and other objects on the map have changed, and the evaluation of objects is always scaled depending on the distance from the hero to these objects, for some objects their value decreases slower with the distance to them, and for some objects their value decreases faster. Evaluating an object is a bit complicated.

from fheroes2.

kitovyj avatar kitovyj commented on June 12, 2024

if the game state remains unchanged

In fact, the state of the game does not remain unchanged - hero is in a different place now, so the distances between him and other objects on the map have changed, and the evaluation of objects is always scaled depending on the distance from the hero to these objects, for some objects their value decreases slower with the distance to them, and for some objects their value decreases faster. Evaluating an object is a bit complicated.

Yes, I saw that non-linear distance penalty. In principle, we can imagine a situation when a hero made just one step outside a castle returns back if we force recalculation for some reason. But the "ideal" target choosing algorithm should be invariant to the hero position until the hero still on the originally selected path to the target. I think the omission of the unnecessary prority recalculation can at least improve the current "non-ideal" solver.

from fheroes2.

kitovyj avatar kitovyj commented on June 12, 2024

if the game state remains unchanged

In fact, the state of the game does not remain unchanged - hero is in a different place now, so the distances between him and other objects on the map have changed, and the evaluation of objects is always scaled depending on the distance from the hero to these objects, for some objects their value decreases slower with the distance to them, and for some objects their value decreases faster. Evaluating an object is a bit complicated.

What if we interpret distance as "pathLength - heroMovePointsRemaining". Then that factor becomes invariant till the hero is on the path during the same turn. Recalculation then should not change the target (at least due to distance change, the castle defense factor of course would still play a role...).

from fheroes2.

oleg-derevenetz avatar oleg-derevenetz commented on June 12, 2024

What if we interpret distance as "pathLength - heroMovePointsRemaining". Then that factor becomes invariant till the hero is on the path during the same turn. Recalculation then should not change the target.

There is no recalculation while the hero moves. But when he interacts with an "action object", he automatically stops and then recalculates his targets, because during such an interaction his army can decrease (due to a battle) or increase (due to hiring new creatures), he can get additional stats, additional mana, and so on. The path he takes can pass right through objects (it doesn't matter if they are empty or not), through wandering monsters or even enemy heroes - as long as the AI pathfinder believes that this hero is strong enough for this. There are many different parameters besides distance alone. If the hero went to a guarded enemy castle through an object/monsters/hero that he should go through with a fight (and win according to the pathfinder estimation), but if the fight was in fact not so successful, and the hero lost too much army, then there may not be any point in going to this castle at all, but maybe there is some another castle (a little less developed and a little further away but worse guarded), then the target can be changed to that castle. Here we can either come up with some other evaluation method or make sure that the hero does not stop at empty objects, which looks more like a temporary patch, rather than a normal solution.

from fheroes2.

drevoborod avatar drevoborod commented on June 12, 2024

Seems like the hero returned to the castle from daemon's cave because AI "thinks" that there is some threat close enough to the caslte, right? And if the hero would continue moving, he would be too far to protect it? The question is: why the AI couldn't predict it before he sent the hero outside of the castle? I mean that if there was no Daemon cave which forced the AI to recalculate threats, he could make wrong decision by sending hero somewhere when he was needed to protect the castle. So seems like it could be better if AI could predict changing of situation for every position of planned hero's move (during one turn, of course, when no external curcumstances were changed). Of course, it should be more resource-consuming, but who cares? :) At the time AI "thinking" is extremely fast even on my ancient low-end tablet, so we have some power reserve.

from fheroes2.

oleg-derevenetz avatar oleg-derevenetz commented on June 12, 2024

In fact, this issue does not contain any bugs, but boils down to a vague wish for more efficient AI functioning without any specific technical proposals. It is difficult to regard this even as a request for improvement, but for now let's reclassify it this way.

from fheroes2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.