• Register

Netherguild is a game about assembling an expedition deep into earth, exploring and bonding with your team members-it's also a turn based strategy-roguelite game set in a fantasy world with no magic.

Post news Report RSS Character Speech System in Netherguild

This sort-of-a-dev-log is about the character text bubble/personality/speech system I made for Netherguild. The idea behind it was to have characters "speak" and have more personality so players will get more attached to them- right before I murder these characters brutally in my rogue-lite strategy game!

Posted by on

Character Speech


This sort-of-a-dev-log is about the character text bubble/personality/speech system I made for Netherguild. The idea behind it was to have characters "speak" and have more personality so players will get more attached to them- right before I murder these characters brutally in my rogue-lite strategy game!

While in this specific post I try to get less technical and mostly talk about my experience developing it, improving it and getting to a place I'm happy with (in addition some nice features and cool ideas), I think it could be a useful for whoever wants to work on similar systems. Regardless, I hope you have an enjoyable read. Also, while we're on that topic- this is a long post, so maybe grab a drink and something to snack on.

So, how did I set out to do it?

Early planning phase


Since I jotted down this system in my Todo file, I had an idea in mind of using something akin to what Despair talks about in this talk about AI speech in GDC. Since it's an hour long talk, let me recap it by noting the main things I got from it:

- Characters response from database according to events
- Character responses can be made even more specific by certain criteria
- Characters can reply to each other
- A whole lot of inspiration (Thanks!)

In my game, characters are sort of randomly generated in a tree of questions and answers, kind of like a police interrogation:
What is your name?
This is a question that doesn't have any follow up questions, while-
Which class are you?
-has the follow up question of "what is your background?" "How much strength do you have?" because those are determined based on the character's class.

QnA system diagram

This entire thing happens in a text file- as such, and since I wanted characters answers to depend on their class and background (each background having it's own sort of "personality"), I ended up deciding that this will be my response database.

What I originally developed this system for: A DnD random character generator from a few years ago.

Implementation


So- I grabbed an old typewriter script I made, and prepared something basic so I can test the system out and iterate on it!

Text bubbles that follow whatever originated them.
Object pooling script for the text bubbles (Maybe link to object pooling)
Typewriter sound effect that I made for the typewriter effect script.
A script for invoking speech events according to who it should be called on.
A script for characters to respond to those speech events
Something that will get the responses, choose the best one or two of the player best ones and all the enemy ones and put those text bubbles there.
A bunch of "War Cry!" responses I wrote in the past depending on character backgrounds.

And so, I set it up- until...

Problem


I tried it out, and it was just really bad. It felt... wrong. Frustrating, even!
It was no good- I failed my first try!
But, why?
I took a small break, got some coffee, and then tried to figure things out.

Typewriter speed/sound


Some of what bothered me was purely a number's game- the text felt a bit too slow, and the pauses between each. and. every. space. just felt way too slow for combat, even if they worked perfectly fine for characters resting. I also didn't like the fact that as soon as I saw enemies and the music switched into combat music, I had to listen to a typewriter. I want to fight, not read! While having the text itself added to the atmosphere, having the typewriter-ish sound really distracted from it.

Characters speaking according to situation


Another big issue was this: Right now, combat can be initiated in Netherguild in two ways:
By stumbling upon and spotting bandits (Aggressive enemies)

Bandits Spotted


Or, by attacking crystal shrimp (Passive/Potential enemies)

Crystal Shrimp Attacked


Therefore, if a character attacks a crystal shrimp- the passive animal- if they say something like "Danger lies ahead!" , "I'll defend you!", "Purge the underworld of filth!" (Inquisitor Assassin, don't ask), or "Hostiles ahead"- it doesn't really feel right for enemies that were, well, already there.
So, the "combat invoker" script that was sitting on an enemy would be the factor deciding on which speech event is called: After all, characters should be able to say different things according to the situation, so it only makes sense that these two vastly different reasons for combat wouldn't cause someone to say the same line.

I think it's also a good idea to keep in mind that you don't want to break the flow of the game- if a character dies, you notice it, so the character saying something only adds to the moment, and other characters grieving or commenting on the death would also add to it, even if that last part might be potentially a bit spammy. On the other hand, if while the player is in combat and a character that isn't in the middle of the screen would say something (like commenting about the current character being stunned) it would be extremely distracting.

Character Death


Better passable writing


Something that felt really wrong to me, was the fact characters used "battlecries" when seeing enemies. I wrote those battlecries earlier (such as "Let's hunt!" "Not our first battle, not our last!" or so), but it felt a whole lot more organic to use "Enemies spotted!" or "resistance ahead!" instead of "For the king!"- seeing how when a player stumbled upon bandits, it was somewhat of a surprise rather than an action they deliberately chose- and what the characters say should resonate with the player, for the most part.

Still, using this mental dissonance can work sometimes. Either in rare occasions, or to express the difference between the player and a character- an example of that would be the criminal Assassin saying "Let the carnage begin!"- they're sort of written to be a rude psycho, so it only makes sense they'd take the offensive rather than care about their teammates and report the situation to them.

Multiple characters speaking at once


The final thing that bothered me was that when an enemy was spotted, a character would say something along the lines of "Enemies ahead!"- and when they were done saying that, the closest character to them would say something similar too.
Big oof.

Speech Positioning Diagram


While that made sense in my head for some reason, in actuality there's a lot of situations where the second closest character didn't have the line of sight to look at the enemies- and that aside, it was rather distracting to look someplace other than the side of the screen with the enemies or to wait for a long piece of dialogue / multiple pieces of dialogue before attacking.
The fix to that was simple: only using the current character. I originally was wary of that, because I was worried the player wouldn't get the content of other character saying their little combat sentences, or grow tired of that same character speaking all the time- but when testing, instead of spam it became un-interrupting background noise and part of the experience.
Problem fixed.
In fact, I even made it so that Rangers, the characters with the least health and usually last in the turn order would usually just say "!!!" which would add on to the player's feeling of total surprise when they unfortunately start combat with their last character - and sort of turned that negative into a positive, at least until I'll rework the turn system or so.

Additional features added


Criteria


Like in the valve talk, I wanted characters to have some context to the world. If combat ends and a character has low health, wouldn't it be nice if they request some rest or comment about being hurt?

Hurt Ranger requesting rest


Event criteria


What if I could send a bunch of criteria when invoking the event? Say for an instance the player is fighting a group of bandits, so a character would comment something about those "Gosh darn bandits!" or maybe comment on it when they're done fighting those bandits.

Flags (personal, story)


Flags, are pretty much a character's or the game's memory, in a sense.
On the technical side, they're sort of like a shopping list- so I can check if there's a certain item on that shopping list, add or remove values from it.
And so, I can use it to check if a certain event has happened- like a certain boss dying, or the character/s visiting a certain place.
So far, I used it so that each character will only comment on second location (The bluestone mines) once, in order to prevent spam and let other characters speak up.

North Guard Ranger talking about the Northern Lights


I also used it to have characters comment on how strange it is that there are bandits in the abandoned mines just once, and serve as a bit of a story moment-

[Gif/Video of characters commenting on bandits in mines]

(This happens after combat, and is a story flag)
Also, flags can be used to prevent spam! You can just clear them with code automatically in certain situations, so that you can set a flag if a character requested a bonfire or said that they're in pain so they won't spam the player with requests every time they fight and survive with low health.

Replies

(Notes- the text here is temporary/still early development)
Replies can be used to highlight the dynamics between different characters-
Whether it's their similarities
(Scouting unit scout + special ops assassin)

Scouting Unit Scout and Special Ops Assassin

Their differences
(North Guard Ranger + Mercenary Knight)

NorthGuard and Mercenary conversation

Or just for longer monologues
(Contractor Assassin)

Contractor Assassin Monologue

Character background descriptions


Character Background Description


In retrospect, one of the most simple and best features from this update was giving each class background a description. While not directly related to character speech, I definitely felt like this improved the player's idea of the world and gave them a better idea of who their characters are, and context for those character's speech and personality.
This is largely inspired by xcom, weirdly- since I really felt like the way I played and imagined characters depended on their largely limited backgrounds.

Things I might want to add in the future


Here's just some ways I thought about expanding this system, suggestions are always welcome too:

Moving/stretching character's heads up and down as they speak
Could be done pretty easily with animation blending in Unity- I wonder if it'd look good, but it could make for a pretty funny, cartoony effect. Could also be an abomination, who knows-

Character speech sounds
Either something akin to the synthesized character hurt "groan" sound or something similar to undertale's "character voices". Requires further testing.

Sound effects on eating
A suggestion by my friend Daniel, likely inspired by the game Battlerite- having a character go *NOM NOM NOM* in addition to writing it would be pretty great.

Enemy speech
An idea from when I originally set out to work on this system, was being able to make enemies more transparent. I ended up not implementing it yet due to time constraints and due to the fact the only enemy that really uses this uses more of a position-based calculation rather than a state machine.

Passive effects due to conversations
A suggestion by HallgrimGames and one of my testers named TJ, based on Endless Dungeon- where certain characters would talk with each other on the elevator ride between levels and expose more of their backstory, alongside with sometimes giving each other cool passive effects or, in one case, murdering each other (don't think I'll add that part).

Hopefully you enjoyed this text wall laden with gifs and videos! If you want to help me test Netherguild, you can do so at the Discord - or you can check out the site/social media here.

Have a great day!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: