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.

Report article RSS Feed The Big News Pack 3/6

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

Game clock and Sky system

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.

ModDB and HD doesn't like each other. See it HD on YouTube or Direct-Download (11MB)

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.

Day-Night Cycle: Day , Day-Night Cycle: Night

Sky Editor

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.

Sky Editor


The next news post will be in the game profile and therefore talk more about the changes there.

Post comment Comments
Verendus Jun 28 2010 says:

Really awesome! Dark but good work! :P

+1 vote     reply to comment
Silverfisk Jun 28 2010 says:

Great work man!
Regarding the darkness of night time; you'll need to account for people's bad monitors. You and I might see something during night time, but if your monitor isn't good enough it'll just be 100% black.

Also, I don't know if it's just me, but I usually see pretty ok during the night. It's easier to see in real life since our eyes adjust properly and a number of other factors that can be hard to represent properly. Therefore you can just make it all a bit brighter to simulate that.

Looking forward to the next one as usual!

+1 vote     reply to comment
Dragonlord Author
Dragonlord Jun 28 2010 replied:

There is like in any game a gamma control option so people can adjust for their monitors. Otherwise it's not supposed to be full moon. With a full moon you can see fairly well at night, that's true. I just didn't have a different moon image at my disposal there so although it's a full moon image it's not supposed to be full moon. But changing that is not difficult. It's more difficult to get it dark than brighter (tone mapping related problems)

+1 vote   reply to comment
[WuTz]! Jun 28 2010 says:

I wish I could watch this video... Shame on my Internet connection!
The pictures are very good! I want that too :P

+1 vote     reply to comment
Dragonlord Author
Dragonlord Jun 28 2010 replied:

Use the Direct-Download link in the video to download the video file. You can then view it offline. I always provide them since streaming services in general are **** both from quality and availability point of view.

+1 vote   reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Windows, Linux
Team Epsylon
Send Message
Official Page
Release Date
Engine Watch
Track this engine
Report Abuse
Report article
Related Engines
Drag[en]gine L-GPL TBD
Related Groups
Indie Devs
Indie Devs Hobbies & Interests with 1,244 members
Team Epsylon
Team Epsylon Developer & Publisher with 2 members