Page 1 of 1

Night and Day?

Posted: November 10th, 2011, 3:00 pm
by The Writer
Is it possible to make day and night in sandbox? Like after a certain time elapse it goes from day to night, and the sun and moon move? If so, how do you do it?

Re: Night and Day?

Posted: November 14th, 2011, 1:20 pm
by Tony
I dunno man... night time is when the *really* scary monsters come out.

I suppose you could go to a cutscene, and have the skybox switch while you were away.
Or, you could teleport to an identical map where the skybox was the only difference.
Or some such craziness. To make it feel realistic though, you'd want to switch it several times in increments of dusk/dawn, to twilight, and night/day.

I dunno man, I am new around here. I am still trying to get past the flowerpot. (Mario Bros. reference)

Re: Night and Day?

Posted: November 14th, 2011, 2:47 pm
by arcones
Tony is correct. It would be possible, be extremely hard to create a day/night cycle.

Re: Night and Day?

Posted: November 14th, 2011, 4:55 pm
by kid matthew
If some one was brave enough you can try do this http://www.youtube.com/watch?v=1YWiovHk ... re=related or http://www.youtube.com/watch?v=L4yK-0Ny ... re=related
The guy already offered some help.
He is usually in the Sandbox IRC.

Cheers,
Matthew

Re: Night and Day?

Posted: November 14th, 2011, 10:06 pm
by Hirato
Cube 2 was never made for day/night cycles. You'd need realtime lighting or at least several batches of lightmaps corresponding to set stages of the day (note there is a soft limit of 255 lightmaps per map before weird stuff happens)
Neither of which will likely be done.
The second can be achieved with using an otherwise near identical map for a different part of the day (dusk, dawn, afternoon, night). but this has the extra obstacle of transferring the player and all the other creatures seamlessly. I can probably see if I can make this easier somehow (but this will require otherwise identical maps)

As for the videos matthew posted, they're a rather poor way to go about it.
Basically you light the map and then cycle ambient depending on the part of the day, this has obvious caveats. You can only light the map for one stage of the day (this will probably be night time) and when outside that time, you will literally have no contrast or detail in the lighting (as you can see in the video, everything looks really flat and otherwise bad)

If you want to go this route, experiment using (co)sine curves defined by manipulating lastmillis at first. (note, trig functions use degrees)
For an RPG map you'll probably want the time to be consistent and be at a certain time when you start the game, so use a global variable for that and increase it by curtime on each of the player's update cycles.

Re: Night and Day?

Posted: November 16th, 2011, 8:02 pm
by The Writer
to everyone but hirato who replied: thank you for the ideas... i will try it out.
to hirato: can you say that again?... mabey in english?... sry but i have read your post several times and you always lose me at... you'd need real time lighting... and so on... yeah would you be willing to explain?

Re: Night and Day?

Posted: November 16th, 2011, 9:21 pm
by arcones
To dumb down Hirato's incredibly smart post :P
Hirato wrote:Cube 2 was never made for day/night cycles.
Cube 2 was not made for day/night cycles and therefore won't support it.
Hirato wrote:You'd need realtime lighting or at least several batches of lightmaps corresponding to set stages of the day (note there is a soft limit of 255 lightmaps per map before weird stuff happens)
Neither of which will likely be done.
Realtime lighting basically is lighting in real life. From dawn till dusk essentially. It's what you would see in a real day. In order to do that, you would need batches or groups of lights set at the correct stages for each part of the day (in order to create the right atmosphere, i.e. morning, noon, and night).
Hirato wrote:The second can be achieved with using an otherwise near identical map for a different part of the day (dusk, dawn, afternoon, night). but this has the extra obstacle of transferring the player and all the other creatures seamlessly. I can probably see if I can make this easier somehow (but this will require otherwise identical maps)
Hirato is essentially saying that the day/night cycle can be faked by creating identical maps for each part of the day. However, transferring the player and all the entities necessary for each map would be a problem (NPC's, objects, items, etc).
Hirato wrote:As for the videos matthew posted, they're a rather poor way to go about it.
Basically you light the map and then cycle ambient depending on the part of the day, this has obvious caveats. You can only light the map for one stage of the day (this will probably be night time) and when outside that time, you will literally have no contrast or detail in the lighting (as you can see in the video, everything looks really flat and otherwise bad)
After watching the videos, I see what Hirato is talking about. Essentially, the "light" from the sun, or in the case of the day/night cycle, is ambiance which does not create the proper lighting at all, which in turn produces REALLY flat looking maps (despite the fact that there is supposed to be light).
Hirato wrote:If you want to go this route, experiment using (co)sine curves defined by manipulating lastmillis at first. (note, trig functions use degrees)
For an RPG map you'll probably want the time to be consistent and be at a certain time when you start the game, so use a global variable for that and increase it by curtime on each of the player's update cycles.
Hirato will probably have to explain this one clearer even though I know what he is talking about :P

I hope that clears some things up a bit Writer ;D

Re: Night and Day?

Posted: November 17th, 2011, 9:08 pm
by Captain_Ahab
because the problems stem from the way sunlight casts shadows as opposed to SB's static lightmaps, the most obvious solution might be to cycle day/night for an overcast day where directional shadows are minimized.
Change light levels as the day progresses with gamma and fog values
an overcast skybox and moving cloudbox and cloud layer to add to the effect of a cloudy stormy day... occasional lightning effects and thunder sounds??

with rain particles ( or snow for overcast snowy days ) and careful use of lighting and glow/spec maps, some nifty atmosphere/mood settings should be possible

Re: Night and Day?

Posted: December 17th, 2011, 7:40 am
by The Writer
Arcones: thanks for dumbing that down for me it makes so much more sense now!
Captain _Ahab: interesting suggestion, though i'm not entierly sure how to execute it... if you are saying that in order to give a somewhat day/night experience there must alwas be some form of percipitation then that kinda sucks... if not then i gues i don't get what you are saying.