Archive:
Did another video! Just wrapping up what I’ve been talking about this week…
Also fixed some bugs with the journal screen. The text that appears when you select a quest from the list wasn’t correct. I’d sorted the list into two parts, active and completed, but the code that pulled out the localised text didn’t know this. Now the text localisation UID is embedded into the lists and I pull it out when I need it, rather than using a naked index.
While I was in there, I coloured the completed list so it’s a lot more obvious what you’ve done and what’s just hanging around and added a way for the B button to remove all UI screens, which feels a lot more natural.
Many bugs have been squashed:
That last one’s a corker. Turned out to be a sorta race condition, that only one place in the game uncovered. (There’s a way to do seamless travel of players and their state across map loads, which I’m not using… For, er, reasons. I can’t remember. But probably because I use my own save/load code…)
In my implementation, when leaving a map location, the player’s state is bounced up to the GameInstance and stored. The new map is loaded, and then the state is supposed to be reloaded into the player. Except… Nothing in my code was checking to ensure that the load was happening on the new player (and new state). I was just blindly calling loadstate immediately after the map load stopped blocking the main thread… Annd, the new PlayerState instance wasn’t ready. It was being called on the old one…
This is one of those “how the fuck did this ever work?!” type bugs. It’s been there for at least two years, and it should have broken when loading every map. I’ve no idea why the Player’s house started uncovering it.
Anyway, BeginPlay in the player state blueprint now retrieves the saved state from the GameInstance and all is well with the world…
More bugs:
And today’s Holy Shit bug is maybe the longest standing issue I’ve had… and it’s a bit of a jackanory.
I have two directional lights in the world, for sun and moon, and a sky light, for the bounce (brings up the shadows). Each of these is manipulated every few frames to set the direction, colour and intensity, which gives me an animated Day->Night sequence.
Ever since the start there’ve been perceptible pops a few seconds after the map has loaded. Like the lights weren’t at quite the right colour/intensity etc. But every time I debugged this, with print statements and even breakpoints, the values being read and set were correct. The lights had the correct values… Except. They didn’t.
If you spawn directly into Ytene the scene is waaaay brighter than if you’d walked into it from any of the other map areas. It’s like two completely different setups. And yet, today, when I debugged this ALL the values were identical. Spawn in directly, bright scene, walk in, nice dark scene. WTAF.
I’ve suspected for a while that the lights in UE are optimised in some way to ignore little changes until they add up to some sort of threshold, hence my little pops. Until Ytene I’ve not had an easy test case; Ytene doesn’t animate the values for any of the lights to a large degree, so if they’re wrong at the start, they’ll stay wrong until you move toward the next map region and begin blending toward the next setup…
Today I really dug into this. Walked through all my code, line by line, spat out all the values, compared them against my desired curves, and yup, my code is doing everything it should be doing. The lights in the editor say they have the correct values, but the rendered scene is definitely wrong. But I knew that anyway…
So, what if there’s a sorta race condition? I’m setting intensity and colour in the lights from the first frame they’re in the scene. What if this is too early? What if that doesn’t actually change them properly, but somehow the values are getting stored, which leads to what I’m seeing?
I don’t want to delay the first update, that’s going to lead to more trouble, but what if I lerp from, say, everything (colour/intensity) set to zero, toward what I want, over a second or so?
You guessed it. Bug fixed. Does that prove my theory? No idea, but it does fix my issue.
More bugs:
And added in some new NPCs and dialog lines. Place holder atm, but they're sitting in the timeline and only appearing when I need them.
Previous Post: "End of Ytene?"Friends:
If you like any of my work, please consider checking out some of the fantastic games made by the following super talented people: