Throw Your Game in the Trash Thursday
Working on the game has been pretty frustrating lately. It's one of the reasons I started writing in this blog: I was looking for something more relaxing to do as a diversion. But of course eventually I got back to the game, and while I have made some progress, I've spent a lot of time fighting to make progress.
In this post, I'm going to run through latest features and then I'm throwing this POS in the trash for the rest of the day. And possibly tomorrow.
Latest Features
In one of the recent posts I was trying to introduce the reader to the game as if they know nothing about it, and I think that was worth doing. It helped me to nail down what my goal is more than anything. But walking through every system the game has and trying to sell imaginary readers on the idea is wasting my time.
So here we go.
Quest Indicators For Offscreen Crystal Drops
The issue stems from quests and their indicators being set using absolute positions at level load, but I later needed quests to dynamically appear during gameplay. I decided to link quests to crystal drops so players would be alerted to any missed crystals.
The problem: dropped items don't have absolute positions. To resolve this, I calculate the distance of the drop from the player and use that to derive the drop's absolute position based on the player's position.
The game operates on wrapped positions without tracking how many times it’s wrapped. Enemies are recycled offscreen, making absolute positions irrelevant. Ultimately, calculating drop positions relative to the player seems like the only viable solution.
Despite the chaotic signals between the crystal drops, quest markers, and HUD indicators, the system works, albeit messily.
Light Map and Render Targets
If there was one thing I wish Defold had that other engines have... It's simple lighting features built in. I mean just look at how fucked up this is.
You literally have to modify the render pipeline to do this.
On top of that, I had to try this three different times using two different write ups. This one is also useful.
The problem with both of these guides is that they work upon an outdated render_script
so it's something of a headache to figure out how the new is different from the old. I ended up just switching to the old one, but not before I completely wanted to give up from trying to make this technique work with the current one.
Two Different Light Sources
The system works, but it’s far from perfect. My game already incorporates a day and night cycle, which we'll call the "darkness system." This adds complexity, as several shaders need to function harmoniously to achieve a decent result. There's the quad that blends the world (including sunlight and darkness) with the player’s light source, which isn't simply an absence of darkness but rather a light map that follows the player and illuminates the night and disappears during the daylight.
The challenge is making these two light/dark effects interact correctly. I'll admit, I'm not particularly skilled with GLSL, and much of this process involves figuring things out as I go. While the fragment shaders I’m working with aren’t overly complex, there are several of them, and managing multiple light/dark interactions is something I haven’t fully mastered yet.
I know it looks like shit in the image, but just use your imagination to think of all the other states of daylight and darkness that also look shitty and aren't shown in the image.
Getting this lighting to look good is imperative though. There isn't a lot I can do to improve the quality of the art, but I should be able to figure out the lighting when I come back to it.
That's It
Now get this game away from me.