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.
Lots of time passed with too many updates to fit in one news post so it has been broken into 6 weekly parts. Here is therefore part 3/6.
Posted by Dragonlord on Jun 27th, 2010
For handling day-night cycle a proper game clock has been added. This clock provides the game time in years, month, days, hours, minutes and seconds. The system is kept very simple to avoid complicated calculations. The different spacings (like days per week or days per month) can be set individually. This way various game clocks can be implemented.
Concerning the sky a dynamic day-night cycle with realistic light intensity values has been added. The system uses a set of backgrounds and planets. Backgrounds define a texture to be used as the background for the sky and has the support to blend between various backgrounds. This way the different day times can have different backgrounds. Planets define the sun and moon and other light sources if required by a game. They are squeezed between backgrounds and foreground layers. They have settings to move across the sky on an curved path. Their light intensity changes according to the game clock time. Clouds can then be placed in front potentially covering the sun and moon. The system is rather simple but should provide enough flexibility for common sky scenarios. Since this is though just a sky system implemented on top of the game engine sky system it can be replaced at any time with an entirely different sky system.
Some explanations on the video. I added a time-lapse key to the code just for testing. In the game later on this will not be included. The time lapse simple makes time go past by faster but only for the sky and game clock. So everything else still works using real timing. This is just a basic test with only 4 backgrounds (night, dawn, day, dusk), a static cloud layer and the clouds not affecting yet the light to get the system working. Improvements will be made later on by adding a planar mode to layers (as the sphere mode works only well for very distant objects moving), actual 3D clouds (so they have an actual placement in the world which is more realistic) as well as clouds reacting on lighting conditions (various effects known from other games). The light intensities and direction are not coded but actually calculated from the sun and moon position and their light intensities (which is given by a curve) by weighting their influence. What can be seen already in this video is the intensity transition which goes from 20 (sun-light) all the way down to 0.01 (moon light). The varying light situations are handled by the HDRR code. The intensities are roughly oriented on real light intensities (lux) but roughly divided by 1000 and scaled a bit to make better use of FP16 values. Due to clouds, planets and the background being on different layers the clouds cover up the moon/sun as well as being able to have multiple cloud layers. You can not see the moon light in the video since codecs are not sensitive enough to such contrast variations. In the game though you have moon light casting shadows. You can barely see though at night which is supposed to be like this. See the additional screenshots below for an actual in-game lighting situation for day and night. You'll going to like dragons in that situation as they see better at night.
To help in making skies a Sky editor has been created. It's based on editing layers and defining their day-time behavior using properties. Each property can be assigned links. Links just serve the purpose to reuse day-time values. A link defines a controller and a mapping curve. So far this system is similar to the Animator System as outlined in an earlier news post. A controller would therefore be filled with the current time in hours or other manipulation values. The curve can be constant, linear or bezier interpolated. So far this is the first version of the sky editor. The red ring is just an orientation help. Later on an optional full sky grid will be provided so you can better align objects on the sky. You are not required to use this editor since it just produces an xml file a bunch of scripts read and interprate. So you can also ignore this all and just provide your own scripts to handle the sky. For this just subclass the SkyDirector class in the game.
The next news post will be in the game profile and therefore talk more about the changes there.