Category Archives: scripting
In an earlier post, I have written that I have implemented Lua script support in the engine. Now it reached its full power since I have added a proper callback mechanism to it. It makes possible for the triggers in the engine to call user specified Lua functions on firing. Unfortunately, SWIG does not help to implement such callbacks, so I had to do it by myself.
Currently, I am working on an exporter for Blender that greatly speeds up content creation process for the engine. It is not complete yet, but I thought that it worth a post. It supports meshes, instances, materials, textures, point and spotlights.
The exporter saves all meshes in obj format (ugly, I know, but works). It creates Merlin3D scene files with all mesh and light instances. Moreover, it generates effects files automatically, configuring the call of an appropriate GLSL shader and configures the parameters for it. Some of these parameters are the textures taken from texture slots in Blender materials. The exporter supports diffuse, normal, specular and glow maps at this time, but support for further texture types can be easily added. There are also shader parameters coming from material texture settings like specular and glow coefficient, and things like that.
The script extracts several light parameters, such as color, energy, radius (or distance in Blender terminology) spotlight angle or falloff type.
There are a lot of things missing, but the results achieved now are promising… 🙂
Finally, let’s see some screenshots.
While I was doing the porting, I have found SWIG, a very useful tool for Lua integration. Actually it supports so many other languages and interfaces, but I was interested only in game scripting so far.
Why scripting? Scripting is an important feature of a typical game engine, and Merlin3D is not an exception. Prototyping, game and GUI coding is much more easy if I do not have to recompile the whole game engine or DLL. With SWIG adding scripting to the engine is quite easy, so it seemed to worth a try.
Read the rest of this entry