Giter Site home page Giter Site logo

Comments (3)

geekrelief avatar geekrelief commented on August 15, 2024

I've made some progress on this, but I'm a bit stuck. Basically, I have a loader module that is imported by stub.nim. The Loader spawns a thread that monitors the modification time on a helper dll. If the modification time is newer it unloads the old dll and loads the new dll. After loading the helper dll, I call its godot_gdnative_init and godot_nativescript_init to initialize things.

I've made the necessary modifications to the bindings and stub to get print working (I get output in the editor console), but when I try loading a module with a class created from gdobj (e.g. mainpanel.nim) in the helper an exception occurs when calling godot_nativescript_init.

I can't really think of another way to debug this unless I modify the generated c files from the godot-nim bindings to bisect the issue. Any clue what might be going on? Is there an easier way to debug this?

from godot-nim.

geekrelief avatar geekrelief commented on August 15, 2024

I got hot reloading working by using gdns as resources. It requires a modification to the Godot engine which I reference here: godotengine/godot#42449 (comment) The basic idea is that we need a Watcher node monitoring a Component. The component has two dlls: one is the safe dll and the other the hot dll. The hot dll is referenced in a gdns file as a sub resource so we're free to compile to the safe dll. In my scene the Watcher node checks the modification times of the Component's dlls and if the safe is newer than hot, destroys references to the Component. This triggers NativeScript for the Component to destruct engine side. The engine modification ensures that in NativeScriptLanguage::unregister_script, if no script is referencing the hot dll, the hot dll is terminated which releases the file lock on it. In the Watcher we can then write over the hot dll. And then we can go further by saving data before the reload, and restoring it after.

from godot-nim.

geekrelief avatar geekrelief commented on August 15, 2024

@endragor If you're interested I have a working framework for hot dll reloading. https://github.com/geekrelief/gdnim Not sure how feasible this is to integrate with godot-nim / godot-nim-stub because it relies on an engine modification, but I figured I'd share in case you're interested. So far I've only written some small components with it, but I don't see why it wouldn't scale.

from godot-nim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.