0.2.0 - Basic Level Blocking (Week 8)


Don’t Let Them Land 0.2.0

Raining Rocks

This week is all about level blocking, but Don’t Let Them Land doesn’t really have levels. It’s more of an endless rain of baddies that the player must attempt to outlast. So, let’s focus on what that might look like. Firstly, I always intended to add some basic early asteroids in for the early game to give players a chance to get their bearings before the real enemies’ spawn. So, I decided that getting spawning working would be a good start in finding a foundation for the “level”.

Grabbing some nice-looking asteroid sprites and building a basic prefab, I had the foundation for what I’ll be throwing at the planet (should the planet have a name? A question for another devlog, perhaps.) So, I threw them at the planet, making sure they weren’t super accurate and varied in their approach, rotation and speed. Quickly, I realised how my gravity code (which I still think works well for the player) wasn’t working well for the asteroids. Specifically, it was way too strong. Dialling that down made the asteroids feel a lot better, but there is still more work to be done with the gravity code, I think, and I may mess around with it some more later.

Weighing the Asteroids

Now, the next issue was the camera. It was sitting way too close to the planet to see the asteroids before they slammed into the planet. Some of that won’t matter as much with the UFOS, but it was still important to give the player context for what was coming and what needed defending. Initial attempts technically worked, but as you’ll see in Figure 1, they weren’t exactly smooth.

Wild Camera

Figure 1 - Camera updated instantly on spawning new asteroids and resulted in this jerky movement, which no amount of damping would fix

Adding and removing the asteroids wasn’t enough to make the target group's Cinemachine camera work nicely. I needed to weigh the asteroids, and I decided to do that based on the distance from the surface of the planet. Once the asteroids get within a certain distance of the planet, their weight in the target group rises, and the camera reacts to their presence to indicate the danger they pose. This works well, although some adjustments might be needed for numbers. The actual function works as intended. However, one thing that needs to be improved before next week is that when asteroids are destroyed, they are instantly removed from the group, resulting in a bit of a jerky camera, a bit like above, but the opposite. I have a solution already in mind, but it isn’t implemented in the current version.

Arrows of Doom

While the camera was now in a good spot, there remained an issue. It was still hard to determine where the asteroids were going to come from. A simple solution would be to just zoom the camera out more to make it easier to tell, but this comes at the cost of an even smaller planet and player sprite. I thought of how other games have dealt with this issue, and some come to mind that help the player determine where an object might be off-screen.  Rimworld event arrows (Figure 2) was the most obvious solution, but with some modification, so I set about making my version of arrow indicators.

Rimworld event indicators

Figure 2 - Rimworld points the player in the direction of important events or selected items so they can easily find things

This took a little more work than I originally thought it might. The maths for lining the arrows on the sides of the screen was hard enough, but then, when I rotated the camera, everything started pointing backwards, resulting in arrows pointing towards the planet instead. Eventually, I got it working the way I wanted to, but the best part was a mistake when trying to re-colour the arrows to indicate proximity to the screen resulted in the arrows starting with zero alpha and thus fading in, which looked way better than the arrows just straight up appearing.

But What Do I Do?

Now, with asteroids racing each other to slam into our beautiful planet, it was time to give our little robot friend something to defend it with. A very rudimentary shooting mechanic not dissimilar from work we have done in tutorials, but with some (potentially questionable) personal code choices to make it work the way I wanted to.  It was surprisingly easy to get the shooting to work, considering how much trouble I’ve been having with the rotated camera and world space. Laser goes in the direction vector as expected, and I basically no issue with the basic shooting. Well… except what happens in figure 3

That's not how lasers work

Figure 3 - That's not how lasers work

After adding some code to actually let the lasers do their job, I realised I had the bare bones of an actual game, even one I could add a score count to. It took a bit of tweaking of numbers to get the shooting and asteroid spawning into a place that felt good, and there will be a lot of work in future weeks regarding this. I had to adjust a lot to even really consistently be able to hit the asteroids. Increasing the size of the laser and the asteroids helped, as well as speeding up the lasers and slowing down the asteroids. All these are numbers that will still need adjusting, and some will even change as the game runs, so lots of testing will be needed to get it feeling good. The biggest help with actually hitting the asteroids was adding a trail renderer to them. Giving the player some context clues to the direction the asteroid was travelling, especially in a rotating environment, made me go from missing every shot to hitting the asteroids much more consistently.

Feedback

I got lots of helpful feedback this week. A lot of people liked the camera more than I was expecting. Some particularly useful comments:

“in fact i find the camera angle really good, i dont quite notice the planet itself after a few seconds eyes just naturally focus on the markers”
“Camera is fun.” – Thanks Ian
“I like the use of arrows indicating when an asteroid is about enter the screen …. In terms of the camera, I think it's largely fine, I just think the planet needs to stay in the centre.”
“liked the radar indicator of angles asteroids come from, camera feels good but as liam said anchor it centred and some of the gravity felt a little off with the asteroids but overall very solid progress”
“Also really like the indicators, useful and works well. I felt like the camera zoomed out a little too much (character ends up being tiny) but could just be a personal thing.”

The arrows went down really well, so I’m glad I added those, as they weren’t planned originally. The camera got mixed feedback. Some liked it, while others felt it should stay more still around the planet. I also worry about how small the planet and player get with the current settings, so I’ll definitely play around with those in the weeks to come.

References

Assets used:

Leave a comment

Log in with itch.io to leave a comment.