Jump to content

View more

Image of the Day

#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now
- - - - -

Serializer add on with game example

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 greeniekin   Members   


Posted 21 July 2013 - 12:07 AM

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

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.

#2 Andreas Jonsson   Moderators   


Posted 21 July 2013 - 09:25 AM

AddExtraObjectToStore is used exactly for what you imagined it, and can definitely be used for the controller objects.


To recompile your module you can simply use the CScriptBuilder add-on to build the script again. It will automatically discard the old content of the module and rebuilt it.


Discarding a module will only remove the content so it won't be visible from the application. If there are object instances that are still alive and use the old code, they will continue to work for as long as they live. The old content will be freed when it is no longer used by any objects.


The serializer will create new instances of the objects using the new code from the module. You should replace the old controller instances with the new controller instances to see the changes done in the script.




You're right about the mistake in the documentation. I'll have it corrected, thanks.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.