ID:267750
 
Wasn't quite sure on where to post this, so I decided this would be a good spot.

Anyways, after checking out Volte's Dynamic Lighting demo, I began to ponder over a more realistic way for making Day/Night in my game. I played around with adding and removing rgb in just my view, but decided not to even dare try to attempt removing rgb from every turf/mob/obj in the world, seeing how the lag would be tremendous. I'm just wondering if there might be a better way of doing this?

Thanks.
SSJ Radditz wrote:
Wasn't quite sure on where to post this, so I decided this would be a good spot.

Anyways, after checking out Volte's Dynamic Lighting demo, I began to ponder over a more realistic way for making Day/Night in my game. I played around with adding and removing rgb in just my view, but decided not to even dare try to attempt removing rgb from every turf/mob/obj in the world, seeing how the lag would be tremendous. I'm just wondering if there might be a better way of doing this?

Thanks.

You could just make a variable that holds a 'night time' icon, like so:
atom
var/icon/NightTime
var/icon/DayTime
New()
..()
DayTime=icon(src.icon,src.icon_state)
NightTime=icon(src.icon,src.icon_state)
NightTime-=rgb(80,80,80)


So everything is made upon world creation. Then you just have to loop through everything and make their icon equal their 'NightTime' variable.

~>Volte
How about an animated icon state for each turf and object in the world, one that would slowly turn to night, then switch to a "night" icon state? This way, all you'd have to do is put something along the lines of "grass.icon_state = "sunset" or whatever, then after a certain amount of time, switch to night icon state. It's just an idea, probably one that may not work (and sorry if this WAS the idea of the demo; I didn't see it).
Shadowdarke has a good solution; simply set all areas to have a layer higher than all other atoms, give them a dithered overlay (50% black, 50% transparent, in a chessboard-like pattern) to make things underneath them appear darker, and set mouse_opacity=0 so that you can't accidentally click on the area instead of whatever you meant to click on.

<code>area icon='dither.dmi' layer=50 mouse_opacity=0</code>

Then, whenever you switch to daytime, set the layer to 0; and whenever you switch to nighttime, set <code>layer=initial(layer)</code> to set the layer back to 50 (the default in the code above).

Or you could just download Shadowdarke's sd_DynamicAreaLighting library, which includes spiffy lighting effects as well as day/dusk/night/dawn cycles. =)