Minefields

Space-mines are too cool a concept not to get into Starsector at some point. We’ve talked about them internally many times in the past, and while the idea is very neat indeed, there are several design pitfalls to watch out for. What I’d like to do in this post is talk about the design process for minefields – what the impetus for adding them was, how I approached their initial design, and how it evolved during the implementation.

Motivation
First off, why add mines now? The answer is for orbital station battles – those present several design challenges, one of which is that they both need to start off strong at the lowest “orbital station” tier, and grow in power as they progress to “battlestation” (tier 2) and “star fortress” (tier 3).

A battlestation is notably bigger and stronger than an orbital station, and that’s nice upgrade. A star fortress, however… one can’t just glom on more modules and make it bigger. Having too many modules makes a station fight less interesting – the station becomes just a mass of stuff to shoot at rather than individual modules with strengths and weaknesses.

minefield

What we want is for the star fortress upgrade to make the battlestation more powerful while not compromising what makes the original design interesting. There are several components to this, and one of them is a minefield maintained around the star fortress.

Pitfalls
Mines have one big potential design issue. Suppose they’re capable of destroying enemy ships by themselves – that would incentivize the player to avoid combat entirely and let the minefield do all the work, while they hide in a corner in a frigate or some such. That would be both optimal and extremely boring, i.e. just about the worst design problem to have.

(I’d like to take a minute to address a sentiment I hear from players fairly often – that it’s ok to have things like that in the game, because ” most players will avoid things that aren’t fun”. Even if that were true (and it absolutely isn’t), let’s consider a case where the player is indeed avoiding otherwise-optimal things that aren’t fun. And then they find themselves in a tough spot, where the choices are 1) lose or 2) do something optimal and boring for an hour. Point being, these sort of mechanics being in the game will get the player one way or another.)

Fortunately, for a station battle, this isn’t an issue – the station can’t run and hide, and the player needs to defend it. This is the deciding factor that actually lets us put minefields in the game.

Mine Design
What we want from minefields, then, is to 1) make the fight more interesting and 2) make the star fortress stronger. The latter goes without saying, perhaps.

My initial thought was to have mines fade in near the attacking ships, drift towards them, and explode when in range of a proximity fuse. You can’t just have random mine-strikes directly dealing damage to ships – that would be too frustrating.  There needs to be a warning period during which the targeted ship can react, by either shooting the mine down or evading it.

In addition, there’s a design question – should just mines be able to deal damage? That is, if a ship is in a minefield, but otherwise not under any pressure, should it eventually take damage? I think the answer to that is a firm “no”. Taking gradual mine damage just isn’t interesting – it certainly adds difficulty to the fight and so fills that requirement, but if some of this damage is ultimately unavoidable, then it’s just not an interactive enough mechanic for it to be fun.

Mines, therefore, should be purely a support weapon – barring mistakes, they should deal no damage on their own. Almost counter-intuitively, this allows mines to deal a lot of damage when they do hit – since the damage is avoidable, a hit is punishment for a misplay, and so can be quite powerful. In fact, it should be, to make mines a prime consideration for the player. Of course, when combined with pressure from enemy ships or the station itself, mines will be much more difficult to avoid.

(You might ask, if mines deal no damage on their own, doesn’t that solve the issue with having mines in a normal battle? If they deal no damage, then hiding away and letting them do the work won’t accomplish much. This is true, but we’d have to be extremely sure they don’t deal damage by themselves, under any circumstances. For a vs-station battle, there’s a lot more leeway.)

Initial Implementation
Armed with this line of thinking, I went ahead with an initial implementation, using the graphics for the proximity charge as placeholders – a bit drab for the role, but serviceable.

mine_init

The initial tests were super promising; thankfully, this did not turn out to be a case where implementation details completely upended the design and forced a complete re-think.

There was still lots of fine-tuning, of course – how frequently mines spawn, how far away from ships they are when they do, and how quickly they move/how durable they are. These details all combine to make sure that mines are hard-countered by a combination evasion and point-defense weapons.

A nice property emerged during testing – since enemy mines only spawn a certain distance away from your ships, grouped-up ships are “safe” in that mines only come in from the outside. A ship can make a sally for a quick flank or an attack on a vulnerable enemy ship, and be more exposed – but then dart back into safety provided by friendly ships – especially if they have point-defense weapons.

In general, this sort of mutual support by ships is important in vs-station battles, since those tend to be an endurance test for your ships, and the opportunities for a ship to reset and vent flux nearly require friendly ship support.

Design Adjustments
Barring the placeholder graphics, the initial implementation was very much workable. But, I was still thinking through the design and thought-experimenting various scenarios – if we’re being honest, just because it’s so much fun to do.

One such scenario was, what might a frigate do if it’s surrounded by mines? It’s not a practical concern – not enough mines spawn to do that – but let’s roll with it. The frigate pretty much has to bull through one part of the encirclement and hope for the best – not much room for finesse there. What if mines could be juked, though? Let’s say triggering the proximity fuse set off a timer instead of an instant explosion – the frigate could then trigger a mine, back off, let it explode, and then run through the gap unscathed. That sounds more like it!

This change makes the mines easier still to avoid, which means it allows/necessitates higher damage per mine. That’s another positive, since mines weren’t quite feeling dangerous enough. It did mean that the explosion animation felt too underwhelming, but a more detailed explosion core took care of that.

mines_explosion

The mine visuals also need to convey the mine’s behavior to the player *and* attract their attention at the right time. The mines are highly dangerous, so they – and their state changes – should be highly visible. Thus: when the proximity fuse is set off, there’s a bright flash around the mine, attracting the player’s attention. This is followed by a series of more and more frequent smaller flashes, to signal the impending explosion.

(I will note that that nailing down the visuals took quite some time. There are no less than 5 different mine graphics laying around, and we’ve explored several options for approaching the animations.)

With that (pending some custom sound effects), it felt like minefields were in a good place.

Doom
About this time, David suggested the idea of minelayer ships. There’s a lot of potential there, though it also risks the main pitfall we talked about earlier, and it also might make mines feel too common-place – but that got me thinking about using the mines in more places. They turned out pretty neat (if I do say so myself), and it’d be a shame to restrict them entirely to star fortress fights – there’s a range of possibilities between “too common” and “too rare”.

So, alright, if a ship can use mines, it’d have to be a pretty special ship, not your run-of-the-mill workhorse. And the Doom-class phase cruiser happens to 1) be rare and “special”-feeling, 2) under-powered, and 3) in possession of an unimpressive active ship system.

For those not keeping track, that system is an “Interdictor Array” which partially flames out the engines of an enemy ship. It sounded good on paper, but just didn’t stack up – mostly, I think, in light of the ship’s other qualities. A phase cruiser is an inherently disadvantaged role – phase ships don’t have shields and rely on speed to avoid taking damage.

(Phase cloaking speeds up a ship and makes it invulnerable – it can pass through all solid matter, energy beams, and so on – but it can’t attack while cloaked, and the phase coils need to cool down before it can cloak again, meaning it becomes vulnerable the instant it chooses to attack.)

A cruiser with any reasonable top speed is still  too slow to take advantage of the flank-enabling benefits of phase cloaking, while suffering even more from the lack of shields. It’s big enough to attract more enemy fire, and not sturdy or fast enough to avoid it.

Mine Strike
Can we use a mine-laying ship system to make the ship more appealing? (Spoiler: I’m sure we can, it’s just a question of how far we’re willing to crank up the mine insanity.) The idea behind phase ship design, and in particular their active systems, is that they should feel a bit unfair, but still be counterable in some way. Phase ships should feel dangerous, but they should not auto-win.

Enter a new system – “Mine Strike”. It teleports a mine somewhere in the targeted area, at long range, and has limited, but rapidly regenerating charges. Having five mines come into being behind your ship certainly feels at least slightly unfair, so, check. But there’s ample time to avoid or shoot them down after they trigger, so, they’re counterable: also check. To add an extra flourish of unique-feeling and unfairness, mines can be used while the ship is phased – the only way in the game that a phase ship can deal damage while  its phase cloak is on.

Some playtesting later: yep, this feels good. The mines are near-useless by themselves – a feature of their design for the minefield, which works nicely here. No matter how much they’re spammed, they’ll get shot down or just moved away from. But add in extra danger or pressure? They become an almost absurdly powerful finishing move, with the damage level of several heavy torpedoes, but without the ammo limitations.

This makes the Doom more of a team player, like other phase ships, and helps mitigate some of its drawbacks, since it no longer has to get into a compromised position to be effective. The high mine damage means it has new loadout options built around facilitating mine strikes.

doom_mines

All in all, it feels like a very fun ship to pilot now, one that offers a wide range of tactical options, and finally one that can justify its deployment cost.

AI Changes
An often-forgotten aspect of new features is how they affect the AI, and how much effort is required to get the AI to work with them. Otherwise-fun sounding features could make the AI’s job impossible, and so do more harm than good in the long run.

Fortunately, mines aren’t too tough to handle. Point-defenses already shoot down missiles, and ships already avoid them – and mines are implemented as missiles under the hood. The one complication is that the AI computes an estimated time until a missile hits, and uses that to figure out if it’s dangerous or not. Since mines stop when they’re proximity-triggered, that makes their ETA infinite, so the AI ignores them. Thankfully, there’s an easy fix – for primed mines, making the ETA be the time-until-explosion instead, provided the ship is within the explosion’s range plus a bit.

The other concern is the mine strike system’s AI. That’s a bit more involved, but the system has some qualities that inherently make the AI easier to write. One is that it’s hard to mess up using it. The worst the AI could do would be to place mines near itself or a friendly, but that’s easy to check for. The other is that it’s easy to use decently well – even just spamming mines at random enemies would be halfway-ok, since they’re flux-cheap and not ammo-limited. An ideal ship system has a medium skill floor (to ensure competent AI use) and a high skill ceiling (to reward effective player use). This fits the bill near-perfectly.

poor_daggers

The system AI uses a fairly versatile scoring system to prioritize mine-targeting. For a proficiency test, it had to solo an Astral carrier – which it did, laying mines ahead of incoming fighter flight paths, then crippling the fighter wings trying to regroup behind the carrier, and eventually pressuring and destroying the carrier itself.

To wrap things up – and hopefully get you as excited about mines as I am – here’s a shot of them in action:

 

Comment thread here.

 

Tags: , , , , , ,

This entry was posted on Sunday, March 25th, 2018 at 6:28 pm and is filed under Development. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.