You can zoom in at any time to see the fate of individuals, but that's not a very useful perspective to direct a battle from, which means players spend most of their time zoomed out. The intent of this feature is to highlight things happening in the battle and to show you the faces of the people who are fighting and dying for you.
The hard part of creating NPC lines is that they can be very, very annoying.
- "It sure is cold outside tonight."
- "The price of wheat has risen."
- "The Clyptrastian Empire must pay for their crimes."
- "When do you get off duty?"
So what can I do as a game developer to make them immersive rather than annoying? Make them sparse, make them relevant, and make them varied.
The system I constructed works in two stages: the combat checks for particular conditions to occur and generates "interesting events". The crew message system then goes through those events, checks whether they're clearly visible to the player, and matches them against crew lines.
So for example, if a crewman is snatched up by a kraken tentacle, this generates an event called "grabbedBy SQUID" at the location of the crewman. The message system applies the following checks:
- Is the event within the field of view of the player? That is, within the center 70% of the screen, horizontally and vertically.
- Is the player zoomed in enough to see what's going on? For some messages, there's also a maximum zoom level, so if you're looking at a detail, it will ignore events that are about the combat as a whole.
- Is there a fitting crew line to deliver? It can partially match against event names, so if there's a line specific to being grabbed by a kraken, that would match against "grabbedBy SQUID", but there can also be a fall-back for being grabbed by some other kind of tentacle that matches against anything starting with "grabbedBy".
- Has the same crew line already been delivered in the same combat? You don't want the same message to pop up each time someone has an encounter with a tentacle.
- Is there another crew line already visible, or was there one very recently? Forcing the lines to be spaced out a bit prevents them from being too visually distracting.
If all those checks are passed, the system will pick a crew line and display it. The idea is to generate lots of opportunities for lines, but then to filter them very strictly to deliver a few high-quality ones. Each line has multiple variants as well, saying the same thing using different words.
The following events are currently tracked and can create crew lines:
- Overall victory and defeat.
- A large explosion.
- Destruction of the largest ship in a fleet.
- Large numbers of boarding casualties.
- A ship is about to intentionally ram another.
- A ship is about to heavily crash into or be rammed by another.
- A ship is about to crash to the ground at speed.
- The enemy has some unusual units, such as monsters.
- One side is much stronger than the other at the start of the battle.
- A module is about to explode.
- A ship is captured.
- A crew member is grabbed by a tentacle.
- A crew member grabbed by a tentacle is devoured.
- A crew member is killed by a boarding monster, such as a black widow spider.
- A ship is hooked by a giant spider's web.
Ideas for additional interesting events are very much appreciated, and so is feedback on the quality and frequency of the lines delivered.