Day & Night Cycle in under 8 minutes! Godot 4.0 Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ธ.ค. 2024

ความคิดเห็น • 96

  • @eth0net0
    @eth0net0 ปีที่แล้ว +27

    About 15 hours ago I completed my daynight cycle, did it in a similar way so nice to see I'm on the right track :D

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +9

      There is no right or wrong approach but I prefer things to be as simple as possible and math is quite elegant.

  • @Lizard_geek
    @Lizard_geek 2 หลายเดือนก่อน +1

    I spent hours trying to make a day night cycle then this video helped me get one working in no time.
    Thank you very much sir.

  • @brodieswift3061
    @brodieswift3061 ปีที่แล้ว +33

    Would love more godot 4 tutorials! These are great

  • @Ari-lv8nc
    @Ari-lv8nc ปีที่แล้ว +10

    He's back 🎉

  • @valeska-letta
    @valeska-letta ปีที่แล้ว +2

    omg thank you so much

  • @PolarCortes
    @PolarCortes 2 หลายเดือนก่อน +1

    I didn't understand anything, but I know I'm a beginner and I should trust the process to evolve.

  • @woodsmanthepeasant
    @woodsmanthepeasant 11 หลายเดือนก่อน +1

    Thanks this was a good tutorial. I like seeing how the day night cycle is represented by a sine wave

  • @USNTM2
    @USNTM2 ปีที่แล้ว +4

    4:22 An int function on a float does not round down. It truncates the value.

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว

      Technically, you are correct. However, it achieves the exact same result. Poor choice of words on my part.

  • @annav2208
    @annav2208 ปีที่แล้ว +3

    You chose a beautiful color palette for your day-night cycle. Also, cool new thumbnail style! 🙌

  • @meraklmuskulpesent8313
    @meraklmuskulpesent8313 ปีที่แล้ว +1

    You're the best. Keep making great Godot 4 tutorials.

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +3

      Thanks! Many more tutorials are coming. I want to focus on quality over quantity, so it may take a while. I want these tutorials to remain relevant for years.

  • @PhucHuynh-u7m1k
    @PhucHuynh-u7m1k 5 หลายเดือนก่อน

    Thank you so much for the tutorial!

  • @mando1570
    @mando1570 ปีที่แล้ว +4

    Long time no see u mate , I hope that u doing very well in your life

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +2

      Cheers! In fact, I am doing very well. Already working on the next video!

    • @mando1570
      @mando1570 ปีที่แล้ว

      @@bitbraindev i will wait it , just let it cock good 👌🏻

  • @anwaardev
    @anwaardev ปีที่แล้ว

    Cool! I'll implement that in my Game really soon!

  • @ILoveWatchingTy
    @ILoveWatchingTy ปีที่แล้ว +1

    Ahhhh bitbrain tutorial 🎉🎉

  • @ssneakyandfriends1626
    @ssneakyandfriends1626 8 หลายเดือนก่อน +2

    2:05 "we want a blue tint for night mimicking a full moon's glow."
    Or you can go for what I'm going for and have a near impenetrable darkness. >:)

  • @ArktikusYoutube
    @ArktikusYoutube ปีที่แล้ว +1

    Amazing, thank you! ^^

  • @supaactionmovie
    @supaactionmovie ปีที่แล้ว +1

    welcome back

  • @meliodas8409
    @meliodas8409 ปีที่แล้ว +1

    Yeah! New video!

  • @BlendFin
    @BlendFin ปีที่แล้ว

    Welcome back!

  • @GrumpyIdiot
    @GrumpyIdiot ปีที่แล้ว +3

    you have no idea how long i have been looking for a time and a day night cycle thank you soooo much your videos are fun clear and fast, just amazingggggg

  • @Mrtargi
    @Mrtargi ปีที่แล้ว +2

    Very cool! Great job! Can you give a hand how to apply that light circle are not visible due to day cycle while adding light circles. Mix mode helps a little, but it visible like a faint light circle, really annoying. Also any suggestion how to implement smth like flashlight to the player which could be turned on using a button.Thnx in advance

  • @AsatteGames
    @AsatteGames 7 หลายเดือนก่อน

    This was really helpful, thank you!

  • @Korn1holio
    @Korn1holio 6 หลายเดือนก่อน

    Thank you for this wonderful tutorial. I wonder since we’re basically changing the overall color palette it means it won’t be possible to implement something like glowing windows in houses during the night?

  • @johansjolin6495
    @johansjolin6495 ปีที่แล้ว

    Great video, and a really neat solution!

  • @luanha9002
    @luanha9002 8 หลายเดือนก่อน

    thank you! Nice tutorial

  • @dardasaba7971
    @dardasaba7971 ปีที่แล้ว

    Great tutorial as always!

  • @RedTalon902
    @RedTalon902 ปีที่แล้ว

    This is so awesome! 💛

  • @tangyantiong9813
    @tangyantiong9813 5 หลายเดือนก่อน

    This is an awesome tutorial because the codes are clean and can be easily understand! What if I wish to store the time data across all the scene so that the cycle will not reset every time I change scene? Which variable should I store globally and how do I implement it when I change to a new scene?

  • @ILoveWatchingTy
    @ILoveWatchingTy ปีที่แล้ว +1

    Ey @bitbraindev did you use motion canvas for the animated graphs etc.

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว

      Yes! All code is open source here: github.com/bitbrain/motion-canvas-animations/tree/main/godot4-tutorial-daynightcycle

  • @Silly_Sock
    @Silly_Sock 19 วันที่ผ่านมา

    I feel you left the setup really vague for the UI and it was near impossible for me to follow along at around 5:30 and that really let this down, which was a shame because it had very good potential

  • @friendlyfox2189
    @friendlyfox2189 ปีที่แล้ว

    thank you so much!!!!

  • @shadows4086
    @shadows4086 6 หลายเดือนก่อน

    Thanks!

  • @lincolnw2457
    @lincolnw2457 7 หลายเดือนก่อน +1

    How can I make it so the night time takes 1/3 the amount of time the day does?

  • @microwire007
    @microwire007 ปีที่แล้ว +1

    Loved the tutorial, thank you very much. Is it possible to access the times from other scripts? I would like to have my NPC pull out a torch (well enable a Light2D on him) when it gets to a certain time.

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +1

      A way to solve this is by creating a global signal inside an autoload and connect to that!

    • @microwire007
      @microwire007 ปีที่แล้ว

      @@bitbraindev Brilliant, thanks for the pointer!

  • @lukasvnenk5664
    @lukasvnenk5664 6 หลายเดือนก่อน

    Very helpful tutorial. May I ask what code editor are you using? Does not seem like the built-in.

    • @bitbraindev
      @bitbraindev  6 หลายเดือนก่อน

      Thanks! It is 100% Godot Engine but with my own custom theme. Grab it here: github.com/bitbrain/godot-dash

  • @TampopoInteractive
    @TampopoInteractive 10 หลายเดือนก่อน

    Excellent!

  • @przemekosmanski
    @przemekosmanski ปีที่แล้ว +1

    Cool! But it seems to me that using CanvasModulate as a layer above the others makes it impossible to use any light sources on the tilemaps. Because the whole thing is covered with Canvas, the light sources will be modulated by this day-night system, or the effect of their lighting will be modulated. Am I wrong?

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว

      You should use 2D lights without a problem. CanvasModulate is not a texture on top but a modulation shader operating on the screen texture.

    • @API-Beast
      @API-Beast ปีที่แล้ว +1

      CanvasModulate basically sets the ambient light color, so the effect of additional light sources is increased from using it, not diminished. Could probably even play with using overbright colors at day with a decrease in exposure to simulate lights being less visible in direct sunlight.

  • @spiritnet6219
    @spiritnet6219 ปีที่แล้ว

    Hi very nice job.A idea plz i want to implement month (seasons)? ty !

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +1

      Implementing realistic months/years is a bit more tricky, as not every month has the same amount of days and depending on the year, February has a different amount of days.
      To keep things simple, you could attempt to make each month 30 days.

    • @spiritnet6219
      @spiritnet6219 ปีที่แล้ว

      @@bitbraindev i tried to add
      if day >= 30: month += 1; day = 1 ; minute = 0; hour = 0 but time stops after 30 days .

    • @poemyint4366
      @poemyint4366 6 หลายเดือนก่อน +1

      @@spiritnet6219 sorry for late reply, but if you do if day == 30: day = 0 and time = 0 it will reset the day to 1

  • @draft_fusion
    @draft_fusion 5 หลายเดือนก่อน

    sooo.. how do I do the actual in game timer?
    It was completely skipped over

  • @IberianInteractive
    @IberianInteractive 4 หลายเดือนก่อน

    this kind of works because evening is the same as dusk....if you have different times of days and different colors this won't work because it looks like you go from night to day in reverse...

  • @salianifo
    @salianifo ปีที่แล้ว

    I noticed that the github repos for your tutorials are licensed under GPL, if I follow your tutorials and use snippets from your videos, am I bound by the terms of the GPL?

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +5

      I changed it to MIT now 🤘

  • @auxilotl
    @auxilotl 7 หลายเดือนก่อน

    I just used an animation player and animated everything with that.

  • @NewSchattenRayquaza
    @NewSchattenRayquaza ปีที่แล้ว

    Very nice! Are you considering to make one in 3D as weell?

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว

      Maybe in a few years. Currently, I am exclusively using Godot for 2D only.

  • @giorgimaisuradze2711
    @giorgimaisuradze2711 ปีที่แล้ว

    The vid was great and really helpful, thank a lot
    BTW got any plans for 3D tuts?

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +1

      No 3D at the moment. Long-term though, I want to build smaller 3D games (e.g. horror games) so maybe there might be a tutorial coming out of that.

    • @giorgimaisuradze2711
      @giorgimaisuradze2711 ปีที่แล้ว

      Happy to hear that, I'm really looking forward to it

  • @ДенисМалышок
    @ДенисМалышок ปีที่แล้ว

    Hey, thanks for awesome tutorial. But what if i need to create lights during a night? I mean... it should be night still but at the same time it should bring some light to make things more bright and visual during a night. Should it be a mask which will decrease transparency level of canvas or other approach?

    • @wisdompony3636
      @wisdompony3636 ปีที่แล้ว +1

      maybe u should tying light2d node in godot 4,is too ez

  • @yuraneroba66
    @yuraneroba66 ปีที่แล้ว +1

    cos(x) * -0.5 + 0.5 іs the same function but simpler and faster

  • @AlexCB1982
    @AlexCB1982 ปีที่แล้ว +1

    Very good tutorial. Followed it and works flawlessly. A question: how can I avoid things like floating combat text from being modulated? I've tried playing with z index but doesn't seem to work

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +2

      You have a few options:
      - set a custom canvas material on your text and disable shading
      - use a CanvasLayer on top of your scene and put the floating text there
      - use a different light layer for your combat text

    • @AlexCB1982
      @AlexCB1982 ปีที่แล้ว

      @@bitbraindev ohh I love you!!! Thanks, it works great with the unshaded material.

  • @peewee985
    @peewee985 ปีที่แล้ว

    So how can i make the day last longer? Like say i wanted it to last for 10 minutes?

  • @freakyshriek2076
    @freakyshriek2076 3 หลายเดือนก่อน

    How does export work with gradienttexture1d, i can't seem to get it to appear in my file system pane, i also checked where i saved the .gd file but i cannot locate the .teras file
    plz help T_T

  • @왜못할거라생각해
    @왜못할거라생각해 ปีที่แล้ว

    How to scale image from tileMap?

  • @firerunnew
    @firerunnew ปีที่แล้ว +2

    how to make light sources? for example, fire torches, it is strange that this is not shown

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว +1

      Fire torch will be a separate (shorter) tutorial. For Godot 4, I want to split things up more but go into more detail in each video.

  • @Lion4de
    @Lion4de 9 หลายเดือนก่อน

    Is there any danger in the time variable overflowing at some point, since it just grows indefinitely?

    • @bitbraindev
      @bitbraindev  9 หลายเดือนก่อน

      With a 64bit int it would take 585 million years.

    • @Lion4de
      @Lion4de 9 หลายเดือนก่อน

      …so you’re saying there’s a chance!

    • @bitbraindev
      @bitbraindev  9 หลายเดือนก่อน

      @@Lion4de also correction: by default, Godot has a 32 bit signed integer, so that would overflow after 25 days.

    • @Lion4de
      @Lion4de 9 หลายเดือนก่อน +1

      @@bitbraindev I ended up reading up on this a bit. The Godot 4.2 docs say that the int is 64 bit. I read some concern on Reddit that targeting Android or web will result in 32 bit ints, but this is weird because I know modern browsers have a BigInt type which supports 64 bit numbers, which would mean cross-platform parity for 64 bit ints. Interesting problem, but it could be that you were initially right and that all Godot ints are 64 bit since there seems to be cross-platform support for 64 bit integers.

  • @yongzeyao1337
    @yongzeyao1337 ปีที่แล้ว

    can i use the time ui assets in my commercial project?

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว

      sure, just make sure to credit me!

  • @infinitenex8165
    @infinitenex8165 ปีที่แล้ว

    Is the medieval village tileset available somewhere for free use? I know its in the tutorial download files, but is it part of a bigger tileset I can download, and is it okay to use it in my own project?

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว

      Here you go: beast-pixels.itch.io/overworld-tileset-grass-biome

  • @RC-qz9ye
    @RC-qz9ye 8 หลายเดือนก่อน

    Hey I don't know if anybody will see this but I successfully implemented this tutorial but was hoping for some help with keeping the time across scenes. I am trying and failing at having the clock not reset anytime my player goes into a building XD

    • @TaTaTaCS
      @TaTaTaCS 7 หลายเดือนก่อน +2

      Just in case someone sees this in the future, to maintain information between scenes you can create an autoload file in Project Settings. This script will run immediately when the project starts and keep on running throughout. It's not scene dependent and can be used to track information across scenes, such as time, inventory, any player stats etc.

  • @user-xw2eb4or6l
    @user-xw2eb4or6l 10 หลายเดือนก่อน

    how to do it in 3.5?

    • @bitbraindev
      @bitbraindev  10 หลายเดือนก่อน

      Should work the same mostly. It's math based which is engine independent

  • @StelznerGaming
    @StelznerGaming ปีที่แล้ว

    If anyone is having trouble I suggest loading up the demo project they provide. Helps see the scene structure they're working with and how to set yours.

  • @eprst0
    @eprst0 ปีที่แล้ว

    I have never seen any triple a game project made with godot. Very small games only

    • @bitbraindev
      @bitbraindev  ปีที่แล้ว

      Sonic: Colors was made with Godot!

    • @eprst0
      @eprst0 ปีที่แล้ว

      @@bitbraindev looks very interesting. Thanks)

  • @jguillendev
    @jguillendev ปีที่แล้ว

    Yo quiero hacer un juego de plataformas 2.5D ( es mi sueño 😅 )

  • @comradechonky6328
    @comradechonky6328 7 หลายเดือนก่อน

    hehe boi. Dont stop me from making a >>> ,m,m

  • @GuiiWolff666
    @GuiiWolff666 2 หลายเดือนก่อน

    From 5:28 here all goes downhill and nothing works anymore. Guess I will give up on this system hahahaha

    • @bitbraindev
      @bitbraindev  2 หลายเดือนก่อน

      and you have the code 1:1 like this? It should work. What problems are you seeing?