Character Emotions Model

Today I am describing some of the most central components of Star Dynasties which make it a game about humans – Happiness, Approval, Empathy and Contact;  and how these interact with each other.


Characters have an overall happiness score, which is a measure of mood based on emotional reactions to events in the game.

Players can see the list of emotions with +ve or -ve modifiers that aggregate (non-linearly) to create a character’s happiness.

Emotions are generated by events. Updates show the direct emotions (not empathy – see below) that are created on key characters related to update.

To prove the point, let’s show what happens when you (playing as Leader Cristy Molina) unjustly torture one of your house members, Melodie Haynes.

Torture of Melodie Haynes

You can tell at a glance that Melodie is in a bad place from the colour and size of the bars to the left and right of her portrait – red is bad, green is good (mouse-over shows the values).


Emotions create opinions, based on how credit/blame is attributed for an emotion. For example, each time, Leader Cristy Molina tortures Melodie, she thinks less of him by -25 for each torture event (“Actions” opinion).

Opinion Change – Actions


Actions which have a moral dimension, i.e. that significantly break or reinforce the social code of this world, also trigger a public opinion reaction shown here under “Reputation”.

Opinion Change – Reputation

In the example above, a neighbouring faction leader has a -9 (Cruel) opinion of Leader Molina because of his actions.  Each character that knows of Leader Molina will form these opinions (to varying degrees, based on Contact – see below).

Opinions are also generated by other mechanisms, currently; personality, attraction, diplomacy, liking happy / disliking unhappy). These are all summarised under “Personal” opinion. Other sources will be moddable.

For example, Melodie’s “Personal” opinion of Leader Molina, ironically, is positive (+10) because their personalities are similar.

Personal Opinion


Now let’s say, you regret torturing Melodie and start doing nice things for her.

4 years pass. You gave Melodie a position on your council as your Head of Medical. You arranged for her to marry your son (and heir), and a year later they had a baby boy. Then you granted the couple permission to try for a second child (a favour in this world where living space is rationed).

So now Melodie is personally very happy …

Melodie – Effect of Positive Emotions on Happiness

… and now she is also close kin; your daughter-in-law, wife of your heir, and mother of your grandson which allows me to explain Empathy and Contact more easily!


Empathy is, as it sounds, the ability of characters to feel happy or sad based on their understanding of the feelings of others.

Star Dynasties models four variations (friend-happy, friend-sad, enemy-happy, enemy-sad), e.g. if you are my enemy, and something bad happens that makes you sad, I will feel happy at your misery.  Conversely, I will share my friends’ emotions and feel happy (or sad) when they do.

The amount of Empathy a character feels is modified by how much they like/dislike the other character. For example; following the birth of his grandson, Leader Cristy Molina feels more empathy with his son, Jake, whom he has a higher opinion of than he does for Melodie (but he does feel some empathy for her too).

Leader Cristy Molina’s Empathy

Empathy also generates approval so if A does something nice/nasty to my friend B, I experience a reduced version of the +ve/-ve approval emotion that B experiences towards A.

For example, because of Leader Molina ‘s +ve opinion towards his son; he experiences a smaller +ve “Empathy Approval” emotion towards Melodie for events which make Jake happy (e.g. birth of their son), i.e. he is grateful towards Melodie for making his son happy.

Direct Approval versus Empathy Approval

As an aside, Jake really dislikes his wife’s personality!

His “Personal” opinion of her is negative (-21) because although compassionate, she is also fickle, irresponsible, content and dull. However, his overall opinion of her is +ve (+18).

This is a good example of how opinions layer.



Contact is a calculation based on distance, importance, and social/political relationships between characters. It provides a heuristic of how much mental attention a character pays to another character (before factoring in how much they like/hate each other).

This is both realistic and necessary; otherwise, characters would experience empathy with every other character in the universe (e.g. no matter how far away, or how distant their relationship to each other is)

Contact affects Empathy, and Approval from Empathy, i.e. the amount of Empathy/Approval which a character experiences for another character is reduced sharply as Contact is reduced.

Leader Cristy Molina, his son, Jake, and daughter-in-law, Melodie, have high contact because 1) they are living together in the same colony (proximity dimension) and 2) they are very close kin (social dimension). Other factors contribute to Contact as well, for example, political dimension measures the relationships between Leaders and Rulers.

Note: Apologies for the lack of a visual here! Contact has not been included in the UI in the current prototype yet 

Want to Comment?

Please share your feedback about the Character Emotions Model and join in other discussions on the Star Dynasties reddit

Please follow and like:

Strategy Mode / Story Mode

I’m a big turn-based strategy game player, and a lot of the ideas behind Star Dynasties came from such games, including the way the player typically interacts with the game.

You see a map of the galaxy, which you can explore to understand your situation and work out what are the most important issues that you need to address, or what the next steps are to achieve your longer-term strategy of succeeding in the game.

Galactic Map

To interact with the game, you have access to a global list of all the actions you can take, or you can click on specific entities in the galaxy (such as a character) and see a list of the specific actions you can take that are context-specific to that character.  Your character has a set of action points that limits how many actions can be completed in one turn, and after you consume them (or when you feel there is no further good action to take) you choose to End the Turn.  I call this more typical way to play the game Strategy Mode.

Enlarge to see the full action list (top) and the context sensitive list (middle right)

Another Way to Play

As I described in the post about the game’s vision, Star Dynasties is designed to focus more on the human dramas of a feudal society in space, rather than the micromanagement of empire building or military conquest.  A consequence of this focus is that actions are similar to events in a narrative rather than task instructions, e.g. “Find a marriage partner for John” as opposed to “Move Unit X from Sol to Alpha Centauri”.

As I explored different ways to structure the UI, particularly trying to deal with early feedback that there was a steep learning curve to pick up the concepts of the game, I realized that the nature of the game’s action list allows the possibility of a seperate and complementary choose-your-own-adventure interface to playing the game, which I call Story Mode.

Instead of giving you the full set of actions to explore, the game presents you with 3 possible choices which the AI calculates as the most realistic actions that your character would take next, based on their personality traits, and current situation (with the occasional curveball thrown in).

Choose which narrative branch you want to go down

You select one action, and take any further decisions required by the process flow of that action (e.g. marriage action asks you to choose a marriage partner).  After the action is fully resolved, you are presented with another decision between three choices.  At any time, you can elect not to take any of the actions offered, in which case this is equivalent to ending your turn.  In most cases, however, multiple actions will be attractive and you will have to decide what to focus on, knowing that you may not get the same opportunities again as the simulation changes the world state.

Furthermore, the UI proactively fetches the information that is most relevant to each decision.  For example, if you are choosing between suitors in a marriage, as you mouse over each one, the UI will bring up that character’s details, their family, and their political house.  Lastly, decisions with lots of alternatives are simplified down to the subset that the AI thinks are the best.  In the marriage suitors example, the AI will shrink the alternatives down to the 3 that it thinks are a good match.

It’s important to note that beneath the changes to the UI, it is the exact same game and world simulation.  That said, the interaction mode you choose leads to two very different experiences.

Contrasting the two Modes

In Story Mode, the game feels considerably more like a narrative in which you roleplay a character and guide their actions.  Because the game does more of the legwork in filtering actions and presenting you with the information you need to take a good decision, it’s a more streamlined experience that allows you to focus on the story that’s unfolding.  It’s also easier to pick up when you’re new to the game, or if you don’t have a lot of time to devote to it.

In Strategy Mode, your ability to trigger actions that may be wildly out of character (such as declaring war on your best friend) gives you the freedom to choose how much you want to roleplay your character, or perhaps play the game in order to conquer the galaxy or build a powerful dynasty across the generations.  It can also be more satisfying if you enjoy exploring the world and it’s detail at your own pace.

I believe that most players will be naturally drawn to one mode or another, although not necessarily the one they expect – despite my background as a strategy game player I’ve found myself thoroughly enjoying Story Mode.

There is of course a cost, and a design risk, in implementing two interaction modes instead of one.  However, I am hoping that this is outweighed by the potential reward of engaging two complementary audiences.

Want to Comment?

Please share your feedback about  Strategy Mode / Story Mode and join in other discussions on the Star Dynasties reddit

Please follow and like:

Game Vision / Concepts

I’ve been working on building support for the two separate game modes that Star Dynasties will have, but in trying to write a post about it I’ve realized I first need to talk about the fundamental concepts and vision of the game.

What is Star Dynasties about?


A game about being a king that focuses on human drama

The initial spark was the thought, after countless playthroughs of Civilization and other classic strategy games, that history (particularly ancient and medieval history) looks very different from the narratives that arise in those games.  Kings and emperors were much more dependent on social and political skills than they were on their technical and administrative skills.  And in societies where political power was primarily personal or dynastic, kingdoms rose and fell as much on the basis of human foible and drama as on the basis of economic and military strength.  Alliances were built on personal charisma and friendships, wars have been fought over a lover, thrones have been lost through social ineptitude, rebellions have started from feuds between a monarch’s rulers and their personal friends, etc.

It’s this personal dimension that makes a lot of history, fantasy, or future feudal sci-fi fascinating.  When you strip away the context of a story about a medieval or fictional monarch, the narrative is full of human experiences that we can relate to.  A king worrying about his heirs is no different from any father wanting the best for their children’s future.  Acts of personal betrayal or indiscretions that lead to the ruin of a realm or royal dynasty, may be events with much higher stakes and on a much grander scale than our lives, yet in their essence there is something that resonates deeply with our own human experience.


A simulation of a feudal society that generates believable narratives

There is something deeply fascinating in observing, and interacting with, a complex system.  In part, the “fun” of playing a game is the sheer thrill of working out patterns, and manipulating them to achieve certain goals.  And what can be more complex, yet universally resonant, than a human society; with all those individuals trying to live out their own lives, seeking happiness, avoiding isolation and pain, and bending the rules and culture of that society to their personal benefit and wellbeing?

Games such as Dwarf Fortress and RimWorld have proven that you can generate elaborate and convincing stories from a world simulation that reaches a certain level of complexity.  When a player experiences two events in succession, they will inevitably link them in their minds in a story, especially if the events have a logical sequence in a narrative sense.  For example, if in the first event character A does something nice for character B, and in the second event character B does something nice for character A, any human observer would say that this is a reciprocation and that the two events are linked, even if the second event was not triggered explicitly by a simulated “reciprocity rule”.  The fact that the player perceives the two events as a quid pro quo is an emergent property of the simulation, rather than something that was necessarily explicitly coded in the simulation rules.

This is also true for more complex event chains; a sequence of negative acts that happen to escalate will appear to be a planned strategy of conquest or harassment, a sequence where positive acts are unrewarded at a critical moment will appear to be a betrayal.  The critical prerequisite is to make sure that the sequences of events that occur in the simulation are not unbelievable or immersion breaking – we can then trust the human brain to do the rest.


A feudal frontier sci-fi setting

The choice of a science fiction setting allows for interesting design decisions or world building that would not be possible in a historical setting.  I love sci-fi because it creates what-if scenarios that couldn’t be set up in a historical context, and it allows us to strip away ancillary details to focus on the core properties of a social or political pattern.

Furthermore, it provides the freedom to solve some knotty game design or implementation problems by altering a detail in the setting.  For example, Star Dynasties has a population control mechanic that serves both to limit runaway population growth in the simulation over time, and provides an interesting political tool by which you can reward your favourites.

At the same time, it’s important to note that the requirement to model a realistic feudal system that persists through multiple generations does create some hard constraints.  Marriages and kinship relationships are the key enablers of legitimate power transfer and alliances, the economy must be land-locked (or planet-locked) and relatively disconnected to maintain the long-term stratification of the society, technological growth must be relatively stagnant, etc.


Similarity to existing games

Star Dynasties was inspired originally by a love of empire management strategy games such as Civilization, Total War, Knights of Honor, etc.

In choosing to focus on the human drama, I have drawn inspiration from roleplaying simulation games such as The Sims, King of Dragon Pass, and choose your own adventure-style games such as Nation States and Reigns.  In understanding how complexity creates emergent narratives, games like Dwarf Fortress and RimWorld have been instructive.

The game that shares the most concepts and similarities with Star Dynasties is Crusader Kings.  To the maximum extent possible (I am a solo dev with some help), my intention is to build a game that has an even greater emphasis on, and mechanistic understanding of, stories of human drama.  For example, the simulation in Star Dynasties understands the notions of empathy, simplistic morality, social obligations, grudges and favours; and uses that to build logically consistent sequences of events.  I would also like the player experience to be focused on navigating a branching narrative that rewards strategic thinking, with less administrative micromanagement tasks such as troop movement.

Want to Comment?

Please share your feedback about Game Vision / Concepts and join in other discussions on the Star Dynasties reddit

Please follow and like:

Portrait Generation

I’ve been out of the country visiting my folks so progress since the last post has been slow.  I’ve built a few more basic UI screens for the game, but I thought I would talk about something relatively done and dusted – portrait generation.  Characters are the central focus of Star Dynasties, and bringing them to life visually is an important design goal.  The game generates over a thousand characters for a game, so portraits also have to be generated dynamically.

Dynamic Portrait Generation
Dynamic Portrait Generation


Portraits are assembled from a library of sprites designed to stitch together seamlessly.  Each component of the portrait is drawn on a seperate layer in a pre-determined order to create a human face.  Some of these components are handled as multiple sprites.  For example, the hair component is split into two seperate sprites; one is drawn beneath the face, the other is drawn on top of the face.  Most components are also re-colored to further differentiate characters from each other; allowing for a dynamic range of eye colors, skin colors, dress colors, etc.

One complexity stems from the fact that through the game you will play through the lifetime of many characters.  Thus characters age, and their facial features must age appropriately.  Some features (such as eyes) change significantly as we age, so we need a version of each different type of eye sprite for each age group that we are representing in the game.  Some other features age more slowly, so we can get away with less granular modifications.  In addition, hair color changes as we age, so hair color is lightened for older characters.

There are other less immediately noticeable aspects of portrait generation that I hope players will appreciate as they become familiar with the game.

  • Facial feature sprites for male / female faces are drawn in matched pairs.  This allows me to have children that inherit features from both mother and father, and leads to entire families that share facial similarities.
  • Dress color is picked so that it advertises the affiliation of the character to their house.  Characters of a house whose flag is blue will be wearing blue and yellow, blue and green, different shades of blue, etc.  Seeing all the characters of a house in one list will show a clear chromatic theme.
Characters in house with violet flag
Characters in house with violet flag


This is a good time to give a shout out to the awesome artist for Star Dynasties, Ven Locklear.  Check out his portfolio.

Want to Comment?

Please share your feedback on Portrait Generation and join in other discussions on the Star Dynasties reddit

Please follow and like:

Basic Concepts

I have been working on the information panels the player will use to explore the state of the world in Star Dynasties, so this feels like a good opportunity to provide a quick tour of some of the basic concepts of the game.

Justice / Morality

One of the core features of the character simulation is the concept of moral acts, i.e. actions such as declaring war, cheating on your wife, helping a family member in need, etc., that will trigger a universal condemnation or approval.  An example of a non-moral act would be marrying off your son – the newly weds and new in-laws will be happy and pleased with you (presumably), but the rest of the world won’t really care.  With moral acts, the world is watching and reviewing it’s opinion of you.  On top of that, many moral acts will result in someone bearing a grievance (the victim of the action) or someone owing the doer a favour (the beneficiary of the action).  The value of this “social memory” is that it modifies how subsequent moral acts are interpreted.  For example, deposing one of your rulers from power is an immoral act, and will usually trigger a widespread opinion change against you for being tyrannical.  However, imagine a narrative where the ruler had recently refused to muster their forces and come to your assistance during an attack by another faction.  This was an immoral act that granted you a grievance.  If you move against the ruler now and depose them, your action will be seen as justified… a punishment of the ruler’s misdeed.

You’ve been quite nasty to Willard Wilson

Visibility and Secrets

Visibility is an important part of the game.  Your visibility is limited to the visibility of your character, so at any one time you will only see a small portion of the galaxy and its inhabitants.  This can lead to some interesting consequences.  For example, if your heir is a widely travelled ambassador, you will have a much larger awareness of the world around you when they inherit.  If instead you keep your heir locked away in some unimportant role on your home system, you may find that your view of the world shrinks when they take the reins.

As a general rule, if you know of a character then you have full visibility of what they get up to.  There are some explicit exceptions to this rule, for e.g. committing murder, which are secret.  Secrets stick around in the background and can be discovered by characters with a high Security skill (or by your house’s Security wing), and subsequently revealed to inflict political damage.

Naughty naughty


Apart from characters, houses are the most important unit in the game, and most of your political dealings will be with the heads of these houses, be they the ruling houses of colonies, the leading houses of factions, or lowly noble houses that vie for power within a colony.

Within a house, characters can be assigned to a role from Administration, Military, Diplomacy, Security, and Medical; with one character in each area appointed as the council member of that area.  Right now, the members you have assigned in these areas largely contribute passively to your house’s attributes (e.g. Administration increases your income, and Military increases your combat bonuses), but the plan is to flesh out these systems so that each role has it’s own narrative building blocks.  For example, characters assigned to Diplomacy can be sent as ambassadors to other houses.  An ambassador could (based on their skills and relationships) create a rapproachment with a rival or commit a faux pas that triggers conflict.

House Glass focuses on administration and diplomacy


When a dynasty has ruled for a long time, it’s head acquires a legitimate (and inheritable) right to rule or lead particular systems.  Claims interact with the morality system in that it is generally considered immoral to replace the ruler or leader of a system with someone who has less of a right to rule that system.  But if someone has no legitimate claim, then they are mostly considered fair game.  Similarly, if you can find someone with a strong claim on a system, you can use them as a political excuse to declare war (although you’ll still suffer politically later if you annex other systems).

Cebalrai is claimed only by it’s current owners, so there is no way it can be acquired without political fallout


Factions are the highest level of social grouping of the game and relationships and conflicts between factions will generally be the most important strokes of the narrative you play through in the game.

Leader Strickland retains tepid support from his followers despite the war with the Wilson Collective

Want to Comment?

Please share your feedback about Basic Concepts and join in other discussions on the Star Dynasties reddit


Please follow and like:

Building a UI: Lists and Text

This week I focused on the basic implementation of two UI panels; the History panel (which shows a list of historical events that have happened) and the Family panel, which shows a list of the characters that are related (by blood or marriage) to a particular character.  I also spent some time getting the text to look sharper.

Preview of history panel and flipping through past updates
Flipping through historical updates
Family Panel: List of related characters
Browsing the list of related characters

Smoothly Scrolling Lists

The main challenge was performance; I’m using ScrollRect objects in Unity and they are surprisingly slow.  I’m not just talking about the need for object pooling (where you reduce the number of game objects used to render a list by re-using a small number of them to populate just the visible portion at any one time), but in the way ScrollRect inherently functions.  To the best of my understanding a ScrollRect recalculates the layout of its contents and rebuilds each graphical element every time the scroll position is changed.  The implication is that if you’re going to use a ScrollRect and want smooth scrolling, you need to make sure it’s contents are as lightweight as possible for Unity to rebuild.  One of the components I am using liberally in the UI is the character card, a character portrait with some decoration, to give you at a glance; Faction affiliation, House affiliation, the character’s general importance (i.e. are they a leader, a ruler, etc.), the character’s happiness, your opinion of the character, and the character’s opinion of you.

Character card shows a character's portrait and their salient details
Character Card

In the History panel list, I can have up to four of these character cards per row.  The control was using an “Auto Layout” based layout, and I got a significant speed up switching to a RectTransform based layout (i.e. where I calculate the position of each element manually once rather than let Unity dynamically recalculate it each rebuild).

The other tweak that seems to have helped considerably is an implementation detail of how I was doing object pooling on the list itself.  It turns out that changing the parent of a UI element also triggers a significant amount of rebuilding, so it is cheaper to leave one or two masked out list elements past the edge of the visible area, rather than temporarily reparenting them to somewhere else until they are reused to show new items.

Sharper Text Rendering

I’m using TextMeshPro to render the text, primarily because I need the ability to embed links and sprites within the text (I’m under the impression that TextMeshPro is also generally the most robust text rendering solution available for Unity).  A weakness of all the text renderers in Unity I’ve tried is that they struggle with drawing small text sharply.  The text ends up looking quite fuzzy, rather than nicely anti-aliased but still sharp.  The only solution that I can see (at least with TextMeshPro) is to find or roll your own bitmap fonts that are of the exact size you need and use them at the explicit size they were designed for (i.e. no scaling at all of either the canvas, game object, or text component font size).  If you want text at different sizes you will need to use different bitmap fonts at each seperate size, but the results are then pixel perfect.  And past a certain size, TextMeshPro’s ability to dynamically resize a font works just fine.

Differences in text sharpness when using variable vs bitmap fonts
Click to enlarge and see the difference in text sharpness

Want to Comment?

Please share your feedback about Building a UI: Lists and Text and join in other discussions on the Star Dynasties reddit

Please follow and like:


Star Dynasties is a simulator of the human dramas of a ruling elite in a dark age future.  In the 22nd century humanity had spread to a hundred small colonies, established mainly as industrial bases for commercial exploitation, but the sudden destruction of Earth abandoned these fledgling colonies to an uncertain fate.  Two hundred years later the remnants of human civilization have regressed to a more feudal and traditional society.

The player controls the head of a leading family through multiple generations; finding the right political marriages, acting as the patriarch or matriarch of their household, keeping the colony rulers of their faction in check, and waging war where necessary to ensure that their house survives and grows in influence.  The game simulates the personalities, emotions, and opinions of over a thousand characters to procedurally generate a narrative for the player that is both grand and human.  Characters will fall in love, betray each other, aspire to rise in status, commit murder, and in general engage in the behaviour you’d expect from an aristocratic elite obsessed by power and personal pleasure.  The game’s main inspirations are Crusader Kings, King of Dragon Pass, and The Sims.

I’ve been developing this game for three years, primarily building the engine that drives the character simulation.  Recently I’ve started to extend the prototype with a graphical user interface and art, so it seems like the right time to start talking about it.  I’m hoping to have an alpha version for public feedback in a few months, and in the meantime I would like to maintain a devlog and start getting some feedback on what I’m doing from a wider audience.

The rough prototypes I’ve experimented with have implemented gameplay as either a branching narrative, where the player plays through a sequence of procedurally generated choices, or as a more traditional turn-based strategy game.  The graphical prototype I’m now building is implementing “story mode”, and I’m hoping that player feedback will clarify whether the right strategy is to offer both modes or concentrate on just one.  In either mode the game plays from a bird’s eye view, with the primary interface being the galactic map, and popups that move the story forward and present the player with choices to make.

The character simulation has some interesting properties, which I’ll go into in more detail in future posts.  Key points;

  • Characters have emotional reactions to events that happen (and that are related to them).
  • Characters have personality traits that modify their emotional reactions and influence their behaviours.
  • Characters empathise with what happens to each other.  For example, your character will be pleased when an ally successfully puts down a rebellion on one of his systems, and also pleased when an enemy fails to do so.
  • Characters form opinions of each other based on how they act.  They are more likely to be friendly and helpful to those they like and unhelpful or outright aggressive to those they dislike.  This is the central driver of political behaviour in the game.
  • There is a moral system (albeit one which is primitive and retribution based) whereby certain actions are looked down upon or approved of near universally.  As a design principle the game doesn’t explicitly stop the player from taking some nasty or irrational decisions, such as declaring war on an ally, but social pressure will.
  • Characters remember favours owed to each other and hold grudges.  This leads to interesting interactions with the moral system, for e.g. torture is immoral, but torturing your father’s murderer will be forgiven in the court of public opinion.



Responding to an offer of marriage Choosing sides in the squabbles between nobles
Your own happiness is increased when you reward those you like Just catching up on galactic events

Want to Comment?

Please share your feedback on Introduction and join in other discussions on the Star Dynasties reddit

Please follow and like: