The demo's own code
What this page is for
Section titled “What this page is for”The Hollow Throne has its own C# in Intrigues Demo/Game. The three folders this page covers, Rules, Boot and Audio, hold 4,570 lines in 26 files. They are also a worked example of how a game plugs into Intrigues. There are methods a scheme can call, a component that ticks each month and year, a save header, and sound that listens to events. This page names each part and says where it lives. It teaches no rule of the demo’s world.
When you come here
Section titled “When you come here”- You are writing your own
[IntrigueMethod]and want a model. - You want to run something every month or year, as the demo does.
- You want your save list to show more than a slot name.
- You want sound or other effects to follow Intrigues events.
Code methods
Section titled “Code methods”The demo has 37 methods marked [IntrigueMethod], in four static classes. A scheme calls one with Run Code, Get From Code, a Method Returns True condition, or a For Each Actor over a method. See Code methods.
| Class (file) | Methods | Used by |
|---|---|---|
MapPlace (Map/Interactions/MapPlace.cs), 17 |
PlaceChosen, HasRaidPlace, HasCastlePlace, HasPortPlace, HasAbbeyPlace, HasForestPlace, HasFaminePlace, HasOwnPlace, HasOwnCastle, HasRestlessPlace, TakeMapPlace, ShiftPlace, MarkSmoke, IsBesiegedPlace, CastellanOf, AbbotOf, NeighbourLords |
The map schemes. See Inside Raid the Village. |
DemoMethods (Rules/DemoMethods.cs), 10 |
below | System schemes and a few others. |
WarMethods (Rules/WarMethods.cs), 9 |
HoldsLand, LeadsWar, BeginWar, MakePeace, PickSiegeTarget, OccupyProvince, ReleaseOccupation, TransferOccupied, ArmyStrength |
The war and peace schemes. |
MindMethods (Rules/MindMethods.cs), 1 |
FillVacantSeat(Actor first, Actor second) |
A decision’s callMethod. |
36 of the 37 names appear in the draft files. ProvinceCount appears in none.
The ten methods of DemoMethods:
| Signature | What it does |
|---|---|
Actor RichestMerchant() |
The richest living Master Merchant by Marks, or nobody. |
Actor HighestRuler() |
The living head of the highest rank, or nobody. |
bool ProvinceCount(Actor conspirator) |
Leaves the number of provinces the clan holds in the World variable Rules Result. True when it holds any. |
Clan PickRandomNeighbour(Actor conspirator) |
A random realm whose land touches the conspirator’s realm. |
Actor StrongestKnight(Actor conspirator) |
The man-at-arms of the clan with the most Arms. |
bool? IsNeighbourRealm(Actor conspirator, Actor target) |
Whether the two realms touch. No answer without a map. |
bool TakeProvince(Actor conspirator, Actor target) |
The conspirator’s clan takes one province from the target’s realm. |
bool PlagueToll(Scheme scheme) |
Rolls how hard the plague bites, 0 to 30, into Rules Result. Kills nobody. |
bool? ApplyHarvest(IntrigueCall call) |
Moves the Prosperity of the realm’s provinces half way toward the World variable Last Harvest. |
bool? ShiftProsperity(IntrigueCall call) |
Adds the scheme’s own Shift variable to the Prosperity of every province the realm owns. |
A method cannot return a number. The demo’s answer, stated in the comment of DemoMethods, is to leave the number in a World variable and answer true when it is above 0. Then read it with Compare Numbers, straight after Run Code. Do not call the writing methods from a requirement row.
Monthly and yearly rules
Section titled “Monthly and yearly rules”DemoRules is a component that makes itself when a game starts, with no scene edit (Bootstrap). It acts only where Hosting is true: on a single-player machine or the host, and only when the loaded database’s name contains Hollow Throne. It listens to WorldClock.MonthBegan and WorldClock.YearBegan.
| Tick | What it decides | Scheme it starts |
|---|---|---|
| Month | Land: income, muster and drift to calm (RulesLand.Monthly) |
none; it writes variables |
| Month | Two story schemes while they are due | The Years Before, The Hollow Heir |
| Month | Births | Have a Child |
| Month | Deaths, by age, health and sickness | Natural Death |
| Month | Illness for adults | Illness |
| Month | Empty council seats, each clan every third month | Vacant Seat |
| Month 8 | The harvest of each realm with land | Harvest |
| Month | A rumour, every third month | Rumour Mill |
| Year | A plague, 5% | Plague |
| Year | Everyone who turned 16 | Coming of Age |
| Year | Tithes between clans tied by Tithe | Tithe Day |
Yearly weddings are not a scheme. The code asks the product, Actor.Marry. Every start in this table goes through StartSystem, which calls StartScheme with StartOptions.IgnoreRequirements, so the game, not a requirement, decides when. When a clan’s head dies, DemoRules starts Inheritance Proclamation directly once the clan has a head again, outside the monthly limit. At most StartsPerTick (3) of one scheme start in a tick; a due start that does not fit waits for a later month. A scheme the database lacks is skipped. Inside Natural Death shows what one of them does. Events are in Events reference.
DemoSaves.NewRequest builds a SaveRequest with a title, the play time, a picture of the ruler’s seat and four custom header entries: ruler, realm, date and running. The save list reads them back with SlotRow.Custom(key) for its heading, date and Continue line. The header does not change the save format. Besides the save list, only DemoFlow reads it: on a load, running says whether the days go on. See Saving and loading.
DemoFlow is the scene flow: a new game, a load through the loading scene, back to the menu, quit. On a new game it starts Tutorial for each player (see Inside the Tutorial scheme).
DemoAudio is one object that stays through every scene. It subscribes to Intrigues events. It plays sound for the local player’s side only, so a death in another house is silent here.
| Event | What the demo does |
|---|---|
IM.onSchemeStarted, IM.onSchemeEnded |
A stinger when your scheme starts or ends; music tension up or down for a plot with you on one side. |
IM.onActorDeath |
A death bell and, at most every 120 seconds, funeral music, for your own side. |
IM.onMarried, IM.onChildBorn |
Wedding bells and music; a birth sound. |
IM.onClanRelationStarted, IM.onClanRelationEnded |
A war horn and a war mood for a Banners Raised tie; a peace stinger for Stayed Hand. |
IM.onRoleInherited |
A coronation, a horn or a knighting sound by role. |
DialogueManager.Opened, DialogueManager.Closed |
Feast or diplomacy sound while a dialogue with a known scheme and choice key is open. |
How it connects
Section titled “How it connects”The ticks use the clock events listed in Events reference, and Code methods explains the first table. The schemes that use these methods are in this group: Raid the Village and Natural Death. Start with The Hollow Throne: a tour.