w84death / Tanks-of-Freedom

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

Seg Fault when enemy can't produce any troop/tanks #106

Open gurditsbedi opened 5 years ago

gurditsbedi commented 5 years ago

version: ToF_Beta_0.7.0_linux64 execution using: ./ToF_Beta_0.7.0_linux64.bin

got the following output

Boot splash path: res://assets/splash_screen.png
Loaded certs from 'res://assets/dst.crt':  1
ToF: map file user://restore_map.map not exists!
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
ERROR: get_node: Condition ' !node ' is true. returned: __null
   At: scene/main/node.cpp:907.
Segmentation fault (core dumped)

In campaign mode, map peninsula.

I put a tank in every troop/tank spawn point i.e. infront of HQ, barracks and factory. I end my turn. And it is CPU turn now. after 1 sec their is segfault.

possible reason from my point of view: enemy unable to create any troop/tank.

czlowiekimadlo commented 5 years ago

Interesting. I have done this strategy multiple times on all campaign maps and never encountered an error. I'll try reproducing this with the release version.

gurditsbedi commented 5 years ago

order of putting tanks:

  1. In front of factory
  2. In front of barracks
  3. In front of HQ after which an in-game dialog appears and it crashes to seg fault
gurditsbedi commented 5 years ago

I have more observation.

There are many times when the game closes while its running (only in campaign mode), the issue is am not seeing any pattern.

It gives segmentation fault.

teeks99 commented 5 years ago

I'm also seeing seg faults in ToF_Beta_0.7.0_linux64. I haven't been able to narrow it down to any specific action. I also see the repeated

ERROR: get_node: Condition ' !node ' is true. returned: __null                                                          
   At: scene/main/node.cpp:907.     

but I'm not sure if that is related, because I also see that at other times.

Any info on generating a debug version and catching the segfault?

teeks99 commented 5 years ago

If it is helpful, I was able to capture the core dump, I'll leave it out here for a short-ish amount of time: http://jimbo.teeks99.com/tmp/core-ToF_Beta_0.7.0_.14833.lisa.1551660197

teeks99 commented 5 years ago

Running the source inside of the Godot engine seemed to have an issue at move_hand.gd:15: Invalid get index 'position_on_map' (on base: 'previously freed instance').

czlowiekimadlo commented 5 years ago

Ah, this issue again. Thank you for your help! This one is very tricky, as it may show up (or not) depending on the performance of the device and order of execution of some code. Would explain why I very rarely get it on my PC. Re-write of the whole AI had minimizing this specific issue in mind, as one of the goals. This stems from flaws that go deep in the code, and the architecture of the game as a whole. It's one of the reasons I consider starting whole new ToF project on Godot 3.1 (with backwards compatibility) instead of porting current codebase. As for why this issue occures, it might be, because some unit dies, and it's queue_free() gets delayed, so next AI loop picks up this unit, but it dissapears during the loop, when it should not have been considered from the get go. Very nasty thing to debug and fix, as Godot has very poor support for detecting if a particular variable references some memory, that has been freed.