nlaha / godot-midi

MIDI file parsing and event playback in Godot 4.2+
MIT License
71 stars 7 forks source link

Demo Compatibility with Godot 4.2 #13

Closed xanmankey closed 8 months ago

xanmankey commented 8 months ago

Hi! I had an idea for a rhythm game utilizing midi and just started development, so this library is an incredible gem! I'm running Godot 4.2 and when I ran the demo game, it crashed on trying to run the project. I changed a couple things so it doesn't crash for 4.2, I haven't tested these changes on any other version. I'm not quite sure why it was crashing, perhaps it was Godot versioning when the project was updated?

Either way, thanks for the incredible library, can't wait to start using it!

TheRedstoneScientist commented 8 months ago

I keep getting these errors: E 0:00:00:0899 _register_extension_class_internal: Attempt to register extension class 'MidiParser', which appears to be already registered. <C++ Error> Condition "ClassDB::class_exists(class_name)" is true. <C++ Source> core/extension/gdextension.cpp:386 @ _register_extension_class_internal() E 0:00:00:0899 _register_extension_class_internal: Attempt to register extension class 'MidiResource', which appears to be already registered. <C++ Error> Condition "ClassDB::class_exists(class_name)" is true. <C++ Source> core/extension/gdextension.cpp:386 @ _register_extension_class_internal() E 0:00:00:0899 _register_extension_class_internal: Attempt to register extension class 'MidiPlayer', which appears to be already registered. <C++ Error> Condition "ClassDB::class_exists(class_name)" is true. <C++ Source> core/extension/gdextension.cpp:386 @ _register_extension_class_internal()

Everything else seems to be fine but I can't get any visualization to work.

xanmankey commented 8 months ago

Ok so clearly I don't have a good enough understanding of the internals of the Godot engine; I'll take a closer look when I get a chance later this evening, but when I recloned the repository it broke in the same way regardless of the changes I made (even though the changes make the original demo project work).

xanmankey commented 8 months ago

I wonder if it has to do with the order in which things are imported or possibly the way plugins are loaded? Let me know if you figure anything out, I'll test with Godot 4.2 later tonight (not sure which version you're on)

xanmankey commented 8 months ago

I deleted my .godot folder for the working project out of curiosity, and now Godot is throwing

Can't open dynamic library: /home/xanmankey/Programming/Game/godot-midi/game/addons/godot_midi/bin/libgdgodotmidi.linux.template_debug.x86_64.so. Error: /opt/godot/../lib/libgdgodotmidi.linux.template_debug.x86_64.so: cannot open shared object file: No such file or directory.
  core/extension/gdextension.cpp:719 - GDExtension dynamic library not found: /home/xanmankey/Programming/Game/godot-midi/game/addons/godot_midi/bin/libgdgodotmidi.linux.template_debug.x86_64.so
  Failed loading resource: res://addons/godot_midi/godotmidi.gdextension. Make sure resources have been imported by opening the project in the editor at least once.

I'm not sure why exactly this would be the case, but for some reason on loading the project.godot file in the repository, the imports weren't working for me and custom node types weren't parsing. I thought if I imported them and set the playback files by default, then the demo would be a little nicer, but I think some of the configuration ended up being in .godot and thus ignored which may be causing that error.

Still not sure why the initial import of the project file isn't working without configuration though.

nlaha commented 8 months ago

Merged, thanks!

xanmankey commented 8 months ago

I just learned that the /bin folder with the built binaries isn't included in the game project folder which is causing parsing errors regarding the custom node types and preventing the import plugin from running (it's line 3 of the .gitignore). Unfortunately even with the earlier changes you still have to relink things in the editor to get things to work and build these; if I copied them over though it worked straight away, so perhaps including that folder would let the demo work right out of the gate?

xanmankey commented 8 months ago

I'll test it out in my fork and open a pull request for it if it works and let you decide from there