Provides access to the Drag[en]gine using the DragonScript scripting language. This is an object oriented language which does not require compilation to run. While loading scripts they are compiled into byte code which then is run. This compilation is fast even for large script packages and does not slow down the startup process noticeable. The language is a strong type language with everything being an object even primitives like numbers. Single inheritance is used together with the ability to use interfaces. Scripts can be loaded from files or other sources even remote online sources. This allows for new types of script distribution and cheating prevention. Scripts can be placed on the game server from where they are loaded. This prevents one form of hacking where program code is targeted. Another advantage of DragonScript is the ability to use Native Classes. These classes are written in C++ and can be used like a package a package of scripts. They behave like they are scripts but in fact run machine code behind the back. This allows to extend the language in any way not possible with scripts alone. Furthermore native classes run much faster than script code which can help to speed up code execution.
The DragonScript language comes equipped with a small set of additional packages. More packages can be installed by placing them in the right script directory making the language easily extensible. To avoid misuse the DragonScript Script Module can be set by the game to allow only certain packages to be loaded. The default package includes various classes required for creating a game. Includes:
- Simple Game-App framework which is very small and enough to run a game. You do not have to use any other packages to make a game if you do not want to. Allows for using your own frameworks.
- GUI Toolkit for 2D graphics based on the Model-View-Controller programming model. This model has been chosen since it's very powerful and many people know it already from Java.
- Element based world construction provides a set of world objects in a hierarchical fashion. This system is easy to use and powerful suited for complex as well as simple projects. Includes Visitor Pattern to make it easy and fast.
- Modding enabled Game-App framework based on the simple one which provides a solid base for games with modding support and useful default objects for handling menus, guis and ingame rendering as well as managing object classes, key bindings and more.
The DragonScript Script module provides only a small abstraction over the game engine. The parts that are required for making a game are exposed with a a structure matching mostly 1-to-1 the structure of the internal engine objects but easier to use since it's all object oriented. Some places though are not mapped to the scripts since the complexity would be confusing for the developer. There are also some helper classes which accelerate certain actions.
Since the DragonScript is an interprated language ( even if byte compiled ) care has to be taken about how the scripts are written. Things can get slow quickly if too much code is executed. There are various ways to write fast code including function late binding and visiting. If anything else doesn't work you can create native classes which are written in C++ and place them in the package include directory. This way they can be loaded in your game scripts and behave like scripted classes. They can even be made to fit ontop of your framework which makes it possible to heavily accelerate parts of the game scripts if they turn out to be too slow.Note: This module is still work in progress since the engine is not yet finished. The DragonScript language is mostly finished lacking only a good garbage collector right now. It's not decided yet if an external installation of DragonScript is required or if the language is compiled into the script module.