The Drag[en]gine is a fully customizable game engine and game development environment designed with modularity and extensibility in mind not requiring expensive licenses.

Post news Report RSS Movie Star

How to get video reels rolling in-game and how to do it fast.

Posted by on

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.

Videos in games

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.

Dynamic Skin Preview

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.

Dynamic Skin Preview and Video Renderables

Improved Animator Editor Attachments

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.

Outlook

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 ;)

Post comment Comments
SinKing
SinKing - - 3,119 comments

Cool! Good new feature, very usable. I can think of tons of applications for ingame use, starting with a really nice game intro and movies projected to billboards throughout the city.

I guess what you might be working on is HDRI-lighting? Thats something most engines have, but don't do as good as it could be. It also makes those fancy shaders that, e.g. UDK uses superfluous, just look at Cryengine and how nice materials look, even though they just have the 3 basics maps and no crazy shading compounds.

I'm looking forward to the next release. This engine is becoming truly great. And I still can't believe you are doing alone what EPIC pays dozens (if not hundreds) of programmers to do worse ^^ (Okay, now they have UE4, maybe this time it is a flawless engine)

Reply Good karma Bad karma+2 votes
Dragonlord Author
Dragonlord - - 1,934 comments

HDRI-lighting is already in the engine. The tone-mapping will get some extra love but I'll come to that later. A ticket is around for this task giving you much higher control over tone-mapping than other engines but without tricky mechanics used.

Concerning the "secret" I'm working on... I'll just give as hint the follwing: it's going to be a "Launcher" ( Dragengine.rptd.ch ) module in a "certain" place.

Reply Good karma+2 votes
SinKing
SinKing - - 3,119 comments

That's so impressive! I wish more people were watching this engine's development. Every feature any of the big developer's engines have - the Dragengine has it too, just better ^^

So now you're on to web features. Great!

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: