Inform 7 Home Page / Documentation
§7.16. Social Groups
Crowds of characters introduce new challenges, because we often want to show them interacting with one another, or to describe individuals in less detail when a whole group is present.
Strictly Ballroom gives us a set of characters who pair off each turn, making sure to mention each one once, and leaving one unfortunate person behind as a wallflower: this exemplifies how we might use a behavioral rule not to dictate the behavior of each individual separately but rather to model a whole group together. Happy Hour does calculate movements for characters individually, but then collates the descriptions, creating a single paragraph to describe whatever group is currently in the room.
Characters can also have complicated attitudes to one another, and it can be helpful to use relations to track these. Unthinkable Alliances demonstrates the grouping of characters into alliance factions, while The Abolition of Love provides a host of relations to track love affairs, marriages, memberships in families, and mere mutual respect.
Emma combines these two effects: its characters move between social groups depending on how they feel about the others in their particular talking circle, and descriptions change depending on who is where in the room.
Lugubrious Pete's Delicatessen simulates a queue at a deli, in which the customers who most impress Pete get served first.
See Traveling Characters for groups of characters who move around and have their movements collated into a joint description
Start of Chapter 7: Other Characters | |
Back to §7.15. Goal-Seeking Characters | |
Onward to Chapter 8: Vehicles, Animals and Furniture: §8.1. Bicycles, Cars and Boats |
ExampleUnthinkable Alliances |
The following is best tested by experimentally kissing and/or attacking, and typing RELATIONS after every change to see the effect.
Unthinkable Solutions is a room. Sophie, Daisy, Ryan and Owen are in Unthinkable Solutions.
Alliance relates people to each other in groups. The verb to help means the alliance relation.
Instead of kissing someone (called the blessed one):
say "Smack!";
now the player helps the blessed one.
Instead of attacking someone (called the vilified one):
say "Smack!";
now the player does not help the vilified one.
Test me with "relations / kiss sophie / relations / hit ryan / relations".
ExampleThe Abolition of Love |
Suppose we are modeling a complex society seething with interpersonal relations of every kind.
The Chapel is a room. Elizabeth, Wickham and Darcy are people in the Chapel. Mr Bennett and Mrs Bennett are people in the Chapel. Georgiana is a person in the Chapel.
Elizabeth loves Darcy. Elizabeth fancies Darcy. Elizabeth notices Darcy. Elizabeth impresses Darcy.
Mr Bennett is related to Mrs Bennett and Elizabeth. Mr Bennett is married to Mrs Bennett.
Now we want ways to set and unset all of these relations. (In the interests of thoroughness, we may get a bit far-fetched here. It is not recommended in practice that we make the player guess the verb "traduce".)
Understand "infatuate [someone] with [someone]" as infatuating it with. Infatuating it with is an action applying to two visible things.
Carry out infatuating it with:
now the noun loves the second noun.
Report infatuating it with:
say "Now [the noun] loves [a random person loved by the noun][if the second noun loves someone], while [the second noun] loves [a random person loved by the second noun][end if]."
Understand "embitter [someone] toward [someone]" as embittering it toward. Embittering it toward is an action applying to two visible things.
Carry out embittering it toward:
now the noun does not love the second noun.
Report embittering it toward:
say "[The noun] sees [the second noun] in a different light and no longer feels any affection."
Because love is a 1-1 relation, a person cannot love more than one other character at a time. Whenever we set a character to love a new person, that person ceases to love the character loved before. It is a fickle world.
One to various relations are a bit more open: we can say someone impresses multiple other characters, and our additions to the list do not override the initial ones.
Understand "commend [someone] to [someone]" as commending it to. Commending it to is an action applying to two visible things.
Carry out commending it to:
now the noun impresses the second noun.
Report commending it to:
say "[The second noun] takes a very decided interest in [the noun]."
Understand "traduce [someone] to [someone]" as traducing it to. Traducing it to is an action applying to two visible things.
Carry out traducing it to:
now the noun does not impress the second noun.
Report traducing it to:
say "[The second noun], hearing your story, decides not to be at all impressed with [the noun]."
And because this is a one-to-various relation, we can also make statements which set multiple relations at once, so:
Understand "celebrate [someone]" as celebrating. Celebrating is an action applying to one visible thing.
Report celebrating:
say "[The list of people who are impressed by the noun] take a very decided interest in [the noun]."
Understand "slander [someone]" as slandering to. Slandering to is an action applying to one visible thing.
Carry out slandering to:
now every person is not impressed by the noun.
Report slandering to:
say "Now [the noun] impresses [the list of people who are impressed by the noun]."
Note that the above unsetting is not equivalent to "now the noun does not impress every person" -- which would be ambiguous in spoken English, as well. Various-to-one relations are similar:
Understand "draw the attention of [someone] to [someone]" as drawing the attention of it to. Drawing the attention of it to is an action applying to two visible things.
Carry out drawing the attention of it to:
now the noun notices the second noun.
Report drawing the attention of it to:
say "[The noun] glances thoughtfully in the direction of [the second noun]."
Understand "distract [someone] from [someone]" as distracting it from. Distracting it from is an action applying to two visible things.
Carry out distracting it from:
now the noun does not notice the second noun.
Report distracting it from:
say "You distract [the noun] from [the second noun]."
Understand "draw attention to [someone]" as drawing attention to. Drawing attention to is an action applying to one visible thing.
Carry out drawing attention to:
now every person notices the noun.
Report drawing attention to:
say "You quickly cause everyone to attend to [the noun]."
Understand "outshine [someone]" as outshining. Outshining is an action applying to one visible thing.
Carry out outshining:
now every person does not notice the noun.
Report outshining:
say "You quickly distract everyone from [the noun]."
Understand "flatter [someone]" as flattering. Flattering is an action applying to one thing.
Report flattering:
say "You draw down universal admiration for [the noun] by casting him or her in a flattering light."
Understand "unflatter [someone]" as unflattering. [Okay, okay, but it's four am.] Unflattering is an action applying to one thing.
Carry out unflattering:
now every person does not fancy the noun.
Report unflattering:
say "[The noun] gives everyone a universal disgust."
Understand "admire [someone]" as admiring. Admiring is an action applying to one thing.
Report admiring: say "You find you rather fancy [the noun]."
Understand "loathe [someone]" as loathing. Loathing is an action applying to one thing.
Understand "cause chaos" as causing chaos. Causing chaos is an action applying to nothing.
Carry out causing chaos:
now every person fancies every person.
Report causing chaos: say "Now everyone fancies everyone else, which is quite an inconvenient state of affairs."
Understand "relieve chaos" as relieving chaos. Relieving chaos is an action applying to nothing.
Carry out relieving chaos:
now every person is fancied by no one.
Report relieving chaos: say "Now no one fancies anyone, which is safe but tedious."
Our options for setting and unsetting symmetrical relations are more limited again:
Section 6 - Setting and Unsetting Marriage (1-1 Symmetrical)
Understand "marry [someone] to [someone]" as uniting it in matrimony with. Uniting it in matrimony with is an action applying to two visible things.
Carry out uniting it in matrimony with:
now the noun is married to the second noun.
Report uniting it in matrimony with:
say "You perform the marriage of [the noun] to [the second noun], joining them to the family of [a list of people related to the noun]."
Understand "divorce [someone] from [someone]" as divorcing it from. Divorcing it from is an action applying to two visible things.
Check divorcing it from:
if the noun is not married to the second noun, say "[The noun] is not married to [the second noun] anyway." instead.
Carry out divorcing it from:
now the noun is not married to the second noun.
Report divorcing it from:
say "[The noun] is now not married to [the second noun]."
When we unset the symmetrical relation on one side, it is automatically set or unset on the other. It is not necessary to say "the second noun is married to the noun" or "the second noun is not married to the noun", even though that is the case.
Section 7 - Setting and Unsetting Acquaintance (V-V Symmetrical)
Understand "introduce [someone] to [someone]" as introducing it to. Introducing it to is an action applying to two visible things.
Carry out introducing it to:
now the noun knows the second noun.
Report introducing it to:
say "You introduce [the noun] to [the second noun]. Now [the noun] is acquainted with [the list of people who are known by the noun], and [the second noun] is acquainted with [the list of people who are known by the second noun]."
Understand "announce [someone]" as announcing. Announcing is an action applying to one visible thing.
Report announcing:
say "You announce [the noun] to the whole assembled company."
Understand "ostracise [someone]" as ostracising. Ostracising is an action applying to one visible thing.
Carry out ostracising:
now every person does not know the noun.
Report ostracising:
say "You cause everyone present to forget and pretend not to be acquainted at all with [the noun]."
And finally, setting groups:
Section 8 - Setting and Unsetting Familial Relations (Groups)
Understand "make [someone] adopt [someone]" as forcing it to adopt. Forcing it to adopt is an action applying to two visible things.
Carry out forcing it to adopt:
now the noun is related to the second noun.
Report forcing it to adopt:
say "Now [the second noun] is related to [the list of people related to the second noun]."
Understand "make [someone] disown [someone]" as forcing it to disown. Forcing it to disown is an action applying to two visible things.
Carry out forcing it to disown:
now the second noun is not related to the noun.
Report forcing it to disown:
say "Now [the second noun] is related to [the list of people who are related to the second noun], and [the noun] is related to [the list of people who are related to the noun]."
Notice that when we say "the second noun is not related", we remove that person from the group: they are now in a separate group of their own, while the rest of the group's members remain related to one another.
And finally, a long litany of test cases, complete with the relations lists:
Test acquaintance with "relations / introduce darcy to elizabeth / introduce darcy to wickham / announce mr bennett / relations / ostracise wickham / introduce georgiana to wickham / relations".
Test impression with "commend georgiana to elizabeth / relations / celebrate Mrs bennett / relations / traduce mrs bennett to darcy / relations / slander mrs bennett / relations".
Test notice with "draw the attention of darcy to elizabeth / relations / draw attention to mr bennett / relations / distract darcy from mr bennett / relations / outshine mr bennett / relations".
Test love with "embitter elizabeth toward darcy / relations / infatuate elizabeth with wickham / relations".
Test marriage with "marry elizabeth to darcy / relations / divorce elizabeth from darcy / relations".
Test alliance with "make mr bennett adopt georgiana / relations / make mrs bennett disown georgiana / relations".
Test fancying with "admire elizabeth / relations / loathe elizabeth / relations / flatter elizabeth / relations / unflatter elizabeth / relations / cause chaos / relations / relieve chaos / relations".
Test me with "test acquaintance / test impression / test notice / test love / test alliance / test fancying / test marriage".
ExampleLugubrious Pete's Delicatessen |
First, to set the scene:
The Supermarket is west of the Delicatessen Counter. Lugubrious Pete is in the Delicatessen. "Lugubrious Pete, dolefully slicing meats and cheeses, serves at the counter." Alice, Beth, Gemma, Delia, and Eliza are women in the Supermarket.
Two processes compete here: one that fills the queue, the other which will empty it. The first process is the one which brings shoppers in to the counter, joining the back of the queue, which is where "add ... to ..." puts new entries by default:
Every turn when a woman is in the Supermarket and a random chance of 2 in 3 succeeds (this is the customer arriving rule):
let the customer be a random woman in the Supermarket;
now the customer is in the Delicatessen;
if the player is in the Supermarket, say "[The customer] walks into the Delicatessen.";
if the player is in the Delicatessen, say "[The customer] comes in from the Supermarket, and [if the number of entries in the deli queue is 0]can't believe her luck. The counter is free![otherwise]resignedly queues behind [the deli queue].";
add the customer to the deli queue.
The competing process is the one which serves shoppers and thus gets rid of them again: unfortunately, it is slower. But Pete is fair if inefficient, and serves the customers in strict order of arrival. Each served customer is removed from the front of the list, and the others therefore all move up a place.
Every turn when the number of entries in the deli queue is not 0 and a random chance of 1 in 3 succeeds (this is the customer being served rule):
let the customer be entry 1 of the deli queue;
if the player is in the Delicatessen, say "Pete gives a droopy expression as he serves [customer], who nevertheless brightens and leaves.";
if the player is in the Supermarket, say "[customer] emerges cheerfully from the Delicatessen Counter, and goes about her regular shopping.";
now the customer is in the Supermarket;
remove entry 1 from the deli queue.
Instead of waiting in the Delicatessen when the number of entries in the deli queue is not 0, say "Time passes, for [deli queue] quite as much as for yourself."
Test me with "wait / wait / wait / east / wait / wait / wait / wait / wait".
That completes the example, but here is a variation to show that queues need not empty from the front. The Deli already looks a pretty sexist establishment, with the customers all being women, but it is about to get a whole lot worse:
Modesty is a kind of value. The modesties are positively prim, buttoned up, modest, flirty, revealing and downright immodest. Every woman has a modesty. Alice is positively prim. Beth is downright immodest. Gemma is modest. Delia is flirty. Eliza is revealing.
We could then rewrite the service rule like so:
Every turn when the number of entries in the deli queue is not 0 and a random chance of 1 in 3 succeeds (this is the customer being served rule):
let Pete's preference be the deli queue;
sort Pete's preference in reverse modesty order;
let the customer be entry 1 of Pete's preference;
let the first in line be entry 1 of the deli queue;
if the player is in the Delicatessen, say "[if the customer is the first in line]Pete gives a droopy expression as he serves [the customer], who nevertheless brightens and leaves.[otherwise]Outrageously, Pete scans the queue, notices [the customer] in her [modesty of the customer] clothes, and serves her next, while [the first in line] glares at him.";
if the player is in the Supermarket, say "[The customer] emerges cheerfully from the Delicatessen Counter, and goes about her regular shopping.";
now the customer is in the Supermarket;
remove the customer from the deli queue.
It is now heartbreakingly difficult for Alice to obtain her sliced chorizo sausage.
ExampleStrictly Ballroom |
Many simple repetitions can effectively be done with a "now..." instruction: it is quicker to say
than
repeat with offended party running through people:
now the offended party is angry.
Repeat comes in handy when we have something a bit more complicated to do with each item:
A person can be alert or occupied. A person is usually alert.
Dance is a kind of value. The dances are waltzes, polkas, cha-chas, charlestons, fox-trots, tangos, lambadas, and two-steps.
Manner is a kind of value. The manners are swiftly, primly, energetically, suavely, seductively, elegantly, and badly.
Every turn:
repeat with dancer running through people who are not the player:
if dancer is alert:
now dancer is occupied;
let partner be a random alert person who is not the dancer;
if partner is a person:
now partner is occupied;
say "[The dancer] [the current round][if a random chance of 1 in 5 succeeds] [a random manner][end if] with [partner]. ";
otherwise:
say "[paragraph break][The dancer] is forced to be a wallflower. Poor [dancer]. ";
say paragraph break.
Notice we did not say "repeat with dancer running through alert people who are not the player...". This is because Inform would draw up a list of alert people at the beginning of the repeat, and not take into account which people became occupied partway through the repetition. If we want to make sure that each person dances only with one other person, we have to continue checking alertness each time we run through the repetition.
After all the partners are assigned, we can set up for the next turn by making everyone alert again, and for this we do not need "repeat":
Every turn: now every person is alert; now the player is occupied.
Before doing something to someone: now the noun is occupied.
Before doing something when the second noun is a person: now the second noun is occupied.
Instead of doing something to someone: say "You successfully distract [the noun]."
The Pacific Ballroom is a room. "A rather utilitarian space at the moment, since this is a class and not a party." Timmy, Tommy, Joey, George, Mary, Martha, Yvette, McQueen, Linus, and Patricia are people in the Pacific Ballroom.
ExampleEmma |
To start with, let's understand "room" to mean "a group of people talking". These groups can grow and shrink as people come and go, so we'll want to name and rename them; and we're also going to need some rules to motivate people moving around, and a description to narrate how they behave when we're with them.
by the banquet table is a room. at the corner is a room. next to the doorway is a room. by the window is a room.
Social clump is a kind of value. The social clumps are vacancy, lone person, couple, cluster, group.
A room has a social clump. Understand the social clump property as describing a room.
Before printing the name of a room:
say "a [social clump] ".
After looking:
assign clumping;
say "Elsewhere in the room, you can see [the list of rooms which are not the location]."
Understand "go to [any room]" as joining. Joining is an action applying to one visible thing. Carry out joining: move player to the noun. Report joining: do nothing.
Understand "examine [any room]" as looking toward. Looking toward is an action applying to one visible thing. Carry out looking toward a room: say "In that direction you see [a list of other people in the noun]."
When play begins: assign clumping. Every turn: assign clumping.
To assign clumping:
repeat with space running through rooms:
now the social clump of the space is vacancy;
if the space contains exactly 1 person, now the social clump of the space is Lone person;
if the space contains exactly 2 people, now the social clump of the space is Couple;
if the space contains more than 2 people and the space contains fewer than 5 people, now the social clump of the space is cluster;
if the space contains more than 4 people, now the social clump of the space is group.
The room description heading rule is not listed in the carry out looking rules.
A person has a number called longevity. The longevity of a person is usually 0. A person can be active or passive.
Every turn:
repeat with mover running through other people:
now the mover is active;
increment the longevity of mover;
if longevity of mover is greater than 3 or the mover is bored:
assign value of spaces for the mover;
let destination be the nicest room;
if the destination is not the location of the mover:
if the player can see the mover, say "[The mover] makes excuses and drifts off to join [the destination].[paragraph break]";
move the mover to the destination;
now the mover is complacent;
now the longevity of the mover is 0;
if the player can see the mover, say "[The mover] wanders over.[paragraph break]";
assign clumping;
now mover is passive.
Definition: a room is nice if its attractiveness is 1 or more.
To assign value of spaces for (mover - a person):
repeat with space running through rooms:
now attractiveness of the space is 0;
repeat with figure running through people in the space:
if the mover is bored, decrease attractiveness of the space by 2;
if the mover likes the figure, increment attractiveness of the space;
if the mover dislikes the figure, decrement attractiveness of the space;
if the mover desires the figure, increase attractiveness of the space by 2.
Liking relates various people to various people. The verb to like means the liking relation.
Disliking relates various people to various people. The verb to dislike means the disliking relation.
Attraction relates various people to various people. The verb to desire means the attraction relation.
Mr Weston, Mr Woodhouse, Mr Elton, Mr Knightley, and Frank Churchill are men. Mrs Weston, Mrs Bates, Miss Bates, Harriet Smith, Emma Woodhouse, and Jane Fairfax are women.
Harriet Smith likes Mr Elton. Harriet Smith desires Mr Elton. Harriet Smith likes Emma Woodhouse.
Emma Woodhouse likes Harriet Smith and Mr Knightley. Emma Woodhouse dislikes Jane Fairfax.
Mr Knightley likes Emma Woodhouse, Mr Weston, and Mrs Weston. Mr Knightley desires Emma Woodhouse.
Jane Fairfax desires Frank Churchill. Jane Fairfax likes Frank Churchill.
Frank Churchill desires Jane Fairfax and Emma Woodhouse. Frank Churchill likes Jane Fairfax.
Miss Bates likes Jane Fairfax, Emma Woodhouse, and Mrs Bates.
Mr Weston likes Frank Churchill, Emma, Knightley, and Mrs Weston.
Mrs Weston likes Frank Churchill, Emma, Knightley, and Mr Weston.
When play begins:
repeat with character running through other people:
let space be a random room;
move character to space.
And now we use writing a paragraph about... to describe character behavior in groups, when we join them:
Rule for writing a paragraph about Frank Churchill:
if the location contains a woman (called flirt) who is desired by Frank:
say "[Frank Churchill] is talking with great animation and slightly more than becoming warmth to [the flirt][if an unmentioned other person is in the location], while [the list of unmentioned other people in the location] look on with varying degrees of amusement or irritation[end if].";
repeat with character running through people in the location:
if the character is not Churchill and the character is not the flirt, now the character is bored.
Rule for writing a paragraph about Mr Elton:
if the location contains an unmentioned woman (called flirt) who is desired by Elton:
say "[Mr Elton] hangs on the sleeve of [the flirt], offering an assortment of studied gallantries that make you wonder about his good sense.";
repeat with character running through people in the location:
if the character is not Elton and the character is not the flirt, now the character is bored.
Rule for writing a paragraph about Harriet Smith:
if the location contains Emma and Emma is unmentioned:
say "[Harriet] and [Emma] are conversing in low tones -- Harriet, apparently, being too shy to speak so that everyone can hear her."
Rule for writing a paragraph about Mr Knightley:
if the location contains an unmentioned man (called the listener) who is not Mr Knightley:
say "[Mr Knightley] is speaking with [the listener] about agricultural matters.";
now the listener is complacent.
Rule for writing a paragraph about Miss Bates:
say "[Miss Bates] is giggling about the weather[if an unmentioned other person is in the location]. This does not seem to compel the interest of [the list of unmentioned other people in the location][end if].";
repeat with character running through people in the location:
if the character is not Miss Bates and character is not Mrs Bates, now the character is bored.
Since this is just an example, we'll stop here, but there's no reason we couldn't write such paragraphs for everyone.
Test me with "z / z / z / look / x corner / x doorway / x window / x table / go to the table".
ExampleHappy Hour |
Often it is best to have an entire paragraph about the characters present in a room, but suppose we're narrating a large party with a lot of people moving around. In that case, it might be better to list everyone together, then add a few salient details by way of follow-up, like this:
Before listing nondescript items:
say "You can see [a list of people who are marked for listing] here. ";
repeat with named party running through people:
now the named party is not marked for listing;
let count be the number of visible other people who are carrying something;
if count is 0:
say paragraph break;
continue the action;
let index be count;
repeat with holder running through visible other people who are carrying something:
if index is count, say "[The holder]";
otherwise say "[the holder]";
say " has [a list of things carried by the holder]";
decrement index;
make delimiter index of count.
The next part could be simpler, but for rigor we will write it in such a way that it will work whether or not the serial comma is in use. This requires some extra work.
To make delimiter (index - a number) of (count - a number), continuing or halting:
if index is 0:
if continuing, say ". [run paragraph on]";
otherwise say ".";
otherwise if index is 1:
if count is 2, say " and ";
otherwise say "[optional comma] and ";
otherwise:
say ", ".
To say optional comma:
if the serial comma option is active:
say ",".
And now the scene:
The Banquet Hall is a room. "A large cheery banner over the door (which, incidentally, vanishes when you approach it) reads: HELLO NEW INDUCTEES! WELCOME TO THE AFTERLIFE!"
Fred, George, and Larry are men in the Banquet Hall. Fred carries a dry martini. Larry carries a cream puff. Matilda and Louise are women in the Banquet Hall.
Every turn:
let wanderer be a random other person;
let place be the holder of the wanderer;
let next place be a random room adjacent to the place;
let the way be the best route from the place to the next place;
try the wanderer going the way.
The Kitchen is west of the Banquet Hall. "Dominated by a pile of dirty plates which you imagine it will be someone's privilege to wash, later." Vanessa is a woman in the Kitchen. Vanessa carries a tray. On the tray is a salmon roll. The roll is edible.