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

[PROPOSAL] Write reload logic in cpp #257

Closed
chippmann opened this issue Jul 29, 2021 · 8 comments · Fixed by #621
Closed

[PROPOSAL] Write reload logic in cpp #257

chippmann opened this issue Jul 29, 2021 · 8 comments · Fixed by #621
Labels
enhancement New feature or request topic:core

Comments

@chippmann
Copy link
Contributor

Currently we have the bootstrap class which handles file system changes and reloads classes accordingly.
It basically is the sole reason why we have to ship the godot-bootstrap.jar alongside the engine executable.

I propose that we implement this filewatching and reloading logic completely in cpp. Looking at the impl of some other cpp filewatching libs (like https://github.com/apetrone/simplefilewatcher/) we should be able to to this kind of filewatching ourselves pretty easily as well even if we have to implement it platform specific. Maybe even godot has some platform independent way of watching filesystem changes.

Also now that we use a buildLock file instead of watching the build dir directly, the file watching logic is greatly simplified.
So we would in fact only need to watch one file which further simplifies things a lot.

This would pave the way for better/simpler editor builds and would completely remove the need for two jar files as we could pack everything into one jar. Which would also simplify export targets like android a lot.

@chippmann chippmann added enhancement New feature or request topic:core labels Jul 29, 2021
@piiertho
Copy link
Member

I agree on this one. But for me we should rely on engine implementation and avoid creating our own FileAccess.

@chippmann
Copy link
Contributor Author

But does godot have a file watching functionality?
I'd rather not have some kind of service routine that periodically polls for changes. This creates unnecessary load on the system.

@raniejade
Copy link
Contributor

I back this, although I advise against using a third party library - hopefully godot provide something in a platform agnostic way. This exist https://docs.godotengine.org/en/stable/classes/class_editorfilesystem.html - although I'm not sure if it will serve our requirement.

@chippmann
Copy link
Contributor Author

I definitely agree. I wouldn't want a third party lib for this. This was just an implementation example if we have to do it ourselves in the end

@chippmann
Copy link
Contributor Author

chippmann commented Jul 29, 2021

I back this, although I advise against using a third party library - hopefully godot provide something in a platform agnostic way. This exist https://docs.godotengine.org/en/stable/classes/class_editorfilesystem.html - although I'm not sure if it will serve our requirement.

I don't think we can use this. As our buildLock file is not a imported resource. It resides in the tmp dir. Also i would not change this. I think this is a far more stable location than the project dir

@chippmann
Copy link
Contributor Author

It looks to me that C# is using a timer node for this: https://github.com/godotengine/godot/blob/8f7f5846397297fff6e8a08f89bc60ce658699cc/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs

Searching the godot source didn't yield in any watching functionality so far.

@CedNaru
Copy link
Member

CedNaru commented Jul 29, 2021

I'm pretty sure that Godot got some thread running in the editor to check if a file in the project was changed recently:
https://github.com/godotengine/godot/blob/d5bd8a704f096043174af7994ef3de055a36cf45/editor/editor_file_system.cpp#L209.
Need to investigate that more in details.

@chippmann chippmann self-assigned this Sep 3, 2021
@chippmann chippmann mentioned this issue Sep 8, 2021
@chippmann
Copy link
Contributor Author

This issue is postponed until https://github.com/utopia-rise/godot-kotlin-jvm/milestone/9 is done

@chippmann chippmann removed their assignment Mar 7, 2023
@CedNaru CedNaru linked a pull request Oct 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic:core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants