frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

Day/Night cycle

So, just laying here thinking about what I want to add to my game, and I decided on a day/night cycle that runs in real time. The enemies in my game get their power from darkness, so places below the surface are where they are strongest. However, for the surface, I wanted to add a cycle so at night, they become harder to see and only their eyes and veins glow. I was going to do this by having a timer tick filter 60 seconds into 1 minute, and at 00:00, 7:00, 12:00, and 20:00 every single object would play animations for midnight, sunrise, noon, and sunset, by getting messages from the clock.

This may be a massive lag issue.
All objects would need to receive messages, every single tile and enemy. I would hate to make sprites for the player as well just for night so maybe I'll alpha blackness on the GUI.

Is there a better way to do this than have every single object in the level constantly receiving time update messages? They would have to receive them constantly, because off screen objects wouldn't update from messages. I'd be setting filters for greater than -1, 6, 11, and 19 which filter to 0, 1, 2 and 3, constantly sending out a message so all objects to set that number so they play the right animations for day and night.

I'll do some testing today for lag, but I want to know if there's a better way to do this than constant messages.

Also @grazer background animations would be very necessary for setting the sky colors and transitioning from sky to stars.

Comments

  • Back when I did that terraria based game, I wanted a sun and moon in the background, but because background objects don’t have behaviors, I couldn’t
  • Why don’t you have a screen covering shader object in the GUI, and use Saves to hold the time, that way you can pick up where you left off. Just an idea
  • That's what I was doing @CrimsonBlackGames. The idea is that from the beginning of the game, to the end of the game, it tells you how long it took you to beat the game, like Metroid. Additionally, when you meditate with full health, time zooms by faster, in case you don't want to fight stronger enemies at night, or want to skip to an event that happens at a certain time of the day, rather than wait in real time.
Sign In or Register to comment.

flowlab.io

| make games in your browser
@ 2017 Flowlab.io, All rights reserved.

Contact us

Get In Touch