Shandalar - Program Bugs
Game hangs when fighting Paladin due to Magical Hack (fix completed)
Typical situation: AI has Northern Paladin out, access to at least one blue mana and I have non-black permanent(s) out. A good situation for Sleighting the Paladin, something which I have not once seen the AI manage to complete. Instead the game gets stuck, showing the 'busy' cursor, similar to what often happened in long duels in "classic" Shandalar.
Last edited by Korath on 09 Jun 2015, 01:20, edited 1 time in total.
Reason: retitle from "Game hangs when fighting Paladin - Sleight of Mind is likely culprit"
Reason: retitle from "Game hangs when fighting Paladin - Sleight of Mind is likely culprit"
Comments
Posted by jiansonz » 07 Jun 2015, 21:39
Now I am confused. In order to make the game run smoother, I swapped out the Sleight of Mind cards in the Paladin's deck, but I still experience hang-ups duelling him. So there is (also?) something else going on.
Replacing Clone with Vesuvan Doppelganger in the Shapeshifter deck seems to have worked better. Haven't had any problems duelling Shapeshifter since I made this change.
Replacing Clone with Vesuvan Doppelganger in the Shapeshifter deck seems to have worked better. Haven't had any problems duelling Shapeshifter since I made this change.
Last edited by jiansonz on 07 Jun 2015, 21:41, edited 1 time in total.
Posted by Korath » 08 Jun 2015, 20:20
Could you post the decklist you're using, so I can be sure I have the same one when I start trying to repro this?
Posted by jiansonz » 08 Jun 2015, 23:36
Sure.
0175.dck
0175.dck
- | Open
- Paladin (W, 4th)
.188 16 Plains
.126 4 Island
.175 4 Northern Paladin
.283 3 White Knight
.112 3 Holy Strength
.64 3 Disenchant
.293 3 Angry Mob
.153 3 Magical Hack
.134 3 Karma
.240 2 Swords to Plowshares
.254 4 Tundra
.862 3 Rainbow Knights
.420 2 Flying Men
.36 1 Circle of Protection: Red
.284 1 White Ward
.105 1 Green Ward
.34 1 Circle of Protection: Blue
.782 1 Segovian Leviathan
.774 1 Righteous Avengers
.vNone
.153 1 Magical Hack
.64 1 Disenchant
.240 1 Swords to Plowshares
.vBlack
.240 1 Swords to Plowshares
.616 2 Divine Transformation
.vBlue
.153 1 Magical Hack
.420 2 Flying Men
.vGreen
.153 1 Magical Hack
.552 2 Acid Rain
.vRed
.153 1 Magical Hack
.45 2 Conversion
.vWhite
.153 1 Magical Hack
.64 1 Disenchant
.240 1 Swords to Plowshares
Last edited by jiansonz on 08 Jun 2015, 23:37, edited 1 time in total.
Posted by Korath » 09 Jun 2015, 01:19
Issue here is related to the Enchant Type OWN and Enchant Type OPP values I mention here. These didn't exist in the original game; and rather than increase the width of card_ptr_t{} (a daunting task), they were placed into byte2 of card_ptr_t::hack_parameters. This makes sense, since hack_parameters is four bytes wide but only needs one byte for everything it does.
The problem is that the Shandalar version of Magical Hack still looks at the whole dword - it speculates whether to target Holy Strength (in the duel I just froze in), sees cards_ptr[CARD_ID_HOLY_STRENGTH].hack_parameters == 0x00210000, considers it a valid target since it's not 0, and gets caught in an infinite loop trying to randomly select a color_test_t value (either 0x2, 0x4, 0x8, 0x10, or 0x20) that's set in 0x00210000.
No similar bug in Sleight of Mind.
The problem is that the Shandalar version of Magical Hack still looks at the whole dword - it speculates whether to target Holy Strength (in the duel I just froze in), sees cards_ptr[CARD_ID_HOLY_STRENGTH].hack_parameters == 0x00210000, considers it a valid target since it's not 0, and gets caught in an infinite loop trying to randomly select a color_test_t value (either 0x2, 0x4, 0x8, 0x10, or 0x20) that's set in 0x00210000.
No similar bug in Sleight of Mind.
Posted by Korath » 09 Jun 2015, 01:50
It gets worse; most of the values given in Manalink.csv for Magical Hack are wrong; and I don't know where csv2dat.exe puts the value for Sleight of Mind, but it's not where Sleight of Mind looks for it either in Manalink or Shandalar. I'm going to just throw away the manually-entered values and compute them at runtime from the rules text.
Posted by Korath » 09 Jun 2015, 05:26
commit 0df1a4642ee5e43977d054661a428896f6bace03
Author: Korath <dgk@Dirge.none>
Date: Tue Jun 9 01:25:32 2015 -0400
[Shandalar] FIX #596: find hack/sleight values at runtime; clear enchant_type
Rather than relying on the manually-input values in Manalink.csv (which mostly
use color_t values for hack_color, not color_test_t values as required) as
interpreted by csv2dat.exe (which, near as I can tell, just throws away the
sleight values).
Zero out the enchant_type values and whatever-it-is that gets put into
hack_colors, too, so the MicroProse version of Magical Hack doesn't hang.
Only one byte is needed for each, and a full dword is allocated to each. There
might be some benefit in reclaiming the other six bytes, but I already have the
machinery for extra_data_t in place, which does essentially the same thing as
card_ptr_t.
Support:
replace_hack_and_sleight_values()
end_of_stash_standard_text()
Incidental:
Weight matching protection higher in AI assessment, to try to discourage AI
from sleighting his creatures *away* from their optimal color
Author: Korath <dgk@Dirge.none>
Date: Tue Jun 9 01:25:32 2015 -0400
[Shandalar] FIX #596: find hack/sleight values at runtime; clear enchant_type
Rather than relying on the manually-input values in Manalink.csv (which mostly
use color_t values for hack_color, not color_test_t values as required) as
interpreted by csv2dat.exe (which, near as I can tell, just throws away the
sleight values).
Zero out the enchant_type values and whatever-it-is that gets put into
hack_colors, too, so the MicroProse version of Magical Hack doesn't hang.
Only one byte is needed for each, and a full dword is allocated to each. There
might be some benefit in reclaiming the other six bytes, but I already have the
machinery for extra_data_t in place, which does essentially the same thing as
card_ptr_t.
Support:
replace_hack_and_sleight_values()
end_of_stash_standard_text()
Incidental:
Weight matching protection higher in AI assessment, to try to discourage AI
from sleighting his creatures *away* from their optimal color

8 Posts
• Page 1 of 1
Ticket details
- Ticket ID: 596
- Project: Shandalar
- Status: Fix completed
- Component: Duel Engine
- Project version: Ruined Tower 2
- Priority: Normal
- Severity: Major
- Assigned to: Korath
- Reported by: jiansonz
- Reporter's tickets: List all tickets
- Reported on: 02 Jun 2015, 09:21
- Last visited by Korath » 30 Oct 2016, 14:48.