Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luck/Morale effects happen randomly in battle on each re-load. #3996

Closed
2 tasks done
ivanychag opened this issue Aug 9, 2021 · 40 comments · Fixed by #4072
Closed
2 tasks done

Luck/Morale effects happen randomly in battle on each re-load. #3996

ivanychag opened this issue Aug 9, 2021 · 40 comments · Fixed by #4072
Assignees
Labels
improvement New feature, request or improvement logic Things related to game logic
Milestone

Comments

@ivanychag
Copy link

ivanychag commented Aug 9, 2021

Preliminary checks

Platform

Windows

Describe the bug

Steps:

  1. Start a battle by hero with some luck/morale bonus (save the game before battle).
  2. Make some moves to make luck/morale effect happened.
    For example, hero's gargoyles received additional move cause of morale bonus.
    Then, next hero's unit - centaurs - did not receive it.
  3. Quit battle, load saved game.

Result:

  • In original Heroes 2 this sequence of events will happen on every re-load (gargoyles received morale effect, centaurs not). Game could be re-loaded million times - you will receive exactly the same sequence (if your moves were the same too).
  • On fheroes2 sequence is random. For example, on first re-load gargoyles will receive morale effect, on second re-load - centaurs will, on third - nobody (or both), etc..

It is very important to support original behavior.

Save file

Experienced this issue in almost every battle.

Additional info

fheroes 0.9.6, Win10, GOG dosbox

@ivanychag ivanychag added the bug Something doesn't work label Aug 9, 2021
@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Aug 10, 2021

I'm not sure this behavior should be preserved. Random effects should be random by definition, and too predictable random generator rather looks like a (minor) bug in original game.

@oleg-derevenetz oleg-derevenetz added the logic Things related to game logic label Aug 10, 2021
@ihhub
Copy link
Owner

ihhub commented Aug 10, 2021

Yes, I agree with @oleg-derevenetz about this.

@ihhub ihhub added the question Question asked label Aug 10, 2021
@saox
Copy link

saox commented Aug 10, 2021

It is true that in the original game the luck was seeded on something related to the current state of the game before the battle. That way all the outcomes were 100% reproducible and thus only random "once". The question is what we want to achieve here - I am fine with both ;-).

@ihhub
Copy link
Owner

ihhub commented Aug 10, 2021

We have multiple places where randomizing is used:

  • luck/moral
  • AI cell movement
  • Damage range

From one side predictability is useful when you want to reply the same battle in the same till some point. On the other hand many players agree that difficulty of gameplay in the original game is low as many things are predictable.

Also making such an option is out of consideration. So we should find a solution suitable for most of players.

@ivanychag
Copy link
Author

ivanychag commented Aug 10, 2021

Guys!

The MOST important feature of Heroes 2 (Heroes 3, etc) is deterministic behavior.
Once you'd started a new game on some map, some unique game state created.
And this state will be recorded to all future save files (for this game).

So, you can save game before a battle, start it, make some moves and see some events, re-load saved game - and you will see the same events and AI moves (if your moves would be same too).

In this case you can find the best, the most optimal way to win the battle.
You can write down all you moves on paper (and write down AI moves and game events), reload game, make the same moves and receive the same events/AI moves.

That's why "Heroes" is called CHESS.

It's a key feature. It was a key feature for 20+ years.

If you want another game state - you should start a new game on this map.

And what we have now in fheroes2...
Current behavior looks like some kind of loot-boxes.
Different things happen on each reload.

This is not "Heroes". It is another, random-oriented game.
"Random of Might and Magic" maybe ))

BTW I like your project very much.
All these new features and improvements are awesome!
But this behavior makes your project unplayable to me.

@vincent-grosbois
Copy link
Contributor

It is true that in the original game the luck was seeded on something related to the current state of the game before the battle. That way all the outcomes were 100% reproducible and thus only random "once".

For this to work, the RNG also has to be updated deterministically at each battle event (ie each time AI moves etc), only seeding at the begining of the battle won't be enough

FYI we've already implemented this kind of "deterministic" seeding for RNG for hero level-ups

@ihhub ihhub added this to the 1.0 milestone Aug 10, 2021
@ivanychag
Copy link
Author

In addition to my comment above...

Imagine a feature with recorded player's actions. Let's call it demo-file.
This demo-file should also contain initial game state data.

So, you can load demo-file and watch the game played by some player (recorded that demo).
And, maybe, you can stop it at any game day and continue playing by yourself.
Or stop it and just check current state.

It could be implemented with original Heroes logic and deterministic behavior.
Player's actions (and initial game state) are enough to record - because the game will make the same AI moves/events.

And it could not be implemented with random logic. Or you should also record all AI actions and events to recreate game flow. Even then, if you want to continue playing by yourself from some game day repeating player's moves, you will receive other AI moves/events.

@ihhub
Copy link
Owner

ihhub commented Aug 10, 2021

Hi @vincent-grosbois , and for battleground objects as well🙂

@ihhub
Copy link
Owner

ihhub commented Aug 10, 2021

If we want to add predictability of a whole battle then the whole AI will be predictable, including World Map behaviour. For example, treasure chest bonus pickup or secondary skill selection. Knowing all these tricks gives the player a huge advantage to know all moves of AI. Many people complained about very weak AI in the original game because it's absolutely predictable. So my main question is do we want to have it?

@ivanychag
Copy link
Author

"Knowing all these tricks gives the player a huge advantage to know all moves of AI"
We lived with this for 20+ years )) It's an integral part of Heroes for many players.

BTW, my suggestion is an additional option for full random behavior.
(And this option's state should be recorded to save file)

Full random behavior also could be interesting for many players.

But, IMHO, original behavior should be recreated as default behavior.

@saox
Copy link

saox commented Aug 10, 2021

If we want to add predictability of a whole battle then the whole AI will be predictable, including World Map behaviour. For example, treasure chest bonus pickup or secondary skill selection. Knowing all these tricks gives the player a huge advantage to know all moves of AI. Many people complained about very weak AI in the original game because it's absolutely predictable. So my main question is do we want to have it?

The AI can still be smart AND be deterministic - those two things are not mutuall exclusive. The original H2 had a dumb AI - it always attacked ranged units first, always offloaded some units into castle thining down their own retinue etc. All those things were easily exploited.

Heroes 3 has a smart AI which is deteerministic - it reproduces the same luck/morale bonuses on load-game and offers a challange to players.

Now the only disadvantage of random outcomes is that I can see players load/saving forever until they get the outcome they want. But I have to say - I kind of like it like it is in fheroes2 right now.

@vincent-grosbois
Copy link
Contributor

For making the battle AI deterministic, it's quite simple IMO:

  • replace each call to random function to a random function that was seeded at the begining of the battle
  • RNG needs to be advanced (in a deterministic fashion) after each player or AI action. This is to avoid that for instance, that the next morale check of the following turn will always give a morale boost, regardless of what was done on the previous turn. So it needs to change based on the users/AI action

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Aug 10, 2021

Heroes 3 has a smart AI which is deteerministic - it reproduces the same luck/morale bonuses on load-game and offers a challange to players.

And HoMM3 predictive AI leads to an abusive behavior (in HotA Graveyards or Experimental Shops for example). I personally think that predictability is not a good thing when it comes to the random events. What is random should be random. While it's logical to have the same battleground objects on the same map cell in each battle, it's totally illogical to have a full predictable morale/luck events, etc. This leads to abuse.

@oleg-derevenetz
Copy link
Collaborator

I reclassify this rather as a feature request.

@oleg-derevenetz oleg-derevenetz added improvement New feature, request or improvement and removed bug Something doesn't work question Question asked labels Aug 10, 2021
@ivanychag
Copy link
Author

ivanychag commented Aug 10, 2021

I reclassify this rather as a feature request.

I have only one question. Is it a "recreation of HoMM2 game engine" which is "designed to reproduce the original game with significant improvements" or just a new game uses HoMM2 assets?

In first case original deterministic behavior should be implemented as default.

In second case... well, you can do what you want. But you should write a new description for this project ))

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Aug 10, 2021

I reclassify this rather as a feature request.

I have only one question. Is it a "recreation of HoMM2 game engine" which is "designed to reproduce the original game with significant improvements" or just a new game uses HoMM2 assets?

In first case original deterministic behavior should be implemented as default.

In second case... well, you can do what you want. But you should write a new description for this project ))

The "bug-to-bug" implementation definitely isn't a goal of this project. For example, we are not going to reproduce AI behavior in "bug-to-bug" manner, quite the opposite - the goal is to make it more strong, so all this abusive mechanics inherited from the original game most likely will not work anymore. Also we are not going to reproduce all these numerous bugs in battle pathfinding and so on.

@ivanychag
Copy link
Author

The "bug-to-bug" implementation definitely isn't a goal of this project. For example, we are not going to reproduce AI behavior in "bug-to-bug" manner, quite the opposite - the goal is to make it more strong. Also we are not going to reproduce all these numerous bugs in battle pathfinding and so on.

Original deterministic behavior is not a bug. It's a feature. Key feature. In 90s me, my friends, other gamers played HoMM2 in save/load way. We all knew what to expect. We tried to find the best possible way in constant conditions.

And I can't do it now here. Sad.

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Aug 10, 2021

other gamers played HoMM2 in save/load way. We all knew what to expect

Yes, that's exactly what I meant - predictable AI that may be abused by searching for weak points using save/load. This won't work against human player anyway, so what is the REAL challenge then?

@vincent-grosbois
Copy link
Contributor

vincent-grosbois commented Aug 10, 2021 via email

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Aug 10, 2021

We could have "deterministic" effects and AI, but based on a random seed that is re-generated each time we enter a battle. With this it would be possible to debug more easily, as long as you share the initial seed.
Then if we set the seed to always be the same (relative to the terrain location etc) it would re-create the feauture of heroes 2 of having deterministic battles

That's how obstacle generation currently works. If you think that deterministic AI and random events are good thing (I personally don't think so, but it is up to @ihhub to decide after all) you are free to create a pull request.

@ivanychag
Copy link
Author

other gamers played HoMM2 in save/load way. We all knew what to expect

Yes, that's exactly what I meant - predictable AI that may be abused by searching for weak points using save/load. This won't work against human player anyway, so what is the REAL challenge then?

Seems you are not familiar with offline HoMM tournaments (were popular in late 90s - early 00s), where you should achieve the highest rank possible in a real life week (for example) on some map and compare yor result with other players. Initial save game file provided by tournament host, so all players have the same conditions.

@oleg-derevenetz
Copy link
Collaborator

Seems you are not familiar with offline HoMM tournaments (were popular in late 90s - early 00s), where you should achieve the highest rank possible in a real life week (for example)

Well, I personally prefer hardcore modes (in XCOM/XCOM2 LW for example, like this game very much), so I generally don't see any challenge in abusing save/load. If I lost an operative or even entire squad on a mission due to some random passer-by around the corner that detected my ninja in a stealth mode - well, shit happens, I must continue to play with clenched teeth :) Hit load button and direct the ninja on a different path is much easier, no challenge at all.

@ivanychag
Copy link
Author

ivanychag commented Aug 10, 2021

Well, I personally prefer hardcore modes (in XCOM/XCOM2 LW for example, like this game very much), so I generally don't see any challenge in abusing save/load.

Let's see from another perspective.
HoMM2 is quite an old game.
And it has a lot of old fans. They played it in school, for example, in 90s. And they like this game as is. With this deterministic behavior (same as in HoMM3, btw). And they want to get the same experience (with some new features like buying creatures from well). And... they can't. So, this project becomes useless for them.

@vincent-grosbois
Copy link
Contributor

We could have "deterministic" effects and AI, but based on a random seed that is re-generated each time we enter a battle. With this it would be possible to debug more easily, as long as you share the initial seed.
Then if we set the seed to always be the same (relative to the terrain location etc) it would re-create the feauture of heroes 2 of having deterministic battles

That's how obstacle generation currently works. If you think that deterministic AI and random events are good thing (I personally don't think so, but it is up to @ihhub to decide after all) you are free to create a pull request.

Not really, what I'm suggesting is that even for current behavior (full random), we can implement it instead as being deterministic, but based on a seed that is randomly generated at each start of battle at each reload. That way, we can still easily replay the battles if needed (for debugging for instance).

As for having full deterministic battles vs random battles, I think it could be a setting indeed

@ihhub
Copy link
Owner

ihhub commented Aug 12, 2021

Making an extra setting for this is not a good idea because it's not user friendly. We have to choose single behavior and stick to it.

Before making changes let's hear @Branikolog and @LeHerosInconnu.

@LeHerosInconnu
Copy link

LeHerosInconnu commented Aug 12, 2021

Hello everyone,

In the original game, if the player replays a combat with exactly the same actions, everything happens exactly the same, the spells cast by the AI, the AI moves, the damage points of the attacks are exactly the same, etc., etc., etc.
This mode of operation is the essence of Heroes 2.

(And it's also why I was able to report combat bugs from the original game: https://heroes2.forumactif.com/f37-original-heroes-2-bugs.)

If the replayed combats are random each time, it encourages the player (even if "cheating" is not the goal) to reload a save to get a different result, which makes the game experience mediocre after a while and makes the player lose interest in the game because part of the "challenge" is no longer there and looking for another strategy to win is "not really" necessary anymore.

It is also worth noting that there is the same problem currently in fheroes2 with the instant and automatic combats (#4007).
Redoing the same combat after a reload also gives different results for instant and automatic combats.
The same combat replayed in instant mode and in automatic mode should also give exactly the same result for the reasons of disinterestedness of the player mentioned earlier.

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Aug 12, 2021

Hi @LeHerosInconnu

If the replayed combats are random each time, it encourages the player (even if "cheating" is not the goal) to reload a save to get a different result, which makes the game experience mediocre

I'd say that predictable AI encourages to do this even more because player may try to make a slightly different moves to force the AI to fail at some point (or just wait for dismorale/unluck event), then he can just repeat these steps (so this failure/event becomes recurring with 100% probability) and then make further moves to force the AI to fail once again, and so on. With unpredictable events & AI this "chain of failures" may be achieved only accidentally. This is not a real challenging game IMHO - you will not be able to do such tricks against human player, so you will need to outperform him strategically as well as tactically to win instead of abusing him as described above. The fact that AI in original game was dumb and predictable doesn't make it an ideal to strive for.

@LeHerosInconnu
Copy link

Hello @oleg-derevenetz,

Hi @LeHerosInconnu

If the replayed combats are random each time, it encourages the player (even if "cheating" is not the goal) to reload a save to get a different result, which makes the game experience mediocre

I'd say that predictable AI encourages to do this even more because player may try to make a slightly different moves to force the AI to fail at some point (or just wait for dismorale/unluck event), then he can just repeat these steps (so this failure/event becomes recurring with 100% probability) and then make further moves to force the AI to fail once again, and so on. With unpredictable events & AI this "chain of failures" may be achieved only accidentally. This is not a real challenging game IMHO - you will not be able to do such tricks against human player, so you will need to outperform him strategically as well as tactically to win instead of abusing him as described above. The fact that AI in original game was dumb and predictable doesn't make it an ideal to strive for.

In one case the player will reload and rely on randomness, in the other case the player will reload and change his strategy.
Which is better for a strategy game?
Relying on randomness or exploring another strategy?

In the original game, the not so good AI, reacts with a not so good action.
In fheroes2, the improved AI reacts with an improved action that is supposed to be the best possible action.
Now if to the same action, the improved AI always reacts with the same best action, I am okay with that; it is rather better than reacting with a random action that will not be as good as the optimal action.

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Aug 12, 2021

@LeHerosInconnu

In one case the player will reload and rely on randomness

The key difference is that player will not be able to rely on randomness too far (so to speak) and he will be not able to build a stable "chain of favorable pseudo random events" using multiple repetitions of the same actions, so he would improve his gaming skills (better hero chains, better economy, better tactics, etc) instead of abusing pseudo-randomness.

@LeHerosInconnu
Copy link

@oleg-derevenetz.

@LeHerosInconnu

In one case the player will reload and rely on randomness

The key difference is that player will not be able to rely on randomness too far (so to speak) and he will be not able to build a stable "chain of favorable pseudo random events" using multiple repetitions of the same actions, so he would improve his gaming skills (better hero chains, better economy, better tactics, etc) instead of abusing pseudo-randomness.

Let's say that the player replay the same combat (with randomness) several times by saving after each combat.
The first combat, he loses 10 creatures.
The second combat, he loses 5 creatures.
The third combat, he loses 25 creatures.
The player chooses to continue from the second save.

Now, if the result of the combat is always the same (same action, same reaction), the player will ask himself if the losses are acceptable or if he changes his strategy to try to get a better result.

The gameplay experience of the second mode is more rewarding in my opinion and more in line with a strategy game.

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Aug 12, 2021

@LeHerosInconnu

The gameplay experience of the second mode is more rewarding in my opinion and more in line with a strategy game.

Unlike chess, there is randomness in this game (random damage of creature stacks, random luck/morale events, etc). I believe that random effects should be really random. Of course, "real" randomness may be abused using save files too, but at least it will be impossible to abuse the predictability. Abusing the chain of predictable dismorale/unluck/low damage events, you will be able to eventually win even if you were to lose, and all this due to the 100% predictable and repeatable chain of "random" events - while with true random events this can only be achieved by chance.

@LeHerosInconnu
Copy link

@oleg-derevenetz.

@LeHerosInconnu

The gameplay experience of the second mode is more rewarding in my opinion and more in line with a strategy game.

Unlike chess, there is randomness in this game (random damage of creature stacks, random luck/morale events, etc). I believe that random effects should be really random. Of course, "real" randomness may be abused using save files too, but at least it will be impossible to abuse the predictability. Abusing the chain of predictable dismorale/unluck/low damage events, you will be able to eventually win even if you were to lose, and all this due to the 100% predictable and repeatable chain of "random" events - while with true random events this can only be achieved by chance.

In Heroes 2, everything related to randomness is determined at the beginning of the scenario.
Spells in Shrines, spells in Pyramids, spells in Mage Guilds, secondary skill progression of heroes, contents of Treasure Chests, contents of resource stacks, secondary skills of Witch Huts, random artifacts for the adventure map, random creatures, number for random creatures, artifacts in Graveyards (as a whole not on a case by case basis), etc., etc., etc.
The data used for randomness in combat is also predetermined (this is what allows for the same reaction to the same action).

There is no real randomness "on the fly" in Heroes 2 (to my knowledge).
There is randomness at the creation of the scenario, then it is strategy.

Fheroes2 should be faithful to this.

@ivanychag
Copy link
Author

Like in many other games, the challenge for player is to beat the game in constant conditions.
Finding the best ways, with minimal losses. This is what is called a strategy.
And player's reward is the feeling "yeah, I did it!".

But player can't achieve this feeling in randomly change conditions.
And he will start finding the most lucky random situation for him ("ok, I did it...").

It is not Heroes story. Maybe some other game - not Heroes.

And... yeah, all conditions on the map are generated once when you start a scenario (in original Heroes 2).

@ivanychag
Copy link
Author

ivanychag commented Aug 12, 2021

You can easily do a simple test.

  1. Start new game on some map with neutral squad near the starting castle (Beltway, for example). Use warlocks (they have flying and archery units in hero's army for fast test).
  2. Save game
  3. Attack this neutral squad
  4. Attack some unit by gargoyles. Remember damage value.
  5. Attack some unit by centaurs. Remember damage value.
  6. Reload saved game
  7. Attack this neutral squad
  8. Attack same units by same hero's units (using same position for gargoyles on battle field).
  9. Compare damage values with previous battle

Heroes 2 original: values would be the same
fheroes2: values would be different on each reload

@ihhub
Copy link
Owner

ihhub commented Aug 14, 2021

I agree with @LeHerosInconnu that instant battle results and automated battle must have the same results. In this case we have to implement seed dependent solution. At least we won't allow the player to have 2 chances to replace the same battle.

@Branikolog
Copy link
Collaborator

Hi all!
It seems to me, that I've missed a hot discussion here.)
I agree with @ihhub: The results of instant battles shouldn't be abuseable and should be the same each "load-game".
Regarding randomness... Actually, I'm not sure this adds much pleasure to gameplay: once player loads the game to change his reaction on a certain battle stage - all further events would be completely different. So "searching for best tactics" is simply loading the game and trying to repeat same actions to the stage, when player can load multiple times and choose one, which is obvious an abusement.
Offline tournaments, I believe, were popular in "ancient times" :D, when "Heroes" was not commonly widespread game and lots of people experienced difficulties with internet connection. Nowadays everyone has stable connection, sufficient for playing online. In future we'd provide (I hope) modern multiplayer mode which will bury such offline challenges.
Also, everyone's complaining about weak AI, which eliminates the pleasure of gaming... I believe, such "save/load sessions" do the same, making you tired of the game after some scenarios being finished.
And the last argument. :)
We're going to make AI as much "human-like" as we can. So it can happen, that he would behave not the same in the same situations, so loading the game will not guarantee AI make the same actions, he made before. So, what do we need that determined behaviour for then?

@ivanychag
Copy link
Author

We're going to make AI as much "human-like" as we can. So it can happen, that he would behave not the same in the same situations, so loading the game will not guarantee AI make the same actions, he made before. So, what do we need that determined behaviour for then?

I am tired, really.

First time I played original Heroes 2 in 1997 or so.
And it is still one of my favorite games.

Deterministic behavior is one of key features. In H1/H2/H3.
You may not like it, but it is.
You can give 100500 give counterarguments, but it is.

And... is fheroes2 a remake?
If so, deterministic behavior should be implemented. As option, as default behavior, as config parameter... but it should be.

If not... well, it's sad, really. I can't get the same experience as in last 24 years here.

P.S. It will be fair to add to readme file or site main page something like this: "this is not 100% remake. deterministic behavior in battles not supported. you will get different results (damage/luck/morale) in battles on each save/load. have fun!"

@oleg-derevenetz
Copy link
Collaborator

@ivanychag This is an open source project, free as freedom (as well as beer BTW). You are free to make a fork and implement whatever logic you like.

@vincent-grosbois
Copy link
Contributor

I'll take that one if it's ok

@ihhub
Copy link
Owner

ihhub commented Aug 23, 2021

Hi @vincent-grosbois , please do since you're the one who worked on previous randomization stuff🙂

vincent-grosbois added a commit to vincent-grosbois/fheroes2 that referenced this issue Aug 23, 2021
vincent-grosbois added a commit to vincent-grosbois/fheroes2 that referenced this issue Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature, request or improvement logic Things related to game logic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants