Lost Caves Devlog #16 - Mid-Boss Overhaul


While most of my time right now in Lost Caves is spent on bug-fixing and tweaking, there was one thing I spent a great deal of time tweaking, and that was the game’s mid-boss: the Wayward Bear Adolescent (or just Wayward Adolescent). Which is a large bear-like creature with an armadillo looking shell on its back. You come across it after going through a door in the pyramid in Level 3. The problem with this boss though, was that it was pretty much developed in a night. Lost Caves started out as a project for a college class, and the night before it was due, I was adding in the boss you fight. I honestly would have still gotten an A even without it, but the game wouldn’t feel complete without it, so I quickly threw it together. The result is a playable, but buggy and rushed boss. It had a lot of spaghetti code too. I was new to Unity and C# though, so can you blame me? Anyways, it was fine time to rework this boss from the ground up, and that’s what I did. Below is a video showing the original boss fight compared to the updated one. This devlog will go more in-depth though and explain my process and reasoning for why I did certain things with the updated boss fight.

While I wanted to keep the same basic principles of the original boss fight, I decided to re-code the boss from scratch. I did this for two reasons. One: I wanted to keep the original version to serve as a comparison (particularly for the above video), and Two: the code was such a mess that it’d be best for me to make a much cleaner and more organized script that would be much more readable.

I also decided to take advantage of Unity’s animator, and used that for specific movements that I wanted the boss to have, such as its entrance animation, where it bursts out of the ground in a ball form before hitting the ground and "unrolling" itself. For the first boss, I specifically decided not to use an animator since I felt that it wouldn't be very resource-efficient, and just went for changing velocity for different parts. As a result though, I lost a lot of control over how I wanted the entrance of the boss to look, so for the updated version, I used an animator instead. I use the animator for the boss’s entrance where it bursts out of the ground, its roaring animation, and also other things, but this led to an issue. If I use animations that control the boss’s position, I’m unable to change its position manually, so it can’t freely move. You can move it freely though if the animator component is disabled, so I added code to disable it after the intro so that I could modify its position for the fight.

The boss bursting from the ground in ball form.


The boss’s beginning attacks are the same as the original, but the code for it is much more readable. Both bosses start out jumping and stomping on the ground that causes rocks to fall. The new boss’s code allows me to specify how many jumps I want it to do, so I can change it on the fly if I want the boss to do more jumps when more health is chipped away from it.

After the repeated stomping, the boss then hops around back and forth in the arena. A blue rock falls from the ceiling after the last stomp. Blue rocks bounce when you hit them, and can be used as a projectile against enemies, this boss included. There was an issue with the original boss though, where if it hopped towards and collided with the blue rock, it would kind of “slide” over it, if that makes sense. It also slowed down the boss’s movement significantly and just generally did not look good. For the new boss, this would also be an issue. I could set up some IgnoreCollision code or put the rock on a layer the bear can’t collide with, but I only have so many of those layers, and I also need it to detect collision when a blue rock is flung towards it, so that’s all out of the question. What I ended up doing, is having the bear detect if a blue rock is front of it, and if it is, it will do a large forward leap to go over it. It doesn’t make the problem go away every time (especially if the rock is on either edge of the arena), but 99% of the time it does. This forward detection it does consequentially makes it more difficult to hit it from the front. Not sure if I’ll change that though. We’ll see.

Michael after hitting the blue rock, with it going towards the boss.



When you hit the boss with a blue rock, it will get flung back, landing on its back, and be immobile for a few seconds, allowing you to attack it with a repeated pickaxe pogo. After this point is where the original boss and the new boss begin to differ significantly.

The original boss, when stunned, will be immobile for a few seconds. You can pogo on it during that time, but it’ll eventually spring back up without warning, so chances are you’ll take damage the first time. It jumps high in the air, and the force of it hitting the ground causes a bunch of small wayward cubs to fall from the ceiling. The updated boss is immobile for a bit longer, and a second before it springs back up, its sprite changes to warn you. As for landing back on the ground and dropping wayward cubs, I thought it was kind lame, and the accumulating amount of cubs can get really annoying and is kind of a cheap difficulty increase. For the new boss, I wanted something way more interesting.

Michael pickaxe pogoing on the updated boss while it's stunned.



Initially, I was thinking of giving the boss a sort of spin-dash move after recovering, similar to Sonic the Hedgehog’s. It would roll into a ball, spin, and then rocket towards you and attempt to run you over. However, I felt that this wouldn’t be too original, so I went with a much better idea.

Wayward bears in Lost Caves are shown to be burrowing animals. They’re a subterranean offshoot of bears that have evolved for living underground, and having digging properties as a result. I really wanted to drive that point home, so instead of having the boss roll into a ball and roll towards you after recovering from being stunned, I have it so it jumps into the air, rolls into a ball, and burrows into the ground. It will then try and get underneath of you, and chase you from underneath for about 7 seconds. Afterwards you get 1 second of delay before the bear bursts out from the ground.

Digging particles show where the boss is in the ground.


 For the boss’s entrance back into the ground, and for it bursting back out from the ground, I hit a bit of a predicament. After it finishes its intro animation sequence, the animator is turned off to allow for free movement. I wanted to have the entrance back into the ground, and its burst out of the ground to use animations, however. I could just re-enable the animator, which I did, but this leads to another problem. The bear itself is a child of a parent game object. Animation keyframes for position or absolute, so if you have an animation where you move from x position 1 to x position 2, it will move between those absolute values, and not relative to its current position. Having a parent game object addresses that problem and allows you to move the animated child game object (the bear in this case) with the parent since the animation will derive its x and y positions relative to the parent’s position. The parent during the boss fight is static though, so if I want the boss to do an animation for entering the ground, it’ll snap back to its original position, but I want the boss to be able to do this animation anywhere in the arena. In order to do this, I had to do some interesting movement between the boss’s parent container, and the boss itself.

Normally, you make a game object a child of another game object so that it’ll derive transform info from its parent. If the parent moves 1 unit up, the child does as well. I needed the reverse to happen though, and I needed the parent to move to where the child is, but I can’t have the child move. Thanks to me having access to local position and also world position in code though, I was able to make this work. This is all very technical, and hard to explain, so I apologize if I’m boring you with that.

Anyways, I was soon able to get the burrowing sequence working. It goes into the ground, and it pops back out. After that, the entire fight sequence starts over again. It’ll stomp and cause rocks to fall, and a blue rock will fall, allowing you to hit the bear, attack it, and then the bear goes back to burrowing into the ground. Rinse repeat and you can defeat the bear. 

To add some flair to the fight though, I have it so that the bear will get progressively faster, and do more stomping to cause rocks to fall as you damage it more and more. Once you defeat it, a bunch of cliché explosions will happen around it before one large explosion, after which three chests will pop up, along with a spring that allows you to exit the arena.

Your reward for defeating the boss.


Redesigning the boss was a lot of fun, and looking at my old and new code really makes me see how far I’ve really gone in coding and coding etiquette. The original was pure spaghetti code and would be really hard to read for someone who hadn’t worked on this project. The new code is way more clean, with everything isolated to its own method, with everything being very readable, and if something wasn’t super easy to understand, I’d leave a comment on it so that I’d realize the function of whatever line of code that is when I go back to it. The boss was a simple one, so even re-coding it only took a few days, but it made a world of a difference.

Get Lost Caves

Buy Now$6.99 USD or more

Leave a comment

Log in with itch.io to leave a comment.