fheroes2
fheroes2 copied to clipboard
Deterministic AI ?
Preliminary checks
- [X] I've checked that there aren't other open issues on the same topic.
Describe the problem requiring a solution
It seems that currently the AI is fully random Shouldn't it be the case that it's ""deterministic"" like for the battle ? At least as an option, to make debugging easier Otherwise it seems it would get difficult to reproduce previous bugs
Describe the possible solution
deterministic AI
Additional info
No response
Hi @vincent-grosbois according to #4265 there is a desire to make the game fully deterministic. I'm personally against this (I still think that random events should be really random, and poorly designed random generator in OG is not an excuse), but in general why not, if there will be the switch to turn on the "fully random" behavior.
Hi @vincent-grosbois according to #4265 there is a desire to make the game fully deterministic. I'm personally against this (I still think that random events should be really random, and poorly designed random generator in OG is not an excuse), but in general why not, if there will be the switch to turn on the "fully random" behavior.
I agree for the AI (even though that is debatable), but to the upside of this is really to simplify debugging of AI behavior
I still think that random events should be really random, and poorly designed random generator in OG is not an excuse
I'd argue that it was designed as it is not by a chance or laziness of developers but by a careful attention to details. It is a conscious choice of developers of HOMM2 to do it exactly the way it was done. If we'd try to exploit save&load technique to exploit random number generator, then we find no such a way. It is impossible, for example, to get from Daemon Cave exactly what you want by repeatedly loading some previous game state and entering the cave again and again. So it is impossible to use save&load to turn random event into a deterministic one with bonus of choosing a desired outcome. I don't know a single game entity with pseudo-random behavior which can allow exploit save&load to make it deterministic. I'd be happy, if someone points me to one, it would be an education.
How it comes this way? There are several RNG states that are saved and restored when game is saved and loaded. This cannot be explained by laziness or lack or an interest from developers of HOMM2. They were interested, they invested work to this, and they wanted to get this specific result. This particular result cannot happen by a chance, it is highly unlikely.
From the other hand, I can suggest a hypothesis, explaining what developers tried to do. The game contains a kind of randomness: there are event's outcomes that are not predictable for a player. But this randomness not a true(tm) randomness, it is a model of randomness that makes it impossible to exploit it. Every game is different due to random numbers, but each one of them is deterministic, so there are no point of rolling dice again and again by loading some previous state of game: each single time dice would roll exactly the same value.*
Moreover I'd argue that deterministic AI is a conscious choice of developers of HOMM2. It is easy to bring randomness into AI decisions, especially if it is as stupid AI as HOMM2 have. But developers didn't do it. They carefully separated AI state from the state of the world, by (I believe) giving AI its own RNG-state, separating it from RNG-state of the world. Also they made an AI to repeat itself perfectly when game saved and then loaded and played multiple times. I'd agree that it might be possible to argue that this is was because of a lack of thought, or a laziness, a time-pressure or something like. But I believe, that it is not the case. Non-deterministic AI would give an ability to use save&load to choose such an action of an AI, that I like. If AI changed its behavior when game replayed, then I could choose such a behavior I like.
[*] I should add that there are techniques allowing to exploit determinism. In the battle the sequence of morale and luck events is reproduced. Knowing this sequence player could try to plan all the battle to get maximum from these events. But developers were forced to choose: either allow player to roll dice multiple times and get (theoretically) any sequence of random events, or to allow him to know this sequence in advance. The only third alternative to this (known to me) is an "IronMan mode" which renders all actions to be irreversible, and save&load wouldn't help in this mode. And in any case we know the choice made by HOMM2 developers.
Hi, @oleg-derevenetz. Is this issue still relevant or did we close it by making deterministic AI the default in #6172 ?
according to https://github.com/ihhub/fheroes2/issues/4265 there is a desire to make the game fully deterministic.
If this issue is about the same cases as the ones referred to in that other issue, then I suppose we can close this one?
@zenseii
Is this issue still relevant or did we close it by making deterministic AI the default in https://github.com/ihhub/fheroes2/pull/6172 ?
These are different things. Deterministic battles means (among other things, like the deterministic random events in battle) deterministic AI only for battles, but not in general.