Static data for the crowd in a Rampage-style game. Defines the HumanManner behaviour enum, HumanProp and HumanRole types, and a table of 25 townsfolk, story characters and authority figures with their clothing tints, props, points, nerves, speed and score labels. Also holds the district local tables and the tiered police/riot/army/parade responses, plus a weighted Townsperson pick.
using System;
using System.Collections.Generic;
/// <summary>How somebody carries on while the lizard is about.</summary>
public enum HumanManner
{
/// <summary>Strolls about until frightened, then runs.</summary>
Stroller,
/// <summary>Runs along the street whether or not anything is wrong.</summary>
Jogger,
/// <summary>Stands and films it on a phone until hit (or until it gets very close).</summary>
Filmer,
/// <summary>Ducks behind the nearest car when frightened, if there is one.</summary>
Hider,
/// <summary>Brave or stupid: walks at the lizard, circles it and leaps for a limb.</summary>
Brave,
/// <summary>Runs TOWARD the action and stands as close as it dares, pointing a camera.</summary>
Reporter,
/// <summary>Keeps its place in a formation whatever happens (a parade, a band).</summary>
Marcher,
/// <summary>Stands where it is and waves. Never a target.</summary>
Child,
}
/// <summary>The one thing somebody carries or wears besides a hat and a coat. A tinted box (or ball).</summary>
public sealed class HumanProp
{
public Vector3 Position, Size;
public Color Tint;
public bool Ball;
public HumanProp( Vector3 position, Vector3 size, Color tint, bool ball = false )
{
Position = position; Size = size; Tint = tint; Ball = ball;
}
}
/// <summary>
/// One kind of person in the town: what they wear, what they are worth, what the score calls
/// them and how they behave. Dress is <see cref="CrowdPerson"/>'s own: tints, a hat, a coat, and
/// one prop.
/// </summary>
public sealed class HumanRole
{
public string Name;
/// <summary>What the score says, in capitals. One is picked per person.</summary>
public string[] Labels;
public float Points = 10f;
public HumanManner Manner = HumanManner.Stroller;
/// <summary>Shirt colour; empty for any of the town's shirts.</summary>
public Color? Shirt;
public Color? Trousers, Hat, Coat;
public bool WideHat;
public HumanProp Prop;
/// <summary>A big lad: a tenth bigger than anybody else.</summary>
public bool Burly;
/// <summary>Built as one of the stadium's own guards: navy, capped, heavy and always up for it.</summary>
public bool Guard;
public float Scale = 1f;
/// <summary>How far and how high a hit sends them, against a civilian's 1.</summary>
public float Flight = 1f;
/// <summary>Carries a shield: the first hit only makes it slide.</summary>
public bool Shield;
/// <summary>Stops to salute when the lizard comes close.</summary>
public bool Salutes;
/// <summary>Plays an instrument, and goes on playing in the air.</summary>
public bool Plays;
/// <summary>Blows a whistle.</summary>
public bool Whistles;
/// <summary>Gets up from a hit and comes straight back, instead of running away.</summary>
public bool Relentless;
/// <summary>How easily frightened: 0 never runs, 1 like anybody.</summary>
public float Nerves = 1f;
/// <summary>Walking speed against a civilian's 1.</summary>
public float Speed = 1f;
/// <summary>How common among ordinary townsfolk (0: only where it is cast).</summary>
public float Weight;
public string Label => Labels[Game.Random.Next( Labels.Length )];
}
/// <summary>The cast of the town, the people from the misfits' pasts, and everything the authorities send.</summary>
public static class HumanRoles
{
static readonly Color Black = new( 0.06f, 0.06f, 0.07f );
static readonly Color White = new( 0.93f, 0.93f, 0.9f );
static readonly Color Navy = new( 0.07f, 0.09f, 0.2f );
static readonly Color Olive = new( 0.3f, 0.36f, 0.2f );
static readonly Color Khaki = new( 0.62f, 0.56f, 0.38f );
static readonly Color Gold = new( 0.95f, 0.78f, 0.2f );
static readonly Color Brass = new( 0.85f, 0.65f, 0.15f );
static readonly Color HiVis = new( 0.85f, 0.95f, 0.1f );
static readonly Color Red = new( 0.8f, 0.1f, 0.1f );
static readonly Color Grey = new( 0.4f, 0.42f, 0.46f );
static readonly Color Denim = new( 0.2f, 0.3f, 0.5f );
static readonly Color Straw = new( 0.86f, 0.74f, 0.42f );
static readonly Color Scrubs = new( 0.55f, 0.8f, 0.72f );
// Props sit in the body's own frame: +X in front, +Y to its left, inches up from the feet.
static HumanProp Phone => new( new Vector3( 20f, -4f, 58f ), new Vector3( 1.5f, 5f, 9f ), Black );
static HumanProp HotDog => new( new Vector3( 18f, -12f, 46f ), new Vector3( 10f, 4f, 4f ), new Color( 0.85f, 0.5f, 0.2f ) );
static HumanProp Bags => new( new Vector3( 2f, -19f, 24f ), new Vector3( 12f, 5f, 14f ), new Color( 0.9f, 0.85f, 0.7f ) );
static HumanProp Briefcase => new( new Vector3( 2f, -18f, 22f ), new Vector3( 16f, 4f, 11f ), new Color( 0.3f, 0.18f, 0.1f ) );
static HumanProp TicketPad => new( new Vector3( 17f, 0f, 44f ), new Vector3( 2f, 7f, 9f ), White );
static HumanProp Shotgun => new( new Vector3( 14f, -13f, 44f ), new Vector3( 44f, 3f, 4f ), new Color( 0.22f, 0.14f, 0.08f ) );
static HumanProp Clipboard => new( new Vector3( 15f, 0f, 42f ), new Vector3( 2f, 10f, 13f ), new Color( 0.6f, 0.45f, 0.25f ) );
static HumanProp Camera => new( new Vector3( 10f, -15f, 60f ), new Vector3( 22f, 8f, 9f ), new Color( 0.15f, 0.15f, 0.17f ) );
static HumanProp Microphone => new( new Vector3( 22f, -6f, 52f ), new Vector3( 5f, 5f, 5f ), new Color( 0.9f, 0.2f, 0.2f ), true );
static HumanProp Whistle => new( new Vector3( 10f, 0f, 60f ), new Vector3( 4f, 3f, 3f ), new Color( 0.8f, 0.8f, 0.82f ) );
static HumanProp RiotShield => new( new Vector3( 17f, 0f, 36f ), new Vector3( 2.5f, 26f, 46f ), new Color( 0.55f, 0.7f, 0.8f ) );
static HumanProp Rifle => new( new Vector3( 4f, -15f, 44f ), new Vector3( 4f, 3f, 40f ), new Color( 0.15f, 0.15f, 0.12f ) );
static HumanProp Shades => new( new Vector3( 7f, 0f, 63f ), new Vector3( 2f, 13f, 3f ), Black );
static HumanProp Medals => new( new Vector3( 6.5f, 6f, 47f ), new Vector3( 1.5f, 9f, 8f ), Gold );
static HumanProp Tuba => new( new Vector3( 14f, 0f, 54f ), new Vector3( 18f, 18f, 18f ), Brass, true );
static HumanProp Trombone => new( new Vector3( 26f, -6f, 56f ), new Vector3( 34f, 3f, 5f ), Brass );
static HumanProp BassDrum => new( new Vector3( 17f, 0f, 38f ), new Vector3( 12f, 26f, 26f ), White );
static HumanProp Headband => new( new Vector3( 0f, 0f, 65f ), new Vector3( 15.5f, 15.5f, 2.5f ), Red );
static HumanProp Teddy => new( new Vector3( 9f, -9f, 34f ), new Vector3( 9f, 9f, 9f ), new Color( 0.6f, 0.4f, 0.22f ), true );
// ---- Ordinary townsfolk ----------------------------------------------------------------------
public static readonly HumanRole Shopper = new()
{
Name = "Shopper", Weight = 26f, Prop = Bags,
Labels = new[] { "SHOPPER", "MAN WITH TOO MANY BAGS", "WOMAN RETURNING A KETTLE", "PEDESTRIAN", "MAN WHO WAS JUST LEAVING", "BYSTANDER (INNOCENT-ISH)" },
};
public static readonly HumanRole Jogger = new()
{
Name = "Jogger", Weight = 9f, Manner = HumanManner.Jogger, Prop = Headband, Speed = 1.35f,
Shirt = new Color( 0.95f, 0.3f, 0.6f ), Trousers = Black,
Labels = new[] { "JOGGER", "JOGGER (PERSONAL BEST)", "MAN TRAINING FOR A 10K" },
};
public static readonly HumanRole HotDogMan = new()
{
Name = "Hot Dog Man", Weight = 4f, Prop = HotDog, Points = 15f,
Labels = new[] { "MAN WITH A HOT DOG", "MAN WITH A HOT DOG (KEPT HOLD OF IT)" },
};
public static readonly HumanRole Filmer = new()
{
Name = "Filmer", Weight = 12f, Manner = HumanManner.Filmer, Prop = Phone, Points = 15f, Nerves = 0.5f,
Labels = new[] { "MAN WHO FILMED IT", "INFLUENCER", "WOMAN FILMING IN PORTRAIT", "MAN GOING LIVE" },
};
public static readonly HumanRole Tourist = new()
{
Name = "Tourist", Weight = 6f, Manner = HumanManner.Filmer, Prop = Phone, Hat = Straw, WideHat = true, Nerves = 0.5f,
Shirt = new Color( 0.2f, 0.7f, 0.75f ), Trousers = Khaki,
Labels = new[] { "TOURIST", "TOURIST (FIVE STARS)", "MAN ASKING FOR DIRECTIONS" },
};
public static readonly HumanRole Manager = new()
{
Name = "Middle Manager", Weight = 10f, Manner = HumanManner.Hider, Prop = Briefcase, Coat = Grey, Trousers = Grey,
Labels = new[] { "MIDDLE MANAGER", "MAN ON A CALL", "REGIONAL SALES LEAD", "ESTATE AGENT" },
};
public static readonly HumanRole Warden = new()
{
Name = "Traffic Warden", Weight = 3f, Manner = HumanManner.Brave, Prop = TicketPad, Coat = HiVis, Hat = Black, Trousers = Black,
Points = 20f, Nerves = 0.3f,
Labels = new[] { "TRAFFIC WARDEN", "TRAFFIC WARDEN (MID-TICKET)" },
};
public static readonly HumanRole Hero = new()
{
Name = "Have-a-go Hero", Weight = 5f, Manner = HumanManner.Brave, Points = 20f, Nerves = 0.4f,
Labels = new[] { "HAVE-A-GO HERO", "MAN WHO DOES KARATE", "CONCERNED CITIZEN", "MAN WHO SAID 'I'VE GOT THIS'" },
};
public static readonly HumanRole Mime = new()
{
Name = "Mime", Weight = 1.5f, Shirt = White, Trousers = Black, Hat = Black, Points = 15f,
Labels = new[] { "STREET MIME (SILENT THROUGHOUT)" },
};
// ---- The people from the misfits' pasts --------------------------------------------------------
public static readonly HumanRole Farmer = new()
{
Name = "Farmer", Manner = HumanManner.Brave, Prop = Shotgun, Hat = Straw, WideHat = true,
Shirt = new Color( 0.7f, 0.2f, 0.15f ), Trousers = Denim, Points = 30f, Nerves = 0.35f,
Labels = new[] { "FARMER", "FARMER (SHOTGUN UNFIRED)", "FARMER'S COUSIN", "MAN WHO OWNED THE CAGE" },
};
public static readonly HumanRole LabCoat = new()
{
Name = "Lab Coat", Manner = HumanManner.Hider, Prop = Clipboard, Coat = White, Trousers = Grey, Points = 30f,
Labels = new[] { "LAB COAT", "PRINCIPAL INVESTIGATOR", "MAN WHO TOOK NOTES", "DOCTOR (NOT THAT KIND)" },
};
public static readonly HumanRole Orderly = new()
{
Name = "Orderly", Manner = HumanManner.Brave, Shirt = Scrubs, Trousers = Scrubs, Burly = true, Points = 30f, Nerves = 0.3f,
Labels = new[] { "ORDERLY", "ORDERLY (BROUGHT THE STRAPS)" },
};
public static readonly HumanRole TvCrew = new()
{
Name = "TV Crew", Manner = HumanManner.Reporter, Prop = Camera, Shirt = Black, Trousers = Black, Hat = Black, Points = 30f, Nerves = 0f,
Labels = new[] { "CAMERAMAN", "BOOM OPERATOR", "FLOOR MANAGER", "MAN WHO HELD THE CUE CARDS" },
};
public static readonly HumanRole Host = new()
{
Name = "The Host", Manner = HumanManner.Filmer, Prop = Microphone, Coat = Gold, Trousers = Black, Points = 150f, Nerves = 0.2f, Flight = 1.3f,
Labels = new[] { "THE HOST", "THE HOST (AND HIS TEETH)" },
};
public static readonly HumanRole Parent = new()
{
Name = "Parent", Coat = new Color( 0.5f, 0.3f, 0.5f ), Points = 40f,
Labels = new[] { "THE CHILD'S FATHER", "THE CHILD'S MOTHER", "THE CHILD'S UNCLE (BOUGHT THE PET)" },
};
public static readonly HumanRole Child = new()
{
Name = "Child", Manner = HumanManner.Child, Prop = Teddy, Shirt = new Color( 0.95f, 0.85f, 0.2f ), Scale = 0.55f, Points = 0f,
Labels = new[] { "THE CHILD" },
};
// ---- The response --------------------------------------------------------------------------------
public static readonly HumanRole Police = new()
{
Name = "Police", Manner = HumanManner.Brave, Prop = Whistle, Shirt = Navy, Trousers = Navy, Hat = Navy, Guard = true,
Points = 25f, Nerves = 0.2f, Whistles = true,
Labels = new[] { "POLICE CONSTABLE", "SERGEANT", "CONSTABLE (WHISTLE SWALLOWED)", "COMMUNITY SUPPORT OFFICER" },
};
public static readonly HumanRole Riot = new()
{
Name = "Riot Squad", Manner = HumanManner.Brave, Prop = RiotShield, Shirt = Black, Trousers = Black, Hat = new Color( 0.12f, 0.14f, 0.2f ), Burly = true,
Points = 40f, Nerves = 0.1f, Shield = true, Flight = 0.9f,
Labels = new[] { "RIOT OFFICER", "RIOT OFFICER (SHIELD VOID)", "RIOT SERGEANT" },
};
public static readonly HumanRole Soldier = new()
{
Name = "Soldier", Manner = HumanManner.Brave, Prop = Rifle, Shirt = Olive, Trousers = Olive, Hat = Olive, Burly = true,
Points = 50f, Nerves = 0.1f, Salutes = true,
Labels = new[] { "PRIVATE (SALUTED FIRST)", "CORPORAL", "PRIVATE (AWAITING ORDERS)" },
};
public static readonly HumanRole ManInBlack = new()
{
Name = "Man in Black", Manner = HumanManner.Brave, Prop = Shades, Shirt = White, Coat = Black, Trousers = Black,
Points = 75f, Nerves = 0f, Speed = 1.3f, Relentless = true,
Labels = new[] { "MAN IN BLACK", "MAN IN BLACK (YOU SAW NOTHING)", "MAN IN BLACK (ALSO SAW NOTHING)" },
};
public static readonly HumanRole General = new()
{
Name = "General", Manner = HumanManner.Marcher, Prop = Medals, Coat = Olive, Trousers = Olive, Hat = Gold,
Points = 200f, Nerves = 0f, Salutes = true, Flight = 1.25f,
Labels = new[] { "GENERAL", "FIVE-STAR GENERAL", "GENERAL (MEDALS EVERYWHERE)", "FIELD MARSHAL" },
};
public static readonly HumanRole Tubist = new()
{
Name = "Tuba", Manner = HumanManner.Marcher, Prop = Tuba, Coat = Red, Trousers = White, Hat = Black, Points = 60f, Nerves = 0f, Plays = true,
Labels = new[] { "TUBA", "SOUSAPHONE", "TUBA (STILL PLAYING)" },
};
public static readonly HumanRole Trombonist = new()
{
Name = "Trombone", Manner = HumanManner.Marcher, Prop = Trombone, Coat = Red, Trousers = White, Hat = Black, Points = 60f, Nerves = 0f, Plays = true,
Labels = new[] { "TROMBONE", "SECOND TROMBONE", "PICCOLO (BORROWED A TROMBONE)" },
};
public static readonly HumanRole Drummer = new()
{
Name = "Bass Drum", Manner = HumanManner.Marcher, Prop = BassDrum, Coat = Red, Trousers = White, Hat = Black, Points = 60f, Nerves = 0f, Plays = true,
Labels = new[] { "THE BASS DRUM", "DRUM MAJOR" },
};
public static readonly HumanRole Anchor = new()
{
Name = "News Anchor", Manner = HumanManner.Reporter, Prop = Microphone, Coat = new Color( 0.15f, 0.3f, 0.65f ), Trousers = Grey,
Points = 80f, Nerves = 0f, Speed = 1.2f,
Labels = new[] { "LOCAL NEWS ANCHOR", "WEATHERMAN (OFF HIS PATCH)", "ROVING REPORTER", "LOCAL NEWS ANCHOR (BACK TO YOU)" },
};
/// <summary>Every role, so a person can carry just an index.</summary>
public static readonly HumanRole[] All =
{
Shopper, Jogger, HotDogMan, Filmer, Tourist, Manager, Warden, Hero, Mime,
Farmer, LabCoat, Orderly, TvCrew, Host, Parent, Child,
Police, Riot, Soldier, ManInBlack, General, Tubist, Trombonist, Drummer, Anchor,
};
public static int IndexOf( HumanRole role ) => Math.Max( Array.IndexOf( All, role ), 0 );
static float _totalWeight;
/// <summary>One of the ordinary townsfolk, by how common they are.</summary>
public static HumanRole Townsperson()
{
if ( _totalWeight <= 0f )
foreach ( var role in All ) _totalWeight += role.Weight;
float pick = Game.Random.Float( 0f, _totalWeight );
foreach ( var role in All )
{
if ( role.Weight <= 0f ) continue;
pick -= role.Weight;
if ( pick <= 0f ) return role;
}
return Shopper;
}
/// <summary>A district: the people found round one landmark, and the words that landmark's name might hold.</summary>
public sealed class District
{
public string[] Words;
public HumanRole[] Locals; // one of each is placed, in order, then they repeat
public int Count;
public float Radius = 520f;
}
public static readonly District[] Districts =
{
new() { Words = new[] { "farm", "barn", "field" }, Locals = new[] { Farmer }, Count = 12 },
new() { Words = new[] { "lab", "clinic", "hospital", "institute", "facility" }, Locals = new[] { LabCoat, Orderly, LabCoat }, Count = 15 },
new() { Words = new[] { "studio", "tv", "show", "station", "stage" }, Locals = new[] { Host, TvCrew, TvCrew, TvCrew, TvCrew }, Count = 9 },
new() { Words = new[] { "house", "home", "family", "child", "bedroom" }, Locals = new[] { Child, Parent, Parent }, Count = 3, Radius = 140f },
};
/// <summary>
/// What the town sends at each tier of the rampage: who, how many, and how they are drawn up
/// (people per rank; 0 for a loose gaggle).
/// </summary>
public sealed class Response
{
public int Tier;
public string Name;
public HumanRole[] Ranks; // one role per rank, front first; the last repeats
public int Count, PerRank;
public bool Parade; // marches past instead of stopping to make a stand
public string Sound;
}
public static readonly Response[] Responses =
{
new() { Tier = 1, Name = "Police line", Ranks = new[] { Police }, Count = 8, PerRank = 8, Sound = "police_whistle" },
new() { Tier = 2, Name = "Riot squad", Ranks = new[] { Riot }, Count = 10, PerRank = 5, Sound = "riot_drum" },
new() { Tier = 2, Name = "News crew", Ranks = new[] { Anchor, TvCrew }, Count = 3, PerRank = 0, Sound = "news_sting" },
new() { Tier = 3, Name = "The army", Ranks = new[] { Soldier }, Count = 12, PerRank = 4, Sound = "army_bugle" },
new() { Tier = 4, Name = "Men in black", Ranks = new[] { ManInBlack }, Count = 6, PerRank = 0, Sound = "mib_sting" },
new() { Tier = 5, Name = "The parade", Ranks = new[] { General, Trombonist, Tubist, Drummer }, Count = 17, PerRank = 4, Parade = true, Sound = "band_march" },
new() { Tier = 5, Name = "Every news crew", Ranks = new[] { Anchor, TvCrew }, Count = 5, PerRank = 0, Sound = "news_sting" },
};
}