2D Platformer Boss "Code Design" Discussion

First of all, i tried to make the title as short as possible, but when i say 2D platformer Boss i’m having as reference bosses from games like " I wanna be the Boshy" or " I wanna be the guy" ,“Dead Cells” and even “Salt and Sanctuary”. Also, the title says 2D Platformer boss, but it doesn’t necessarily needs to be a 2D Platformer Boss, just fulfill this discussion. I’m saying Paper 2D because that’s the type of game i’m making.

So, i was starting to learn how to play with AI and when i tought i was good enough, after making some very simple npcs that would just detect you, go towards you and attack you with what they have, i tought i could make things a little more complicated, and with complicated i mean a Boss. The boss couldn’t be the most complex because i didn’t have enough assets, but i had enough to play around quite a lot. Oh, and it was all with Paper2D.
The boss was basically Hoshigaki Kisame from Naruto, i could find quite a lot of sprites for him, like defend(which i didn’t implement on the boss), strong attack, weak attack(that was a combo of 3 hits) and 3 specials. I also had assets for “Boss Stages”, but i didn’t even tried to implement it because my problem appeared right on the beggining.

What i had done so far was : Strong attack (it would knock you and throw you), the Weak Attack (that were 3 consecutive hits) and his 3 Jutsus (specials), but after implementing and testing those things i realised i had no idea on how to “Code Design” the actual Boss. I was simply using random values to choose what attack he was going to do and if it was a special, choose which one, randomly, and putting a cooldown on his specials. After i realised it was really bad, I tried to make some basic Stage system to try to balance a little bit, making him only use certain specials at certaing HP or below. Needless to say it worked, but it felt terrible. Totally didn’t feel like a Boss. Some times the fight would start and he would kick the **** out of me with several specials in a row, or simply don’t use it for quite a long time. When he reached his Final Stage , sometimes he would cast several different specials in sequence, and if i didn’t have anything to run i’d simply die. Everything was random, the fight could be extremely easy and sometimes just impossible.

And this is what i want to discuss, how to actually Design the code for bosses like those, how he decides if he’s gonna run after you and use a melee attack, or if you go too far he’ll use a ranged attack, or try to keep distance to throw his ranged attacks, when to use special moves, which ones, how a new “Boss Stage” could affect him, etc , instead of just random stuff. How to design things like patterns to the boss, even if with some randomness, so the player can actually have a plan and don’t play with luck only.

well I know that there is a distance function to where you can tell how far too actors are away from each other. For example in my game my monsters roam until the player is <= 2400 units away. Then they shoot. For your game you could do something like if the player is 2000 units away activate ranged attack.

For when to use special moves, maybe you could do something like everytime he does 3 regular attacks, make him do a special. That way the player can learn that “ok he does this special attack after 3 normal attacks so I better be ready”. It really depends on how you wanna do it.

When you say Code Design, what differentiates that between say just plain Boss Design or Game Design in general? And specifically platformers? If the goal is to create a satisfying boss fight, there are probably a few common paradigms to consider.

The easiest paradigm to implement would probably be a simple Boss Pattern design where the boss cycles through a certain attack pattern in a specific order until either you or him are defeated. You’d design a set of attack blocks or pieces of the pattern and run through each one until you’ve hit your last block before repeating. If you designed some arbitrary N attack blocks, you program the boss AI to run like this:

Do Attack Block 1 → Do Attack Block 2 → … → Do Attack Block N → Do Attack Block 1 → …

While perhaps dumb, the simple structure allows the player an macro obstacle to handle in that they’ll have to discover the attack blocks, then discover the looping pattern, and slowly plan how to successfully traverse and resolve each attack block in relation to the broader boss pattern.

I haven’t seen Naruto in years, but I remember Kisame being fairly strong physically, had a large spiky shark greatsword (Samehada?) that shaved chakra, and used water ninpou. So, for example, here’s a sample boss pattern:

Attack Block 1 could just be following the player before initiating a short attack string in a single direction once in range.
Attack Block 2 could be a short dash at the player’s location followed up by a delayed long reaching sword swing in the dash direction.
Attack Block 3 could be him surrounding himself with a water barrier that blocks damage at his current location that explodes outward, damaging and pushing away the player in a small area.

The first two attack blocks would be simple attacks with obvious vulnerabilities to exploit. The design of an enemy attacking in a singular direction that can be easily exploited by getting out of range of the attack before following up is pretty simple, but the process of learning when/where to attack is part of the process of the player learning and solving the problems of defeating the boss.

Attack Block 3 could be part of a kind of fight reset to force the player and boss be in a state to repeat the play pattern from the beginning. Or perhaps the player could be allowed to exploit position after the barrier explodes.

Learning the broader boss pattern, gives an additional layer for the player to recognize and plan against. Maybe attack blocks 1 and 2 have very few points of vulnerability and the period after the third attack block has the longest vulnerable period. Maybe the player has some special attacks that have some wind up period that can be timed for the period of vulnerability and player slowly starts to learn, plan, experiment, and execute.

The fun is specifically the learning, planning, experimenting, and executing. The traditional boss fight is essentially a much more challenging test of those skills that you’d have in typically game encounters and their design is learning how to craft encounters that are challenging and interesting.

I’d first try to build a boss fight following the simple boss pattern paradigm and then start experimenting with additions and mutation to the design. Some things to think about:
Conditionally branching attack blocks (conditionally branch between Attack Block 2A or Attack Block 2B)
Conditionally branching boss pattern (boss pattern may change dependent on what you did prior/during fight e.g. player completed a specific quest or has a certain item/stats)
Boss fight opt-in/waiver (allow player to partake/skip boss fight under the appropriate conditions)

From a design philosophy standpoint, try to think of ways to make the boss either challenging or interesting to solve. While you still ultimately need to implement the bosses, take a step back and ask what makes a boss fight actually fun.