It’s late I’ve been drinking 🍺 and I’ve spent the last 2 hours scrutinizing the day night cycles of open world videogames and turns out it’s allll a lie! Here’s what I found... #gamedev #indiedev
I’ve been working on a publishers game. Trying to get it to run well on the PS4 but their day night cycle is super expensive performance-wise.

My boss told “but other games do it just fine right?” I was like yea spiderman does it great...right? Rrright?!?!
So I load up my boi spiderman. And I jump onto a rooftop and just watch. I stare right into the brilliant sun w my spiderboi and did the ☀️ move?
It didn’t move. Like at all. I thought spider boi had day night cycles but I was wrong. Oh so wrong. I just stood there waiting like an idiot. Like most of my tinder dates.
Okay so it seems like Mr. Spidering man doesn’t have dynamic day night cycles like I thought. Like it felt. Day night cycles is triggered by missions. #gamedev #indiesev #apiderman
Okay. What else has day night cycles? Maybe god of war? Not from what I’ve seen but I only just started playing that. I waited around for a bit for the lighting to change and...nothing.
Okay so Red Dead Redemption has to have it. I need to know how games that big do that. So I checked ...
So I parked at a spot and waited. Had a couple drinks. And waited. Part of what makes dynamic skies so expensive is that even if the sun moves an inch you gotta recalculate all the shadows on the screen
And so it’s no surprise the sun moves VERY slowly. Very very slowly. My god it’s slow. But I can tell it moves. I had a good spot where I can see the long lines of shadows. Wondering if #RDR2 is recalculating the shadows every frame...but
It’s not. The sun moves straight up. The moon did too. Not sure if that’s how it is all the time. But the shadows didn’t change. They didn’t shorten. I was staring at this rocks shadows in #RDR2 for an embarrassing amount of time...for science! 🧪
So while I waited I loaded up #GTAV on the PC in ultra so see if I can learn somethings about how it does global illumination. That’s lighting and shadows for the world for you normies #gamedev #indiesev
And found out some wild shit. Hold on to your butts kids Bc GTAV does some sneaky...dastardly shit. Let’s talk about shadow calculations mf’ers
Shadow calculations in #unity are expensive. You got the light in the sun which gets calculated first across an entire scene ans then you got all the lights in the scene that affect the shadows locally. So there’s a pass for them too
So you can just set lights to not create shadows but I mean you need shadows right? So usually you stick with the sun at minimum. But every time that sun moves the scene needs to recalculate all kinds of shit let alone the shadows for every damn thing.
So how does #GTAV solve this? Well I stared at the shadow of a tree for an hour as I often do. Didn’t move while I pondered the meaning of my existence and where the hell Becca is she said she’s on her way oh shit the camera changed gotta wiggle the mouse for a minute...but then
But then I saw it. The shadowed moves like 2 whole feet wtf. I caught it! I knew #GTAV would be sneaky like that. It waits for a camera change and recalculated the shadows then knowing 99.99% of you will miss. Well not me!
This way the performance cost is greatest reduced but there are other moments I saw it recalculating shadows. Whenever I move the camera quickly #GTAV does it. Yup I’m staring at grass 🌱
You see #gtav is trying to hide in the shadows a secret. Something They don’t want you to see but I’m exposing them. You see they live in the shadows. They want to be hidden. But I’m shining a light on them and revealing them to the world! 😈
Also the #gtav map is actually a #ninjaturtle you’re welcome goodnight
You can follow @illsaveus.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: