Salutations,
So this week I worked on something a bit different. I added a few more types of goblins, and made some changes to the way they’re generated, as well as some other changes to make more of an impact – so let’s take a look.
Starting with some changes – some enemies can now land critical hits. Unlike the player, it’s not just a simple damage multiplier – and not all enemies can do it. Instead, they can apply a specific effect on the player (or themselves) – depending on what makes sense in context.
To give an example, the new rogue goblin…
Armed with two daggers, this sneaky little goblin can land a nasty critical hit on you
This particular one reduces your damage reduction – so you take more damage from their friends.
Another new goblin type I’ve added is the Runesmith – this support goblin boosts the defense of friendly goblins, making it harder to hit them. They also have an animation of a rune of defense emanating from below them every so often, to clue you in on what’s happening.
And one more – the goblin alchemist. These ranged units will throw dangerous vials of explosives at our hero, but once in a while they’ll throw something a little more toxic.
This toxic grenade will start spewing green gasses shortly after it’s thrown. You have the opportunity to get clear of it – but if you don’t, you’ll suffer the “poisoned” effect for a while – which will reduce your strength and agility, making you easy prey for other goblins.
So, let’s take a look at how they’re generated after the changes I’ve made – this will get a bit technical but I think it’s an interesting look all the same.
So, let’s start at the very top. Every enemy we intend to generate has a level, and a combat role (attacker, ranged, or support). To keep the generation balanced and interesting, I now define a number of squad archetypes – each having a specific size, and what they can be made up of:
When we spawn enemies in a batch – we define how many enemies we want, give or take, if there are any special enemies which must be spawned (such as the sentries or the sappers), and then the code will pick a squad composition at random with a total which matches the desired amount.
So, then we need to fill the squad out with actual enemies. Each location where we want enemies, we also define the range of levels which they belong. I group those into “bands” and then we can generate different enemies of each type depending on the band:
Taking this one as an example – the Warboss and the Runesmith are all support enemies. Depending on the level we’re going to generate them – we can generate a Warboss at any time, and a Runesmith only if we’re in band 3 or 4 (which works out to be from level 50 up). This way, we can keep the nastier enemies for higher levels, and the easier ones for earlier.
However, even if we decide to spawn a Warboss – we still need to pick equipment, and even that is broken down by level band – taking a quick look at that:
Enemies use equipment the same as the player, and they’re given the same bonuses for doing so. But let’s take a closer look at what we’re looking at.
So, both these items – Stone Sword and Stone Mace, are in Band 2 – so they can be used by enemies above level 25.
The “Prefab” and “Game Objects” properties defines how to show this – in this case we’ll create the actual weapon in their hands. Some enemies will have these properties left empty so they don’t show what they’re wearing or carrying if it makes more thematic sense (ex: the skirmisher is technically armed with a dagger)
The Equipment property defines which equipment we’ll take the stats from – in this case, despite the fact that it looks like a stone mace, it really uses the equipment properties of the copper mace that the player would use. And if you defeat this enemy, there’s a chance they might drop this item – and this item being a Stone Mace as defined up there.
So, that’s about wraps it up for this week. Next week I need to finish off the last new enemy type (and might consider adding something similar for the everpunished), and after that – the final boss.
Til then