GAMEDEV.NET
Shared entities hot reload
Author
Hi, I've got hot reloading working for quite some time now, including serializing before and deserializing after so that the “state” remains the same. Sadly, this stopped working after I introduced shared entities.According to the manual:Shared script entities will not be recompiled if some module or existing object (including those pending destruction in the garbage collector) still refers to the code. It's recommended that you minimize the use of shared entities to where necessary so as to minimize the need to modify them.This was a bit saddening, and the first limitation I ran into with Angelscript.I would really like to be bale to reload this script, even if that means I have to reload all scripts. How would I achieve this?
Unfortunately shared entities are more complex. In order to allow hot-reloading for modified shared entities you have to make sure all references to the old shared entities are removed before you compile the new version. Otherwise the compiler will not be able to compile the new version of the shared entity (you wouldn't be able to have two different version of the same shared entity co-exist).Unless you have very strict control of where references to the shared entities are stored, the best way to do this is by serializing everything, then shutdown the engine, and create a new one, load all the scripts once more, and then deserialize the previous state.
Advertisement
0 Compartilhamentos
44 Visualizações