Step 1: Getting Started
Right to get started you will need to make a floor with four walls and a skybox, to get a good idea of the sun effect you may want to create a rather long tube like shown in the diagram below
Note: the best skybox texture to use is office, as there is no sun in the skybox so you can position the sun anywhere without having two suns (the sun and the skybox textured sun)
Step 2: Placing Your Sun
For the sake of examples, we will place the sun directly above the hollow rectangle created on the map, select the entity light_enviroment and place it to line up with the hole and the hollow rectangle and so it is touching the skybox
You can adjust the light properties but for this tutorial we shall leave it on default, but if you do decide to change the brightness, colour etc. you will want to apply the same details to the env_sun entity that we are about to create for the sake of realism.
Next select the env_sun entity from the list and place it so it is right on your light_enviroment, we do this because the env_sun does not produce the light, only the visual effect, and vice versa for the light_enviroment. Name the Viewer entity in the sun entity’s properties "suntarget" and then move on.
Step 3: Giving Your Sun a Target to Shine At
If you were to compile and test the map now it would crash the game whilst loading, I don’t want to go into complex detail but it is basically because the env_sun entity does not have anywhere to shine too, so its time to give it a target.
Select the entity info_target from the entity list and place it in the map, name the entity suntarget, now the sun will recognise this entity as it’s target, which is what the viewer entity was for if you were curious
Stick a few spawns and compile away, when you’re in game look directly up the hollow rectangle too see the effects of HRDL and gawk in awe!
Step 4: Conclusion
Now you have a working and good looking sun! Pretty sweet huh? You may want to change the colour properties in the env_sun and light_enviroment entities depending if the map is dawn, dusk or just plain crazy, another thing you might want to try for yourself is parenting the target to some kind of object so that the sun will appear to be panning.
I hope you enjoyed reading this tutorial and as usual all questions may be directed to firstname.lastname@example.org I will reply to them in full.