nathanhoad / godot_dialogue_manager

A powerful nonlinear dialogue system for Godot
MIT License
2.04k stars 161 forks source link

update dialogue in game when file is changed #581

Closed nan0m closed 3 months ago

nan0m commented 3 months ago

Is your feature request related to a problem? Please describe. If I run my game, and change a .dialogue file while the game is running, this won't be reflected in the game until I restart it. There is no hot-reloading, so to say. For example in my game, if I want to test a new version of that dialogue in the game, i have to restart the game which takes me 10 seconds then go to where the dialogue happens, or get to the same state e.g. pick up an item first. Now, I understand there is the example balloons in editor, but often times the dialogue interacts with the time, place, feel, the level design et cetera and testing it in those final conditions is at least to me very important.

It would be very helpful if this was possible, because this would allow me to iterate on the dialogue much faster.

Describe the solution you'd like re-saving the dialogue file refreshes it in the currently running game.

nathanhoad commented 3 months ago

Detecting a hot-reload event isn't something that's properly exposed by Godot at the moment. Until then you can implement something in your custom balloon to force a resource reload and then retype the current line. Something like:

resource = ResourceLoader.load(resource.resource_path, "Resource", ResourceLoader.CACHE_MODE_IGNORE)
dialogue_label.dialogue_line = await resource.get_next_dialogue_line(dialogue_label.dialogue_line.id)
dialogue_label.type_out()
nan0m commented 3 months ago

Thanks!