Work has been put a bit to rest over Christmas and New Year since everybody needs some days off. Nevertheless work continued on remaining tickets.
Over these days I planed to finish up a long standing side-project, the Shield Liger model. I want to do some POC (proof of concept) with this guy but more about this later. You might ask now why the hell I loose time on a side-project instead of working 100% on the main project. The reason is simple. Not only does it help me to clear my mind to get the nifty ideas I do for the main project it also helps me to find bugs and required improvements I would otherwise miss. And over these days I stumbled across a bunch of bugs due to fiddling with that POC which I've ironed out.
Besides bug hunting using the POC I've also dealt with improving an already existing feature, the video playback.
The Drag[en]gine knows the principle of Dynamic Skins and Renderables to provide support for dynamically altering the content of skins without requiring decals or creating multiple versions of skins. Renderables allow to place highly dynamic content into individual Texture Properties for high reuse and adjustability of skins. This includes also a simple way to stream video files into individual texture properties.
Videos are useful to provide image sequences of all kinds. This can provide monitors playing videos all the way to adding interesting effects like applying a video to the normal texture property or even more crazy. In particular in the Drag[en]gine all animated image formats are also treated as videos for convenience.
Videos are handled in the Drag[en]gine using two modules. The Video module is responsible to load videos from file and to decode the content into images usable for display. Right now Theora videos are supported but anything goes as long as a video module exists for it. The second module is the Graphic Module applying the decoded image to a texture in GPU land. The tricky part here is the performance due to two specialized modules cooperating with each other.
For my tests I used videos of 1024x768 and 512x384 at 25 frame rate. Streaming videos is time consuming. Decoding one frame of the large video takes 16ms and 4.5ms for the smaller video. Furthermore larger textures take longer to upload to the GPU. Besides videos can be encoded with different color channels having different sizes (4:2:2 for example). This all requires conversion work producing a lot of overhead.
To get this up to speed the Graphic Module contains a per-video decoder thread with prediction. The thread is placed in the Graphic Module because decoding has to be synchronized with the GPU. This is required since OpenGL is not thread-safe and doing GPU manipulation at the wrong time is worse than having non-optimized code. Since game scripts can manipulate the frame to be displayed at any time the decoder thread uses a simple form of prediction to guess the next frame to display and decoding it up-ahead.
All this combined allows to display multiple large video files at high frame rates at different play positions in different textures simultaneously with next to no overhead. Of course this has limits and for many videos you need a Quad-core or Octa-core but these CPUs are becoming common and in a game you use usually smaller video files and lower frame rates.
To help artists the Skin Editor has been enhanced with dynamic skin preview functionality. This provides a dynamic skin object the user can manipulate to test different usage cases and configurations of renderables. The dynamic skin is not stored alongside the skin file since it only serves as testbed while editing skins. The screenshot below shows the dynamic skin preview feature in action as well as a sample test case with two video files applied to two renderables affecting three textures.
Another batch of work included modifying the attachment system in the animator editor. This helps to provide accurate and bug-free animations by directly testing animators while you create them with in-game attachment scenarios without requiring actual in-game code for 3rd and 1st person viewing systems. The improved system allows attaching all kinds of objects from kinematic and dynamic meshes over particles to light sources and so forth.
Due to recent comments I want to show the next time something special for this game engine. It's a topic I heard often recently but as always the solutions used right now are quite lack-luster. With this game engine you can do better. I wanted to do this a bit later on but seeing how things develop I'll pull that ticket to the top of the backlog. I'm not going to tell you what it is right now. Try to guess what I might be cooking up this time ;)