Advertisement

Dynamically load scripts on-demand

Started by October 11, 2013 01:57 PM
2 comments, last by WitchLord 11 years, 1 month ago

I'm trying to write the scripting system for my engine, and I would like to be able to load scripts on-demand. However, the only way I know of to load scripts is to use the module's AddScriptSection method and then calling the module's Build method after that. Is there any way to just build one script and add it to the module?

It's not (yet) possible to incrementally add scripts sections to an existing module without recompiling the whole thing.

However, instead of adding the scripts to an existing module, why not design your engine to use different modules for different scripts? You can then load and compile the modules on-demand like you want. Individual modules can also be discarded without affecting the other ones.

You can study the game sample in the SDK for an idea on how this might work.

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

Advertisement

I might try that out. Will adding a module per script result in significant overhead?

No, you will not have much more overhead than if you compile everything in a single module.

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

This topic is closed to new replies.

Advertisement