I wanted to be able to load angelscript files when they have been changed while the game is running. My code is heavily based of the angelscript game example.
I stumbled across the serializer add on and thought that might be what I am looking for. Even though it says global values it does have the AddExtraObjectToStore option which I could add the controllers used in the example. There are a few things that have me a little confused.
The compile function used in the documentation is pretty vague.
So I assumed I would just delete the module and use the builder add on after .
Though what I have found is just using the DiscardModule function of the engine without rebuilding or doing anything else. Everything keeps running. I thought it would crash or give strange results. So I checked the return value from DiscardModule which was 0 so it found the module and I even made it call it twice to check if it did anything and the first one return 0 as expected the second time it returned -14 which was expected as it was deleted. Though Everything keeps running fine.
Anyway I added the rest of the code for the serializer and the builder and I receive no errors but it has no effect on the behavior. the builder completes with no errors and I know all build and serialize functions are getting called. It is really confusing .
also there is a slight error in the documentation I think. I think modStore is meant to be backup.
// Tell the serializer how the user types should be serialized
// by adding the implementations of the CUserType interface
CSerializer backup;
backup.AddUserType(new CStringType(), "string");
backup.AddUserType(new CArrayType(), "array");
// Backup the values of the global variables
modStore.Store(mod);
I searched online and I seemed to find a few people who said they had the hot loading functionality using angelscript. Unfortunately no where said how.