jdoleary / Spellmasons

https://store.steampowered.com/app/1618380/Spellmasons/
Other
2 stars 1 forks source link

Attention Marker Inaccuracy #409

Open SoulMuncher opened 7 months ago

SoulMuncher commented 7 months ago

Attention Markers can be incorrect at times because the prediction is not simulated out the same way it actually occurs in real time. Things like PlanningView and OnDrawSelected tend to find targets based on the current game state, not factoring in the allies that would act before enemies, effects like bloat that can change the outcome of combat, and damage modifiers like debilitate and fortify, which are not considered while incrementing a unit's next turn damage.

Consider for AI Refactor #388 -> Not to be fixed alone

SoulMuncher commented 4 months ago

https://github.com/jdoleary/Spellmasons/pull/641#discussion_r1578641250

// For AI Refactor: https://github.com/jdoleary/Spellmasons/issues/388 // TODO - This doesn't factor in fortify, debilitate, bloat explosions, etc. // This also doesn't play well with units that have different actions, such as the Goru // Is there a way for us to better predict the enemy turn, in a way that considers // the game state and always stays in sync with the actual outcome of combat?

Hmm yeah good point. I mean even if it's inaccurate, I don't think it's a huge deal. Worst case, a unit chooses not to target something right? For now I think it'll have to do. I want to focus on resolving actual bugs before fine tuning AI

I honestly don't know. I imagine there's a wide range of unpredictable effects, including false negatives where a unit says they won't attack and then they do. But this has been an issue for a long time and only affects certain edge case scenarios where combinations of modifiers and onDeath/onDamage effects are involved. Right now it's not that bad, but it will become increasingly unstable as the game grows and more effects are added.

SoulMuncher commented 1 month ago

https://github.com/jdoleary/Spellmasons/pull/868#issuecomment-2229361160

Ideally, prediction would always show "game-state directly after cast", and everything else would be in some generic incoming healing/damage overlay. Doing this reliably would require a huge refactor of the prediction/smart targeting code, and I would rather it not exist than be unreliable.

As an example: Smart Targeting runs all ai units at the same time, instead of having an ally turn and then an enemy turn. This means that those units turnStart/End events don't run in the correct order, which is very problematic when introducing health regen, poison, etc. Smart Targeting also doesn't use Unit.takeDamage() or Unit.die() either, so it skips onDamage/onDeath events, including modifiers like debilitate, fortify, bloat explosions, etc.