Title: Enemy deck is not visually consistent
Author: Jeremy Cahill
Posted on: July 10, 2026
Part 1 - The Problem:
This week I ran into a visual and logic bug where the enemy deck does not reliably show the front of its card during rounds. When the player clicks their card, the correct enemy card is usually selected and the round result text shows the right IDs, but the enemy card on the table stays face down in about 20 percent of the rounds. From a user’s perspective that makes it look like the enemy is not playing a card and it breaks the feeling of a fair War game even though the compare logic is mostly working. Joyce, my teammate, also pointed out that the cards might be spawning or revealing in reverse order, which could contribute to the confusion. On top of that, the War condition only triggers sometimes when ranks match, so edge cases in the round logic still need more work.
Part 2 - The Solution:
I started by tightening the debug output around the round flow and the reveal function so I could see exactly which player and enemy card IDs were being used every click. The logs confirmed that RevealCard() was being called for both cards most of the time and that the enemy card’s sprite was being set, which means the bug is tied to how sprites are mapped to IDs or how the enemy deck orders its cards. I updated RevealCard() to validate indices and use the card ID modulo the sprite count, then added checks for empty sprite arrays so I can catch any cases where the enemy deck is missing visual data.
To improve consistency, I added a simple configuration flag on the deck actor that controls whether a deck starts face up or face down and applied that to the enemy deck when spawning its cards. The GameMode still drives the round flow by taking the clicked player card, selecting the top enemy card, revealing both, comparing their ranks, and starting a short timer before cleaning up the table. With these changes the enemy card now flips correctly in the majority of rounds and the War outcome text is visible when ties happen, but there are still intermittent cases where ordering or tie detection does not behave as expected. My next step is to step through the deck arrays during play and verify the exact order of card IDs so I can fully fix the remaining 20 percent of rounds that still feel wrong to the player.
