Building a combat system
Published by James on 31/07/2024Hey Kinoko fans!
If you regularly follow our blog here on our website, you may remember I said at the end of last month that my priority for the second half of 2024 would be getting our game into a demonstrable, and hopefully playable, state. This month, I’ve made several major strides towards that goal by redesigning our game’s combat system from the ground up, implementing a whole new style of melee combat, reworking the raygun, and thinking ahead to where we want to go with it next.
Combat in our game has changed several times already, since we never really sat down and thought about how we want it to work and feel, but what has remained constant throughout our game’s development is that Kinoko can fight either with his fists or his raygun, whilst also having access to starsprites for hitpoints/shields and passive abilities or buffs. Kinoko’s singular melee attack (a spin) was available to the player at all times, but the raygun required charge to use, and starsprites would only provide their buffs until absorbing damage for Kinoko and being forced to flee to recover.
Being functionally similar to the Aku Aku masks from the Crash Bandicoot games, it used to be the case that starsprites were collected from crashed meteorites and then served as Kinoko’s hitpoints/shields until they were lost, at which point they would fly away taking their various perks and buffs with them – but last month I decided to rework them, and now Kinoko can collect starlight and use it to summon starsprites on command. That by itself I think is a better experience for the player, since they have more control over how and when they use their starsprites, but it was the precursor for what has now become a full combat rework.
In this blog post, I’m going to briefly go over the three styles of combat – hand-to-hand, long-ranged, and starsprite combat – and explain our thoughts behind each one, where we’re at with them currently, and what we plan to do with them going forward.
Hand-to-hand combat
It might not be the most exciting or visually spectacular of the three combat modes, but Kinoko’s primary form of attack remains hand-to-hand. It’s simple and it gets the job done, but it’s still been redesigned to better-reflect Kinoko’s agility and feel more impactful. To that end, we’ve replaced the basic spin attack – which, again, was inspired by Crash Bandicoot – with a series of punches and kicks, designed to feel reminiscent of more combat-centric ‘hack-and-slash’ games like Castle Crashers.
Whilst implementing these new attacks, which play out sequentially but otherwise behave the same, I took the time to consider things like sound effects in order to give the attacks some ‘weight’ and make it feel like Kinoko’s actually throwing punches. I also decided to add numbers to the screen showing how much damage each attack did. They’re probably a bit big at the moment, especially when dealing with numbers like ones and twos, but I’m considering possibly making them scale with the precise damage amounts. I’ve also implemented critical hits, which are statistically uncommon, but which provide a welcome multiplier to damage dealt.
Something else I added whilst implementing these new hand-to-hand combat mechanics was enemy physics. Whilst these won’t be relevant to all enemy types, being able to punch an enemy around the screen definitely helps give Kinoko’s punches and kicks more ‘oomph’. One of the new enemies I’ve created for the sake of prototyping combat – the Fungaian cave worm – takes full advantage of enemy physics when Kinoko physically kicks it out of the ground before it has a chance to burrow and sneak up on him again.
Unlike the previous form of hand-to-hand combat, which could be used during movement, these new attacks can only be used on the spot. If he performs his melee attack during movement, he’ll stop and use a different attack instead: a sweeping kick, which can behave differently for various enemy types. His hand-to-hand attacks can, however, be used in the air to ‘juggle’ enemies before they have a chance to hit the ground, and we also make an exception to the ‘no movement’ rule if he’s sprinting – in which case the standard punch is replaced with a spin, useful for cutting through enemies on the move!
Whilst redoing Kinoko’s hand-to-hand combat, we took the opportunity to redesign his dive attack too. This one has a wider ‘area of impact’ than the standard melee attack, potentially hitting multiple enemies at a time if there are several very close together. (I was directly inspired by Ori and the Blind Forest for the redesigned dive attack, which I started playing recently, because of the way that it feels nice and impactful, just the way we want all our attacks to feel.)
Hand-to-hand combat isn’t completely finished yet – there are still several more attack types we want to add, such as an aerial dust attack – but I think it’s on the right track, and I’m excited to introduce more enemy types and continue extending the moveset!
Long-ranged combat
When looking to rework Kinoko’s raygun, the first thing I decided to do was remove the need to recharge it. Recharging it was never particularly problematic – it worked like a cooldown, so it would deplete during shooting and then recharge when no longer in use, and the rate of recharge was (to my surprise, since I forgot until I looked over the code again) modified slightly according to how many starsprites Kinoko had with him. Nevertheless, I felt like it was unnecessary. The raygun isn’t supposed to feel ‘better’ than hand-to-hand combat, but nor is it something we want the player to be forced to use sparingly. It’s an alternative, not an enhancement or a replacement.
Truth be told, I actually wanted to scrap the raygun for a time, but luckily Chelsey wouldn’t have it, since Kinoko’s raygun is a pretty important part of his image! We’d already begun talking about adding starsprite combat abilities, so I guess I was unsure where exactly the raygun would fit. Removing the need to recharge helped, but I still wanted to do something to properly differentiate the raygun from hand-to-hand combat. In the end, what I decided to do was designate the raygun specifically as a form of long-ranged combat, inferior to melee in close quarters, but superior when attacking at a distance, or when the player has a little more time to plan their attack.
To achieve this, I’ve made the raygun capable of two different kinds of shot: the quick shot and the charged shot. The quick shot is activated by tapping the shoot button, and it’s exactly what it sounds like – a quick shot which gets fired with minimal delay, travels a short-medium distance, and deals damage to the first enemy it hits. The charged shot is activated by holding down the shoot button for a time before releasing it. The shot gets ‘charged’, indicated by a glowing ball of light around the muzzle, up to its maximum level after about three seconds. When released, it’s faster, travels further, deals more damage, and even hits multiple enemies if charged sufficiently.
As well as removing recharging, I also removed the ability to aim the raygun. I had implemented eight-point directional aiming and shooting, and I was actually rather proud of it, but all my raygun changes have been with the aim of keeping things simple. I’ll see how things go without aiming, as I don’t believe we need it, but if necessary I could perhaps make it so that shots fired can ‘home in’ on nearby enemies as a compromise.
Months back, Chelsey came up with some concepts for different raygun modes, and we’ve talked in the past about things like freeze rays and stuff. Those ideas aren’t completely out of the window, and we may yet implement them – but for now I think I’m going to leave the raygun exactly as it is currently. Starsprites are next, and I’m keen to ensure that the raygun continues to occupy its own role without doing things that would be better served by starsprite abilities. Once we’ve established what starsprites do, that will be an appropriate time to return to the raygun and think about what else it can offer.
Starsprite combat
That brings us nicely to the final mode of attack: Kinoko’s starsprites.
When we first added starsprites to the game, we envisaged them as a combined system for hitpoints and passive power-ups. Our thinking was that Kinoko would have just a single hitpoint, but that he could acquire up to three ‘additional’ hitpoints by finding starsprites in crashed meteorites – and then, as a bonus, enjoy passive buffs according to the colours of his starsprites for as long as they stayed with him. This approach had a couple of problems, however. Firstly, I didn’t necessarily like that the player was effectively ‘punished’ for having no bonus hitpoints remaining by also losing their buffs. Secondly, I didn’t like that it made Kinoko’s companionship with the starsprites feel ‘passive’ and coincidental. The player ought to feel like they’re in control, summoning starsprites on command!
That’s where starlight and the idea of summoning starsprites instead of encountering them randomly came in, but it also feeds into something that Chelsey’s wanted to add for a while now, and that’s the ability to directly utilise Kinoko’s starsprites in combat to fend off enemies. Hence, we now plan for starlight to offer him a wide range of magical attacks and abilities, letting the player feel like a true friend and companion of the stars.
We haven’t made it as far as designing any of these abilities just yet, so I’m afraid I can’t go into specifics in this month’s blog post, but they’re going to be our focus throughout August, so we ought to have more details shortly. What I can say at this point is that Chelsey’s been busy designing constellation skill trees and designing things like perk points and temples. One of people’s favourite things about a metroidvania game is usually its skills and upgrades, and on that side of things it’s through the starsprites that our game is going to deliver. Summoning starsprite shields is just the start, and we have lots more ideas where that came from.
By the time starsprites are implemented with a few working abilities, and we’ve gone back to the raygun and thought about any other ways we can extend or improve that functionality, we ought to have a great combat system in good working order! We’re going to need lots more enemy types if we’re going to do it justice, but I’m thinking five or six ought to be a good number of enemy types for our first demo, as long as they provide opportunities to try out each of the three different combat styles.
In terms of how combat will factor into our game generally, we do plan for there to be plenty of fighting, and further down the line we’ll be looking to introduce bosses too, so that’s why we’re taking the time now to redesign combat and make it as satisfying, impactful and enjoyable as we can. As a programmer, enemies are my least favourite thing to develop, but I’m getting better at it the more I do it, and I at least know that Chelsey is going to design some absolutely incredible enemies for us. Fungaia is one thing, but I’m very excited to see what she comes up with for our other planets too…
Anyway, that’s everything for this month. I’m very pleased with all the progress we’ve made on combat, so I decided that’s all I’d talk about in this blog post in order to give it some kind of focus for a change – but next time I’ll try to talk about some of the other, non-combat changes we’ve introduced too!
Until then, take care.