Repository navigation
Introducing cleo modules - #101
Conversation
Figured out using plugin_sdk classes in project.
|
Another interesting idea would be to make hot reload for active modules. If you recompile the module you can "reload" it without restarting the game. This way you can continue testing the code. Reload can be done either by watching file changes on disk (this is how CLEO Redux does it), or by having a global hotkey to reload modules at any time. Note that such hotkey may potentially conflict with existing scripts. Thoughts? |
|
I created "reload" function but how to make it working? |
|
Alright, I was thinking about a simple case where the script just sits idle in the main scope. If the script is currently running in the module scope, doing hot reload could be problematic. |
|
We can have a usage counter for modules. Increment by 1 in |
Implemented. How you want to trigger this? |
| { | ||
| // query files once a second | ||
| for(size_t i = 0; i < 100 && updateActive; i++) | ||
| std::this_thread::sleep_for(std::chrono::milliseconds(10)); |
There was a problem hiding this comment.
why don't we sleep for 1000 ms once instead?
There was a problem hiding this comment.
also it could be a better idea to use some well tested library.
https://github.com/SpartanJ/efsw
https://github.com/ThomasMonkman/filewatch
There was a problem hiding this comment.
It won't check for updateActive active then, which will result in 1s delay for each module destructor call.
There was a problem hiding this comment.
I guess it's fine? 1s to switch between compiler & game window. CLEO Redux uses 1s sleep
There was a problem hiding this comment.
also it could be a better idea to use some well tested library. https://github.com/SpartanJ/efsw https://github.com/ThomasMonkman/filewatch
I had look at the library you linked earlier, but having global watcher sounded problematic in terms of threads synchronization etc.
Module would need it's thread to load the file anyway. Std:: is "well tested" library too. Threads and file system features provided by newer cpp versions are cross platform too.
|
Thanks a lot for your help! |
No description provided.