Being able to unload/reload code in nearly real time is definitely useful.
When?
During development.
There’s some in-build support for this in NetBeans. While debugging you can change the contents of a method and have it recompiled, almost immediately, by clicking the green button to apply code changes. However, this action is limited to code in methods, you cannot add new methods, change their signature etc.
I also tried to separate my code into ecs,systems on one part, and java files which create the gameplay world, gameplay behaviour on another. I use another class loaded for the gameplay stuff. Thus I can with a button refresh the whole thing. This way, even new classes/new methods can be added deleted as long as I do not touch the part of the code which does not support reloading.
It’s quite useful for some scenarios when, eg I edit the Blend file, click import button, to see the changes in game. Or add a new behavior or event to a part of the map.
However, although it helps, this kind of interactivity is still very much limited. For example, let’s say I’d want to tweak some material parameters to see how they look. This system still does not allow to do this at interactive base. Or i’d would like to quickly swap a texture an object has with a different one… etc.
Currently for such cases, I got a window on a side with bunch of sliders, buttons to tweak the params that I’m interested in. But the problem is that to add a new tweakable param I got to restart either the gameplay classloader or whole game.
Atm, I got a new idea to reach general interactivity. And its simply a node system. Where each node is a Java method/Java object.
For the example of editing material params of some scene object, it could work like following: First of all, there would have to be a way or several ways to search for a geometry or just select a material. Eg. a button to pick 3d geometry with mouse from scene. Then this geometry would pop out as a Geometry Node in the Node Editor. Then user would use Geometry.getMaterial() Node to obtain the material and eg let’s say he would be interested in tweaking the Color of the material. He would add Material.setColor() Node to change the color. Finally, he would need a node that would display GUI for color selection. Then just plug it in and as he changes the color, the color in jme 3D view changes interactively.
The above would not be too much work as 99.99% of the nodes are generated automatically, they are created with Java reflection and are simply Java methods. The work would have to be done to create GUI for eg. color selection, etc.
Let me know what you think.