YSCEDC / YSCE

YSFlight Community Edition
BSD 3-Clause "New" or "Revised" License
13 stars 4 forks source link

YSCE Day/Night cycle #77

Open Skipper-is opened 1 year ago

Skipper-is commented 1 year ago

Implementation of day/night cycle.

Day/Night cycle is measured on a scale of 2 pi. 0 is mid-day, Pi is mid-night, and 2pi is mid-day the next day (resets back to 0) image

Dusks/dawns are between 0.2 > sin(dayTime + pi/2) <-0.2.

Conversion between dayTime and 24h clock would be:

Will implement a method for conversion

For net code: Combined with the cloud layers config stuff I was working on before with the sending of the day/night cycle.

Cloud layers set in the config settings window now follow through into multiplayer, and will be sent to clients.

Clients are only sent the new stuff if they're running YSCE too. There is a check on the login process to see whether the client is using YSCE, and if so, that info is stored for any other future netcode changes that may need a YSCE switch.

Currently the day/night cycle doesn't re-send the day/night time when it changes. This needs adding, but in a sensible way that doesn't resend it every tick...

On login, the day length is sent to the client, along with the current position in the day/night cycle, so the client is able to keep track of it their side. It will resend when the day/night switch occurs, but it doesn't yet.