It is currently 19 Apr 2024, 01:51
   
Text Size

AI: Couldn't find card in fromZone (Hand)

Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins

AI: Couldn't find card in fromZone (Hand)

Postby ShivaFang » 31 Jul 2016, 16:26

I've started getting this warning repeatedly recently in my Monte Carlo AI when it simulates games. I have the nodes rebuild playable cards in hand each time and the AI was working without it. I'm not entirely sure what I did that caused this.

Is there any way to get a stack trace on it? It keeps popping up as a warning with absolutely no other information I can use.

This warning also seems to correspond with huge spikes in memory use (although that could be normal since Monte Carlo simulates many many games and creates nodes to remember results) it 'feels' like I get bigger spikes when this warning appears than when it doesn't, which is why I'm concerned about resolving it.
ShivaFang
 
Posts: 101
Joined: 25 Jun 2016, 01:15
Has thanked: 26 times
Been thanked: 3 times

Re: AI: Couldn't find card in fromZone (Hand)

Postby LevelX » 31 Jul 2016, 21:19

Is this the exact test of the message?
I can't find such a text in the source code.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: AI: Couldn't find card in fromZone (Hand)

Postby ShivaFang » 31 Jul 2016, 23:56

I'm sorry, the exact message looks more like this;
Code: Select all
WARN  2016-07-31 17:52:39,728 Couldn't find card in fromZone, card=Anticipate [1b7], fromZone=HAND                       =>[GAME 49ba96a9-6439-47fe-a24e-c5072b9b7d5b] CardImpl.removeFromZone
the card name changes each time.

I suspect the warning is happening because the AI is trying to play a card that it doesn't actually have in hand (it simulates many games and each card it might play is one potential action.) The only time that really should be happening is if the opponent forces a discard, but it happens even when the opponent has nothing like that in their deck. And even then my nodes are 'rebuilding' the nodes available to play each time to account for something like that. This is why I would like a stack trace to try and figure it out.

Also, it used to work fine without the error messages. These just suddenly started happening.
ShivaFang
 
Posts: 101
Joined: 25 Jun 2016, 01:15
Has thanked: 26 times
Been thanked: 3 times

Re: AI: Couldn't find card in fromZone (Hand)

Postby LevelX » 01 Aug 2016, 08:19

I would set a breakpoint to CardImpl->removeFromZone Line 558 to get at least a stack trace, when this happens. From this you can analyze more deeply, why this is happening.

Should be something like having not the correct game object in the context of AI simulation at that time, so the hand card the AI tries to play is not in hand.
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times

Re: AI: Couldn't find card in fromZone (Hand)

Postby ShivaFang » 02 Aug 2016, 14:44

LevelX wrote:I would set a breakpoint to CardImpl->removeFromZone Line 558 to get at least a stack trace, when this happens. From this you can analyze more deeply, why this is happening.

Should be something like having not the correct game object in the context of AI simulation at that time, so the hand card the AI tries to play is not in hand.
How would I do that on already compiled code? Or do I have to compile the whole source in order to do that?
ShivaFang
 
Posts: 101
Joined: 25 Jun 2016, 01:15
Has thanked: 26 times
Been thanked: 3 times

Re: AI: Couldn't find card in fromZone (Hand)

Postby LevelX » 02 Aug 2016, 20:43

Start the server from Netbeans in Debug mode.
Set the line breakpoint to the mentioned line.

As the server execution stops at that line you can look at the call stack and all variables you like.

It's just the common debugging.

LineBreakpoint.jpg
User avatar
LevelX
DEVELOPER
 
Posts: 1677
Joined: 08 Dec 2011, 15:08
Has thanked: 174 times
Been thanked: 374 times


Return to Developers Talk

Who is online

Users browsing this forum: No registered users and 11 guests

cron

Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 11 guests

Login Form