godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.14k stars 20.21k forks source link

Crash/Error when running scene with CharacterBody3D + template script (Basic Movement) #60042

Closed novemberist closed 2 years ago

novemberist commented 2 years ago

Godot version

Godot 4.0 dev, commit #59324

System information

Fedora Linux 36 Beta, Vulkan, Gnome 42 (Wayland), Radeon RX580 (Mesa 22)

Issue description

Hello, whenever I try to run a project/scene that contains a CharacterBody3D with the Basic Movement template script attached (unmodified), the game window does only show the splash screen and the terminal reports that Godot has crashed.

grafik

The Debugger doesn't report anything. If I stop the game (F8) I can continue using the editor, so I guess the editor didn't crash but only the running game.

If I use another template or empty script, the game runs normally.

Terminal output:


Running: /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64 --path /home/alex/CharacterController --remote-debug tcp://127.0.0.1:6007 --allow_focus_steal_pid 16797 --position 448,240 res://node_3d.tscn
Godot Engine v4.0.alpha.custom_build.bf153b82c - https://godotengine.org
Vulkan API 1.2.0 - Using Vulkan Device #0: AMD - AMD RADV POLARIS10

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.alpha.custom_build (bf153b82c73755bf898df9de33ac2116ebe914b9)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x42ac0) [0x7f4a2f7aeac0] (??:0)
[2] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x3da1c05] (/home/alex/Downloads/github/godot/core/object/object.cpp:467)
[3] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x3deee3b] (/home/alex/Downloads/github/godot/./core/string/string_name.h:167)
[4] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x1bb1dd6] (/home/alex/Downloads/github/godot/./core/variant/binder_common.h:705)
[5] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x16ce924] (/home/alex/Downloads/github/godot/modules/gdscript/gdscript_vm.cpp:1742 (discriminator 2))
[6] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x44198ba] (/home/alex/Downloads/github/godot/./core/variant/variant.h:266)
[7] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x15c4f48] (/home/alex/Downloads/github/godot/modules/gdscript/gdscript.cpp:158)
[8] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x15c920f] (/home/alex/Downloads/github/godot/modules/gdscript/gdscript.cpp:391)
[9] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x3daa4d2] (/home/alex/Downloads/github/godot/core/object/object.cpp:904)
[10] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x3dabc28] (/home/alex/Downloads/github/godot/core/object/object.cpp:414)
[11] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x2f03452] (/home/alex/Downloads/github/godot/./core/templates/list.h:262)
[12] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0x2f04e8a] (/home/alex/Downloads/github/godot/scene/resources/packed_scene.cpp:1624)
[13] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0xddca5c] (/home/alex/Downloads/github/godot/main/main.cpp:2547)
[14] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0xd59892] (/home/alex/Downloads/github/godot/platform/linuxbsd/godot_linuxbsd.cpp:67)
[15] /lib64/libc.so.6(+0x2d590) [0x7f4a2f799590] (??:0)
[16] /lib64/libc.so.6(__libc_start_main+0x89) [0x7f4a2f799649] (??:0)
[17] /home/alex/Downloads/github/godot/bin/godot.linuxbsd.opt.tools.64() [0xd64fa5] (??:?)
-- END OF BACKTRACE --

Steps to reproduce

  1. Create a new Project with a new Scene
  2. Add a CharacterBody3D to your Scene
  3. Attach a Script > under "Template" select CharacterBody3D: Basic Movement
  4. Run the Scene/Project

This happens with or without a Camera Node present in the Scene, so for the sake of a minimal example, I didn't add one here

Minimal reproduction project

No response

novemberist commented 2 years ago

edit after some testing the problem seems to be this declaration:

var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")

If i exchange it for something like var gravity = 9.8 the game runs as expected, and so does the script

In fact any call of ProjectSettings.get_setting() within the script leads to the game not running.

Calinou commented 2 years ago

Does it crash in 4.0alpha5 and 4.0alpha6? If so, this could be the same cause as https://github.com/godotengine/godot-demo-projects/pull/713#issuecomment-1093322395.

novemberist commented 2 years ago

@Calinou It doesn't crash in any of the alpha builds (including 5 and 6). The cause of the crash is definitely the call of ProjectSettings.get_setting() in the template script, though

This might also be the reason why the demo crashes that you have linked, because the scripts also contain several calls to ProjectSettings.get_setting()

novemberist commented 2 years ago

@akien-mga Maybe the revert of https://github.com/godotengine/godot/pull/57972 may have caused this issue?

novemberist commented 2 years ago

I cannot reproduce this anymore with the latest build (eb6ebdc4aff88de8da4217dfe1c4f226a1fd2132) for some reason. Sorry, there may have been something on my side causing this issue, since none of the latest commits seem to have anything to do with this issue specifically.

BraqueDown commented 2 years ago

Was it related to this? https://github.com/godotengine/godot/issues/59971

novemberist commented 2 years ago

I don't think so. I'm pretty sure it was related to a call to ProjectSettings.get_setting().

novemberist commented 2 years ago

Closing this, since I can not reproduce anymore. I will open a new and more precise issue in case I run into this or a similar issue again.