It is currently 20 Jun 2025, 13:37
   
Text Size

Shandalar - Program Bugs

AI casts Giant Growth and similar on player's creatures (reviewed)

 

Last edited by Korath on 25 May 2015, 19:58, edited 1 time in total.

Comments

Posted by Korath » 23 Sep 2015, 02:20

commit cf06918024b5e6f698faff1b4722d9b514d658e5
Author: Korath <dgk@Dirge.none>
Date: Tue Sep 22 22:20:13 2015 -0400

[NB] #531: Replace direct handling of EVENT_SHOULD_AI_PLAY with ASSESSING_...()

Currently all the same:
ASSESSING_FOR_NEXT_UPKEEP()
ASSESSING_FOR_NEXT_UPKEEP_OPPONENT()
ASSESSING_FOR_NEXT_UPKEEP_ANYBODY()
ASSESSING_FOR_NEXT_UPKEEP_SPECIFIC_PLAYER()
ASSESSING_FOR_NEXT_DRAW()
ASSESSING_FOR_NEXT_TURN()
ASSESSING_NONCOMBAT()
These apply their effects when the AI is doing whole-turn assessment after
PHASE_DISCARD. (The intention is to make ASSESSING_FOR_NEXT_UPKEEP() etc.
eventually do the right thing with multiple upkeeps from Paradox Haze and
extra turns from Time Walk-like effects, and ASSESSING_FOR_NEXT_DRAW() to
take cards that make you skip your draw step into account.)

ASSESSING_ANYTIME()
Applies its effects whenever the AI does assessment, including for combat.
Unsafe to do anything here except change ai_modifier.

Irritatingly, the pattern in MicroProse cards for everything in the first
group, and (to some extent) emulated by me, was to check
current_phase == PHASE_CLEANUP, which prevented the AI handling from ever
running - the correct check would have been current_phase == PHASE_DISCARD.
In particular, this affected everything with an activation cost including
sacrificing, tapping, or bouncing another card.

I suspect, but cannot prove, that doing things like adding tokens to the bf or
forcing sacrifice or destruction of cards during combat speculation is behind
bugs like #531, by desynchronizing the AI decision tree between speculation and
reality. (If I'm wrong, I've probably just made the combat AI even worse.)
All cards in Shandalar.dll that did something during EVENT_SHOULD_AI_PLAY other
than just changing ai_modifier now will only do so during full-turn
speculation. There's a handful in Shandalar.exe that still do so:
Rocket Launcher, Khabal Ghoul, Yawgmoth Demon, Prismatic Dragon,
Rainbow Knights, Fungusaur, Dragon Whelp, Time Elemental, Osai Vultures,
Scavenging Ghoul, Junun Efreet, Phantasmal Forces, Force of Nature,
Cosmic Horror, Lord of the Pit, Island Sanctuary, Brainwash, Living Artifact,
Stasis, Power Surge, Cyclone, Farmstead, Mishra's War Machine, Urza's Avenger,
Armageddon Clock, Mana Vault, and various effect cards.

Posted by Korath » 07 Oct 2015, 23:04

commit 9ee2eb75e2804c6a46c4ece98fdc2be97a458fba
Author: Korath <dgk@Dirge.none>
Date: Wed Oct 7 17:20:39 2015 -0400

[NB] Label and log AI and try to keep it from desyncing

(Shandalar.ini:[Duel]LogAIAssessment = 2 to log.)

There was a major desync when the human selected a target in the graveyard;
recorded_rand() was always passed AI as the controlling player, so not enough
positions on the chosen branch were popped. This was very obvious when testing
Exhume, since (when the player cast it) the player chose first, then the AI;
and the AI chosen an invalid card to resurrect.

There were also possible desyncs in (normal) targetting, sleight/hack color or
land type choice, and Fireball x_value choice; in each case, it's possible for
a choice made for the human during speculation not to get popped from the
chosen branch. While all three were copied faithfully from Shandalar.exe,
there *is* bug #531 to keep in mind. In particular, if the targeting one is
real, it could easily account for the terrible targeting for Giant Growth
during combat, and possibly for terrible choices when the AI responds to the
player's activation or spell. But it's very difficult to test definitively.

There's similar possible desyncs remaining in Lich's sacrifice choice and when
choosing how many counters to remove from a Mana Battery that I haven't fixed,
just marked for attention when I rewrite those cards.

Ticket details

  • Ticket ID: 531
  • Project: Shandalar
  • Status: Reviewed
  • Component: Duel AI
  • Project version: Ruined Tower 1
  • Priority: Normal
  • Severity: Normal
  • Assigned to: (unassigned)
  • Reported by: Korath
  • Reporter's tickets: List all tickets
  • Reported on: 22 May 2015, 12:49
  • Last visited by Korath » 18 Sep 2018, 05:51.
 

Main Menu

User Menu

Our Partners


Login Form