Skip to content

Godot Engine Troubleshooting

ScyDev edited this page Feb 3, 2015 · 13 revisions

Until there is a public Godot wiki that can be edited by the community I'll use this here temporary wiki to collect hints, do and don't, caveats.

As time passes, they may get fixed. If so, please edit this page :)

Finding the cause for game crashes or freezes

When using GD Script extensively, you will probably have lots of crashes until you know what works and what you are not allowed to do. Unfortunately, Godot will often just stop and return to the editor without giving a reason for the crash.

If you've reached that point, you should switch to running you game through gdb so you can always see the exact line where an erorr hapens. Saves tons of time!

Copied this short HOW TO from (http://www.godotengine.org/forum/viewtopic.php?f=11&t=570):

$ gdb ~/godot/bin/godot
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
...
Reading symbols from /home/robert/code/godot/godot/bin/godot...done.

(gdb) run -d /path/to/main/scene.xml
Starting program: godot/bin/godot -d /path/to/main/scene.xml
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
opening pack /home/robert/code/godot/godot/bin/godot, -1, -1
opening pack /home/robert/code/rshmup/data.pck, -1, -1
[New Thread 0xb043fb70 (LWP 23411)]
[New Thread 0xafc3eb70 (LWP 23412)]
[New Thread 0xafbfdb70 (LWP 23413)]
<<Debug Output>>
Program received signal SIGSEGV, Segmentation fault.
0xb78b4540 in __dynamic_cast () from /usr/lib/i386-linux-gnu/libstdc++.so.6

(gdb) backtrace
<<Listing of stack frames from top (where error occurred, more or less) to bottom (usually the main / idle loop) >>

(gdb) backtrace full
<<Listing of stack frames as before, but with local variable values populated. In Godot's case this can potentially show you the script line where the error occurred.>>

yield() crashes game

The yield() function of Godot seems to be very unstable. On at least 5 different occasions (separate pieces of code) the use of something like

var playingAnim = yield(explosion.get_node("AnimationPlayer"), "finished")

in a game with lots of interacting objects led to reproducable crashes.

Check this if your game crashes for no reason. Disable all calls to yield() and see if the crash still happens.

Using print() for debug messages

Start Godot from command line with "godot -d" in order to see all print() output. The "Output" window in the editor does not always capture all of the output, which can be very confusing and misleading.

https://github.com/okamstudio/godot/issues/1287

Playing Sounds in AnimationPlayer

  • When working with a play track (playing a sound on a SamplePlayer by keyframe) make sure to use discrete mode instead of continuous, or your sound sample will be triggered every step of the animation.

3D Physics on RigidBody

  • If using self.set_linear_velocity(vel) on a Rigid Body in its _fixed_process(), this overrides other physical forces like gravity.

  • self.set_linear_velocity(vel) must be called in _fixed_process() right from the start when the script beginns running. If not, then physics seem to be suspended for that object and set_linear_velocity() shows no effect. So it can't have an if that tests negative when the script starts, for example. If you bump into that object with another object that you can control, then suddenly physics are working again and set_linear_velocity() shows an effect.

Using PolygonPathFinder

If you'd like to use PolgonPathFinder from code, this PolygonPathFinder-Demo-GD-Script should help you get started.

Inexplicable game crash on function call

See this issue: https://github.com/okamstudio/godot/issues/1040

Maybe this helps you prevent a crash that makes no sense.

Suddenly no print() output in the console

Happens when printing inside a loop. If it's an endless loop or just very many iterations, all the print() calls inside the loop will never show.

(prior guess: Godot seems to have some kind of maximal output buffer and if you print more than it can hold, nothing is displayed on the console at all.)

** Debug Process Started ** ** Debug Process Stopped **

This happens easily when printing messages in nested loops.

Recursive references

Watch out for recursive references in your arrays or directories. This will lead to your game crashing when issuing such a var to print().

Clone this wiki locally