Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement live reloading in GDExtension #4437

Closed
Tracked by #66231
Moneyl opened this issue Apr 24, 2022 · 5 comments
Closed
Tracked by #66231

Implement live reloading in GDExtension #4437

Moneyl opened this issue Apr 24, 2022 · 5 comments
Milestone

Comments

@Moneyl
Copy link

Moneyl commented Apr 24, 2022

Describe the project you are working on

Working on a GDExtension binding for BeefLang.

Describe the problem or limitation you are having in your project

As far I can tell GDExtension DLLs can only be reloaded by restarting the editor, or making a copy of the DLL and editing the .gdextension file to point to it (not sure if the latter unloads the original DLL). While restarting the editor doesn't take long, it adds up over time. Imagine developing a large extension and having to restart 100s or 1000s of times. In general I think any improvements on iteration time are invaluable in game dev.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Automatically reload extension DLLs when changes to them are detected.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Windows locks native DLLs on load. A common way plugin systems get around this is to make a copy of the DLL and load that, then watch the original for changes to detect recompilation. I'm not very familiar with Godots codebase though, so I don't know if there are other complications with implementing this.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I could add a post compile script for my DLL that copies it to the extension directory with a unique name then edits the .gdextension file to point to it (the workaround I mentioned above). Kinda hacky though.

Is there a reason why this should be core and not an add-on in the asset library?

This would improve iteration time of GDExtension significantly and shouldn't interfere with other features.

@Calinou
Copy link
Member

Calinou commented Apr 24, 2022

Live reloading is a complicated thing to implement, especially when native libraries are involved. Live++ is one of the most popular solutions out there, but it's proprietary. There don't seem to be any actively developed open source alternatives to Live++.

@nonunknown
Copy link

nonunknown commented Apr 24, 2022

related to: godotengine/godot-cpp#638

@Calinou I was looking for this some days ago and found this: https://github.com/3DExtended/HotReload

@ghostbutter-games
Copy link

Maybe this is of interest, Casey Muratori shows how to do Hot Reload in C/C++ in this early Handmade Hero stream: https://hero.handmade.network/episode/code/day022/#208

Not a one-stop solution like Live++ appears to be but it shows the basic approach.

@Calinou Calinou changed the title GDExtension live reload Implement live reloading in GDExtension Apr 24, 2022
@amyhaber
Copy link

Just see the live++ in Unreal Engine, it's totally a mess.

@MJacred
Copy link

MJacred commented Jan 22, 2024

Hot Reload was implemented in godotengine/godot#80284 / godotengine/godot-cpp#1200.

So this can be closed

@AThousandShips AThousandShips added this to the 4.2 milestone Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants