godotengine / godot

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

Crash when opening project converted from Godot 3.5.2 #80898

Open SeanRamey opened 1 year ago

SeanRamey commented 1 year ago

Godot version

4.1.1

System information

Godot v4.1.1.stable unknown - EndeavourOS #1 SMP PREEMPT_DYNAMIC Wed, 19 Jul 2023 19:19:38 +0000 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 1070 (nvidia; 535.86.05) - Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (6 Threads)

Issue description

After automatically converting my project to godot 4.1.1, it crashes upon trying to open the project. It seems something specific with this project, but I don't know what.

This is what the terminal spits out when I try to open it:

Vulkan API 1.3.242 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1070

WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
     at: _editor_init (modules/gltf/register_types.cpp:73)
ERROR: Condition "!preset.is_valid()" is true. Continuing.
   at: load_config (editor/export/editor_export.cpp:242)
SCRIPT ERROR: Parse Error: Member "velocity" redefined (original in native class 'CharacterBody2D')
          at: GDScript::reload (res://Enemies/av-stopper.gd:4)
ERROR: Cannot create tile. The tile is outside the texture or tiles are already present in the space the tile would cover.
   at: create_tile (scene/resources/tile_set.cpp:4138)
ERROR: The TileSetAtlasSource atlas has no tile at (0, 16).
   at: get_tile_data (scene/resources/tile_set.cpp:4540)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.1.1.stable.arch_linux
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x39ab0) [0x7fa179162ab0] (??:0)
[2] godot(+0x3cb60ff) [0x564649a470ff] (??:?)
[3] godot(+0x3cc94d9) [0x564649a5a4d9] (??:?)
[4] godot(+0x3ccdf90) [0x564649a5ef90] (??:?)
[5] godot(+0x4c080bb) [0x56464a9990bb] (??:?)
[6] godot(+0x3b39d86) [0x5646498cad86] (??:?)
[7] godot(+0x3b3cfe0) [0x5646498cdfe0] (??:?)
[8] godot(+0x492482a) [0x56464a6b582a] (??:?)
[9] godot(+0x492bc83) [0x56464a6bcc83] (??:?)
[10] godot(+0x4971b81) [0x56464a702b81] (??:?)
[11] godot(+0x49729a8) [0x56464a7039a8] (??:?)
[12] godot(+0x4f1a7cd) [0x56464acab7cd] (??:?)
[13] godot(+0x1ff93d3) [0x564647d8a3d3] (??:?)
[14] godot(+0x4cd9461) [0x56464aa6a461] (??:?)
[15] godot(+0x1eede40) [0x564647c7ee40] (??:?)
[16] godot(+0x4b94e38) [0x56464a925e38] (??:?)
[17] godot(+0x306a41c) [0x564648dfb41c] (??:?)
[18] godot(+0x30afabd) [0x564648e40abd] (??:?)
[19] godot(+0x30b7717) [0x564648e48717] (??:?)
[20] godot(+0x11da0c7) [0x564646f6b0c7] (??:?)
[21] godot(+0x11758d5) [0x564646f068d5] (??:?)
[22] /usr/lib/libc.so.6(+0x23850) [0x7fa17914c850] (??:0)
[23] /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x7fa17914c90a] (??:0)
[24] godot(+0x11843e5) [0x564646f153e5] (??:?)
-- END OF BACKTRACE --
================================================================
Aborted (core dumped)

Steps to reproduce

The included project files have already been converted, so just open it up in godot 4.1.1 and watch it crash.

Minimal reproduction project

Total-mal.zip

HolonProduction commented 1 year ago

The crash happens here: https://github.com/godotengine/godot/blob/6758a7f8c07d1f4c8ec4f052ded6d26402967ebe/scene/resources/tile_set.cpp#L5213-L5217 Seems the method is called on a nullpointer during the execution of _compatibility_conversion.

Could you provide the original project as well?

SeanRamey commented 1 year ago

Anti-malfunction-wont-convert.zip

These are the project files before conversion. I used the Full Conversion option when attempting to convert.

HolonProduction commented 1 year ago

The crash results from the region used for your tileset. (The one that is internally stored in main menu.tscn). There the texture region is larger than the texture. Due to the rewrite of the tileset system this crashes in godot 4, because no tile data can exist outside the texture in the new implementation. The large region does not seem to fullfill any purpose and looks like an accident to me, so you should be able to startup godot after setting the region to the texture size. (You will still need to do some work to fixup your tilemap e.g. the tilesize will default back to 16 in Godot 4. But this is beyond the scope of this issue.)

Not sure whether we need actual code changes here. Maybe tile sources could crop their region to the texture size on conversion. This would still break the tileset but would atleast prevent a crash which seems like a better user experience. But the case seems very rare so it might not be worth the extra code.