As the developer of the Molecule Engine, I wanted to chime in to clarify things and make my intentions behind the scripting system clearer.
For me, long compile times were never the motivation for introducing the C++-based scripting system. I wanted to combine the advantages of interpreted script languages (hot-reloading, clear separation of gameplay and engine code) with the advantages of C++ (fast, native code, can link to and use the engine runtime without boilerplate/glue code, IDEs and good debugging tools).
That's why I came up with the system of using C++ as a scripting language directly, or build custom script tools on top of that.
As has been mentioned in this thread, every script is compiled into its own shared library (.dll on Windows). That makes compiling single scripts super-fast and allows for almost instant hot-reloading. In the retail build, all scripts are linked into the executable.
At the moment, a script is nothing more than an implementation of a base class with a few virtual functions. Scripts can use the engine runtime by either calling functions provided by interfaces (useful for designers/scripters), or linking to the engine runtime directly (useful for programmers).
How you want to use the system is up to you, and depends a bit on how the builds are set up.
A few numbers from the game we shipped last Thursday
- A single script takes 200ms to compile and hot-reload into the engine. This allows you to protoype stuff fast and change lines of text instantaneously, which was great for a narrative-driven game like this.
- For The Lion's Song, I built a scripting system that mimics co-routines. Those additionally support rewind & fast-forward, which was great for development and testing. The co-routines were built on top of the basic scripting system.
- Using this co-routine system, scripts do not look much like C++-code anymore. Scripts and dialogs are introduced using macros, and the script functions pretty much look like any other language. No references, pointers, templates, etc.
- Scripts only ever access engine components and interfaces by ID, never by pointer.
- There are 208 scripts in the final game. When compiled to .dlls, the script code takes about 2.5MB. In the final executable, the scripts add around 0.5MB to the executable.
Last but not least a few statistics regarding build times:
- A fully optimized rebuild of the VS solution with 18 projects takes 65 seconds. That includes Core, Input, Audio, Video, 2D, 3D, all external libs such as LZMA, libogg, libvorbis, all tools such as the editor, content pipeline, and a localization tool, and the full game for Steam. Ever since I started working on the Molecule Engine, I paid close attention to build times.
- The game itself builds in roughly 5 seconds, including Steam support, metrics, etc.
Hope that gives you a better idea of what my motivation was, and how things roughly work.
Shoot if you have more questions!