Program stops responding when on enemy AI in certain mission
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
Program stops responding when on enemy AI in certain mission
Windows 10 21H1
Wesnoth 1.16.5
Program simply stops responding when in the enemy phase after pressing end turn, save provided
Addons used:
Non-fatal wounds normal edition
Less random
Wind mod (Breeze)
Language: German OS, English(UK) in-game display language
Wesnoth 1.16.5
Program simply stops responding when in the enemy phase after pressing end turn, save provided
Addons used:
Non-fatal wounds normal edition
Less random
Wind mod (Breeze)
Language: German OS, English(UK) in-game display language
- Attachments
-
- wesnoth-20220801-072105-7376.log
- (885 Bytes) Downloaded 42 times
-
- HttT-The Princess of Wesnoth Turn 8.gz
- (71.85 KiB) Downloaded 52 times
Last edited by hallo1126 on August 1st, 2022, 5:54 am, edited 2 times in total.
Re: Program stops responding when on enemy AI in certain mission
I would really like to be able to continue this game, thanks for any help
Re: Program stops responding when on enemy AI in certain mission
I wasn't able to load the save game in 1.16.5 since I don't have the same modifications installed and I get an invalid terrain message against Gll^Fdfr (should normally be just Gll^Fdf). It looks like the breeze modification is doing something to the terrains. Also your save file and error log mention Ftr (rainforest) but there's no rainforest in this scenario that I can see.
I can't say it will work but I suggest disabling or removing the breeze modification (or ideally all add-ons) and re-load from the start-of-scenario save. If that doesn't work you may have to restart from the beginning of the campaign or try hacking around the save game yourself.
I can't say it will work but I suggest disabling or removing the breeze modification (or ideally all add-ons) and re-load from the start-of-scenario save. If that doesn't work you may have to restart from the beginning of the campaign or try hacking around the save game yourself.
Soli Deo Gloria
Re: Program stops responding when on enemy AI in certain mission
Either way, a moddable application not responding instead of giving a warning or a crashlog is always a bug with the application itself. An endless loop should never be allowed to happen this way
Re: Program stops responding when on enemy AI in certain mission
It is balance between freedom and protection. Wesnoth does not limit Lua that way. And it should not.
Re: Program stops responding when on enemy AI in certain mission
Welp, guess that is why it's a free game, I shouldn't complain
Re: Program stops responding when on enemy AI in certain mission
I was able to reproduce this after installing those add-ons. What happens is that one of the AI actions uses a recursive utility function that gets stuck in an infinite loop. It goes without saying that that should not happen and needs to be fixed. What I don't know yet is why this is happening (and if the mods have anything to do with it) and why we have not seen it before. This is a frequently used function that has not been changed in a long time. I'll look into it, but I don't have much time right now and the fix may or may not be trivial, so I can't tell how long it's going to take.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Program stops responding when on enemy AI in certain mission
Actually (excuse the double posting), it looks like this is not truly an infinite loop and not technically a bug. Some of the units have 20 strikes because of the Less Random add-on and this causes so many possible combinations in the attack outcome evaluation that it never finishes (but it would eventually, if given enough time). I'll have to think about what to do with this. Fall back to some other evaluation method when the number of strikes is larger than a certain number, or something along those lines. Another possibility would be the "well, too bad, Wesnoth was not built for this" approach, but I will only take that one if it proves too hard to work around otherwise.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Program stops responding when on enemy AI in certain mission
Awesome, thanks! As a programmer myself I was suspecting it had to do with AI, but I was really surprised why I got so far into the campaign without this popping up before then (the only signs that were seen before somewhat was at the very end of some enemy turns, it would take unusually long for the turn to go back to me, I hope this can give another hint too, but probably you already are aware of the intricacies).mattsc wrote: ↑August 1st, 2022, 3:31 pm Actually (excuse the double posting), it looks like this is not truly an infinite loop and not technically a bug. Some of the units have 20 strikes because of the Less Random add-on and this causes so many possible combinations in the attack outcome evaluation that it never finishes (but it would eventually, if given enough time). I'll have to think about what to do with this. Fall back to some other evaluation method when the number of strikes is larger than a certain number, or something along those lines. Another possibility would be the "well, too bad, Wesnoth was not built for this" approach, but I will only take that one if it proves too hard to work around otherwise.
The reason for it not having been known before is maybe because I used non-default values (default is x3, I used x4). I believe this mod is a crucial fix of the game because it still allows a low amount of RNG but not the completely debilitating vanilla gameplay of some 32 damage x 2 rolls with 70% hitting zero times. The roll multiplier is a nice and simple solution to this to average out the results.
Re: Program stops responding when on enemy AI in certain mission
An addendum (excuse my double-posting too), my suggestion for an alternative evaluation (if that route becomes necessary) would be to use the damage-calculation aspect more with a simple roll-averaging like is done in the UI instead of going strike-for-strike. Some simple calculations can be done to roughly predict the chances of a unit dying in a certain time-frame and with that the attacked units remaining HP can be estimated. It has less accuracy, but because the higher roll count averages it out , the result should actually not be too far off vanilla behavior with less rolls, probably even more accurate all else considered, referencing my above example of what can happen.
Re: Program stops responding when on enemy AI in certain mission
The reason why you did not encounter this earlier is because this scenario uses the Assassin Squad Micro AI, which uses different attack rating subroutines than the default AI, and those were written and optimized for a different purpose than this high-strike-number high-HP situation. I've done some tests and it appears that somewhere between 15 and 20 strikes (combined between the two units) is where this becomes too slow (taking a couple seconds per evaluation on my computer for 20 strikes).hallo1126 wrote: ↑August 1st, 2022, 3:58 pm ... but I was really surprised why I got so far into the campaign without this popping up before then (the only signs that were seen before somewhat was at the very end of some enemy turns, it would take unusually long for the turn to go back to me, I hope this can give another hint too, but probably you already are aware of the intricacies).
Thanks for the suggestion for alternative methods of calculating the outcome/rating. There are a variety in use already in the engine, some exact, some approximate, and for the reasons above, simply falling back to one of those should work well enough here. In fact, there is no real reason to not use the default evaluation in this Micro AI these days any more, but I also don't want to change the method used during the stable 1.16 series (other than fixing things like impossibly long evaluation times).
We'll just have to agree to disagree on this, as they say. Personally, I think that this is neither crucial nor a fix. In fact, I specifically like the default Wesnoth mechanism and the risk management that goes along with it. But I won't tell you that you have to like my preferences of playing the game (and expect that you don't tell me that I have to like yours either). One of the great things about Wesnoth is that there are so many different ways of modding and playing it.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Program stops responding when on enemy AI in certain mission
Thank you for your great work in fixing this! And also thanks for the detailed explanation of why it happened.
And indeed, the modability is one of Wesnoth's greatest aspects and I will also not tell you how you should enjoy the game of course. However, if you pardon, I would like to take this moment for lobbying and advocating for this game-mode (or something following its philosophy of high-HP, high-roll averaging) to be pushed up to a first-class-citizen packed as an RNG option into the vanilla game, similar to the founder-mod (and following the same reasoning) of topic 48160 of this forum (viewtopic.php?t=48160) and as a further alternative in line with the philosophy of the (currently still marked as experimental) "Biased RNG" mode of the game (which I am not sure if it is the "Deterministic mode" mentioned in the related forum post just renamed or something different).
Thank you very much for hearing me out.
And indeed, the modability is one of Wesnoth's greatest aspects and I will also not tell you how you should enjoy the game of course. However, if you pardon, I would like to take this moment for lobbying and advocating for this game-mode (or something following its philosophy of high-HP, high-roll averaging) to be pushed up to a first-class-citizen packed as an RNG option into the vanilla game, similar to the founder-mod (and following the same reasoning) of topic 48160 of this forum (viewtopic.php?t=48160) and as a further alternative in line with the philosophy of the (currently still marked as experimental) "Biased RNG" mode of the game (which I am not sure if it is the "Deterministic mode" mentioned in the related forum post just renamed or something different).
Thank you very much for hearing me out.
Re: Program stops responding when on enemy AI in certain mission
Thanks. I believe I have this fixed now. I don't know if you are comfortable with hacking the core files. If so, you can replace file
If you replace the file, you can continue the game from your save. If you do not want to do that, it will be fixed in the next release.
On the topic of the Less Random modification, I'm not really the right person to talk to (but I do appreciate your clear and calm proposal). It says 'Inactive Developer' under my name for a reason, I just surface occasionally when problems with AI code pop up, and that is not my area of game development anyway. If I wanted to bring this forward, I'd go on the Wesnoth development Discord/irc channel and scope out how interested the people in charge of this are. Alternatively, you could post this in the Ideas forum, or put in a feature request on github. Both of the latter might not get a quick answer though, so that's why I suggested the former.
data/ai/lua/battle_calcs.lua
with that attached here. The only change is the if
conditional block starting at line 673. I did some more tests, the method used in that file is faster than the default evaluation up to around 14 combined strikes, then wesnoth.simulate_combat()
becomes faster.If you replace the file, you can continue the game from your save. If you do not want to do that, it will be fixed in the next release.
On the topic of the Less Random modification, I'm not really the right person to talk to (but I do appreciate your clear and calm proposal). It says 'Inactive Developer' under my name for a reason, I just surface occasionally when problems with AI code pop up, and that is not my area of game development anyway. If I wanted to bring this forward, I'd go on the Wesnoth development Discord/irc channel and scope out how interested the people in charge of this are. Alternatively, you could post this in the Ideas forum, or put in a feature request on github. Both of the latter might not get a quick answer though, so that's why I suggested the former.
- Attachments
-
- battle_calcs.lua
- (73.11 KiB) Downloaded 46 times
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
- Pentarctagon
- Project Manager
- Posts: 5565
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Program stops responding when on enemy AI in certain mission
I'm not opposed to any particular RNG mode, but that said we already have multiple options available today and I don't want to end up with a dozen different RNG type options 5 years from now. So if a new RNG mode is added, I'd want to see an existing mode removed as well.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Program stops responding when on enemy AI in certain mission
Thank you very much for the fix! I think I will end up going the forum-route for the proposal. However:
Default and Predictable have the only difference, according to my understanding, that Predictable uses a seed determined at game-start while Default just grabs the current time as seed every now and then. They are the same mode and I think it would be better to combine them and add a checkbox instead for using a fixed seed or not. Biased should be the second mode with the same checkbox, this checkbox does not increase support complexity because setting the seed is just a code one time and forget type of task.
Therefore adding a third mode would not warrant removing one of the other two (or more, removing Biased mode, since removing default mode would be completely unreasonable I already know what we would end up with). That would just end up being "We can have the default mode and one (1) other mode, nothing more".
With that out of the way, I do not believe there is something bad about giving a lot of options. However, I do prefer settings over fixed modes. For example, for the implementation of my proposal, I believe the best course of action would be to give another prompt to the player where they can have the following options:
[1-10] HP multiplier
[1-10] Strike Multiplier
[1-10] Damage Multiplier
[Default/Biased] RNG Type
[yes/no (checkbox)] Fixed RNG Seed (reloads give the same results)
Instead of the current concept, where a fixed option would be added upon a new proposal. I believe this would give the player a lot of additional freedom when deciding how they want to play the game. Campaigns could maybe give suggestions or force particular settings to give further freedom to game design for the community.
I do disagree with this completely. The current options are "Default", "Predictable" and "Biased (experimental)".Pentarctagon wrote: ↑August 3rd, 2022, 4:06 pm I'm not opposed to any particular RNG mode, but that said we already have multiple options available today and I don't want to end up with a dozen different RNG type options 5 years from now. So if a new RNG mode is added, I'd want to see an existing mode removed as well.
Default and Predictable have the only difference, according to my understanding, that Predictable uses a seed determined at game-start while Default just grabs the current time as seed every now and then. They are the same mode and I think it would be better to combine them and add a checkbox instead for using a fixed seed or not. Biased should be the second mode with the same checkbox, this checkbox does not increase support complexity because setting the seed is just a code one time and forget type of task.
Therefore adding a third mode would not warrant removing one of the other two (or more, removing Biased mode, since removing default mode would be completely unreasonable I already know what we would end up with). That would just end up being "We can have the default mode and one (1) other mode, nothing more".
With that out of the way, I do not believe there is something bad about giving a lot of options. However, I do prefer settings over fixed modes. For example, for the implementation of my proposal, I believe the best course of action would be to give another prompt to the player where they can have the following options:
[1-10] HP multiplier
[1-10] Strike Multiplier
[1-10] Damage Multiplier
[Default/Biased] RNG Type
[yes/no (checkbox)] Fixed RNG Seed (reloads give the same results)
Instead of the current concept, where a fixed option would be added upon a new proposal. I believe this would give the player a lot of additional freedom when deciding how they want to play the game. Campaigns could maybe give suggestions or force particular settings to give further freedom to game design for the community.