w84death / Tanks-of-Freedom

Indie Turn Based Strategy in Isometric Pixel Art
http://tof.p1x.in
Other
1.14k stars 151 forks source link

AI turn never ending #16

Closed nmaggioni closed 6 years ago

nmaggioni commented 9 years ago

The screen says "CPU Turn" and the progress bar is stuck at the first segment. It's been more than 10 minutes and the animations are still playing, but the game makes no progress whatsoever. Looking at the console output is seems to be looping on these errors:

ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
   At: scene/main/node.cpp:1747.
ERROR: remove_child: Condition ' idx==-1 ' is true.
   At: scene/main/node.cpp:729.
ERROR: remove_child: Condition ' idx==-1 ' is true.
   At: scene/main/node.cpp:729.
ERROR: add_child: Condition ' p_child->data.parent ' is true.
   At: scene/main/node.cpp:666.
ERROR: move_child: Condition ' p_child->data.parent!=this ' is true.
   At: scene/main/node.cpp:257.
ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
   At: scene/main/node.cpp:1747.

I'm playing the 3rd mission, if that can be useful.

schermata da 2015-10-02 13-04-02

czlowiekimadlo commented 9 years ago

Hi nmaggioni, thank you for your report. We are aware of this issue. The AI is repeatedly trying to perform invalid move order, and it locks it down.

Until we fix this, there is a workaround: you have to go to skirmish menu, select any map, change opponent to Human. Then, instead of starting new match, go back to campaign and it will be unstuck. Then repeat it again to switch the opponent back to CPU.

muelli commented 8 years ago

I get a slightly different log output, but similar enough for me to attach it to this bug:

I/godot   ( 4505): FPS: 4
I/godot   ( 4505): ERROR: remove_child: Condition ' idx==-1 ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:729.
I/godot   ( 4505): ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:1747.
I/godot   ( 4505): FPS: 11
I/godot   ( 4505): FPS: 3
I/godot   ( 4505): FPS: 4
I/godot   ( 4505): ERROR: remove_child: Condition ' idx==-1 ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:729.
I/godot   ( 4505): ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:1747.
I/godot   ( 4505): FPS: 11
I/godot   ( 4505): FPS: 4
I/godot   ( 4505): FPS: 4
I/godot   ( 4505): ERROR: remove_child: Condition ' idx==-1 ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:729.
I/godot   ( 4505): ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:1747.
I/godot   ( 4505): FPS: 11
I/godot   ( 4505): FPS: 3
I/godot   ( 4505): FPS: 3
I/godot   ( 4505): ERROR: remove_child: Condition ' idx==-1 ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:729.
I/godot   ( 4505): ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:1747.
I/godot   ( 4505): FPS: 14
I/godot   ( 4505): FPS: 4
I/godot   ( 4505): ERROR: remove_child: Condition ' idx==-1 ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:729.
I/godot   ( 4505): ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:1747.
I/godot   ( 4505): FPS: 14
I/godot   ( 4505): FPS: 3
I/godot   ( 4505): FPS: 5
I/godot   ( 4505): ERROR: remove_child: Condition ' idx==-1 ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:729.
I/godot   ( 4505): ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:1747.
I/godot   ( 4505): FPS: 12
I/godot   ( 4505): FPS: 3
I/godot   ( 4505): ERROR: remove_child: Condition ' idx==-1 ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:729.
I/godot   ( 4505): FPS: 11
I/godot   ( 4505): ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:1747.
I/godot   ( 4505): FPS: 7
I/godot   ( 4505): FPS: 4
I/godot   ( 4505): ERROR: remove_child: Condition ' idx==-1 ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:729.
I/godot   ( 4505): ERROR: queue_delete: Condition ' !is_inside_tree() ' is true.
I/godot   ( 4505):    At: scene/main/node.cpp:1747.
I/godot   ( 4505): FPS: 13
czlowiekimadlo commented 8 years ago

We have released new update, that should resolve AI freezing issues. We will perform more tests before I close this ticket.

As for the console output, these errors are caused by the nodes tree trying to remove a child, that is no longer there (like removing some menu panel every time we want to clear the screen, even if it is not visible and not there). It is not connected with AI issues. We might come around and fix that at some point, but it is a low priority, as it appears to not impact the game in any way.

sviscapi commented 8 years ago

Hi :)

Your latest 0.4.0.2-beta still suffers from that bug, at least on the Open Pandora port:

https://pyra-handheld.com/boards/threads/tanks-of-freedom-0-4-0-3.75668/page-2#post-1363666

Cheers, Sam a.k.a "Magic Sam" on the boards ;)

czlowiekimadlo commented 8 years ago

Yeah, we know. We have found another, potential cause for this and patched it, so we will make 0.4.0.3-beta today.

czlowiekimadlo commented 8 years ago

OK, so I've been able to reproduce this once, but then it kind of dissapeared when I added some debug. I will try to catch it again.

czlowiekimadlo commented 8 years ago

Can't reproduce it on current code, but can on 0.4.0.2 tag, so maybe I had older code when I tried.

jkufner commented 8 years ago

When AI performs an invalid turn, it should remove some high amount of action points. Then turn will end sooner or later and game can continue. Of course, such event should be logged and fixed, but it will not break the game (execept AI will loose a turn).