Posted: Tue Mar 10, 2009 3:25 am Post subject: My old daylight system on ACS
I've been studying ACS programming and made a daylight system some time ago.
Actually, I'm not using zdaemon since I'd rather OpenGL ports because of the color depth.
I'm currently trying to develop a daylight system using real values of latitude, day of year and so on. The problem is that ACS doens't like maths so much, but anyways... I am posting my old daylight system. Consider the arrays having each value of color, each one representing Red, Green or Blue. Using a 16 bit colors port you can see the lighting somehow yellow in "the morning" of the cycle. Unfortunely, it's impossible to be noticed running on a 256 colors port, but still there's the lighting cycle effect.
If you're interested, I'm posting the code right here:
//DAYLIGHT SYSTEM 0.1
int daycycleminutes = 1; //How long the day is in minutes - multiply for 2100 to get the value in ticks
int daylightsector = 300; //What sectors are going to be affected by daylight?
int daylightambient = 32; //Set ambient light from 0 to 255 (0 = full darkness)
/* These arrays express the RGB value at every moment using physically accurate
colors of sun and sky lighting from Latitude 64.1, 17/07/1886 */
daycycleminutes: As you can imagine, just put the value in minutes corresponding to day lenght in the game.
By the way, I used physically accurate algorithms to get these RGB values for every single sample. If you put the value 1440 (which means 24 hours), there's going to be a morning and an evening pretty realistic in terms of countries in the very north of the globe.
daylightsector: That's the Sector Number which is going to be considered to affect the respective sectors in the map. If you want special sectors to be affected, just add'em in the code. It's quite simple.
daylightambient: Ambient color for minimal lighting to avoid full darkness.
Nice work, even if it's not practical here it looks like you're doing a good job mastering ACS
Well, thank you. The code itself is not practical, but in fact you need to edit only three strings to setup the daylight. Unfortunely, the system will always start at midnight (I mean, you can't set up to start in the middle of the day).
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum