Early development: IFLoom can change until 1.0. What's stable
IFLoom

Examples

The three example games, with how to run each and which file shows each feature.

The IFLoom repository has three example games in examples/, each laid out as every game is (see Organise your game's files). The showcase, Small Town, uses every feature together, The Letter is a linear novel with no plugins, and The Corner Café is a management game a week at a time. Three shapes of game explains what each shape needs, and the tables below say which file shows each feature.

ifloom new copies each one as a game of your own, with --template town, --template novel or --template cafe (see Create a game). A copy leaves out the tests, the recorded snapshots and the showcase's example mods. To run one inside a clone of the repository, see Run the examples from the repository.

npm create ifloom@latest my-town -- --template town

Each example has the CLI's scripts in its package.json:

KeyMeaning
npm run devPlays the game in a browser. The showcase adds its debug card.
npm run buildBuilds dist/index.html, one file beside an art/ folder that opens from disk with no server.
npm run checkLists every problem in the game's content.
npm run playtestPlays the game unattended into a transcript: a week of the showcase into playtest/week.txt, the novel into playtest/read.txt and a season of the café into playtest/season.txt.
npm run snapshotCompares every scene of the showcase with snapshots/scenes.txt. Only the showcase has it.
npm run build:one-fileBuilds dist-one/index.html with the showcase's pictures inside it. Only the showcase has it.

The showcase

Small Town, in examples/showcase, is a first week in a new town. You move into a flat with a cat you name, meet Ava at the café and Sam from downstairs, take a photo with your phone and post it, and get a text the next day. Its tests in tests/showcase.test.ts play it through every system it uses. Every path below is under examples/showcase/.

KeyMeaning
Content layoutsrc/world/ holds what the whole town shares, one file per kind, and src/story/ holds one file per area, each with its scenes, words, locks, resets and slice of plugin content. src/game.ts assembles them into the game module.
Lockssrc/story/moving-day.ts refuses everything but choose and input while the kv key phase is arrival. src/story/office.ts keeps the phone away at work with deny: ['devices/*'].
Inputssrc/story/moving-day.ts asks for the cat's name in the input catName while moving day lasts.
Valuessrc/rules.ts declares the value catName, which the flat's prose prints as {{catName}}, with The cat until a name is typed.
Statssrc/world/stats.ts declares coins, energy and charm, and friendship on the kind character, so each character keeps their own.
Changessrc/world/stats.ts lists the stats whose changes the view reports in changes.
Settingssrc/world/settings.ts declares the play setting hints, which the high street reads, and the ui setting textSize.
Data scenes and variantssrc/story/ava.ts declares ava.hi, with a variants block of small talk from src/story/ava.prose.ts, a chat choice once per turn and a compliment that needs charm.
Flowing scenessrc/story/ava.ts declares ava.river, which reads on as the player chooses and loops back to a point until they settle.
Storyletssrc/story/cafe.ts draws one of three scenes from the set cafe when the player sits a while, with cafe.quiet when none can be drawn. src/unlocks/supporter.ts adds a fourth.
Variants in a locationsrc/story/high-street.ts deals one line of weather each turn from street.weather.
Inline actions and tooltipssrc/story/moving-day.ts puts a tooltip on "launderette", and src/story/flat.ts puts the read-text action inside a line as [[act:read-text|Check it]].
UI piecessrc/story/flat.ts opens Sam's welcome note with [[ui:modal|…]], and src/story/ava.ts opens Ava's photo with [[ui:image|…]].
Presentation hintssrc/story/moving-day.ts fades in and reveals its second line, src/world/stats.ts shows energy as a bar and charm as pips, and src/world/cast.ts gives Ava and Sam a hue each.
Thingssrc/world/things.ts declares the clothing, item and note kinds, the sandwich that can be eaten and sold, and the newspaper that opens the job board.
Effects that make entitiessrc/world/phone.ts makes a photo with create when the player uses the camera.
Storylinessrc/world/cast.ts declares Ava's and Sam's storylines, and the friend quest in src/story/ava.ts is tied to Ava's.
Triggers and noticessrc/story/moving-day.ts raises a welcome notice and gives a note the first time the player is on the high street. src/story/flat.ts takes the rent every Sunday with a notice of fixed id rent.
Rollssrc/story/park.ts rolls 2d6 against 8 to skim a stone, and a trigger rolls 1d6+2 ducks as the player arrives.
Minigamessrc/story/park.ts declares quick feet, arrows, played with the kids for coins.
Timerssrc/story/flat.ts rings the phone with the flat.ring timer, ten seconds to answer.
Rulessrc/rules.ts puts energy back each night in onTurn and posts the newest photo with the macro postLatest. src/story/cafe.ts and src/world/actions.ts reset their once-a-day keys with resets.
Conditions on time passedsrc/story/ava.ts finishes the friend quest's river stage three turns after meeting Ava, with since.
Stringssrc/world/strings.ts renames the quest list with 'ui.quests': 'To do'.
Modssrc/main.tsx loads the player's mods from IndexedDB. mods/fog-season.json adds a line of weather and rewrites the park, and mods/french.json is a words table over moving day.
Picturespublic/art/ holds the portraits and photos, and src/story/cafe.ts gives the café a layered picture with a hotspot on Ava.
The runner and savessrc/main.tsx makes the runner with undo, a backlog, saves, a profile and an autosave each turn.
The React UIsrc/main.tsx renders the game with GameShell and a title page, src/layout.tsx places the plugins' parts by hand, src/ui.ts lists the plugin UIs, and src/styles.css picks the storybook preset.
Calendarsrc/game.ts makes a turn a day, starting on the night the player moves in.
Placessrc/story/flat.ts, high-street.ts, cafe.ts, park.ts and office.ts each declare a location with src/place.ts's helper, with exits, actions and opening hours.
Castsrc/world/cast.ts declares Ava and Sam, with schedules, talk options and Ava's evening call.
Questssrc/story/moving-day.ts and src/story/ava.ts declare settle and friend.
Statusessrc/story/cafe.ts makes a coffee give caffeinated for two turns.
Achievementssrc/world/achievements.ts and src/story/ava.ts declare "Nest egg", with progress, and a secret one by the river.
Inventorysrc/world/things.ts makes the sandwich usable and lists only clothing, items and keepsakes.
Shopsrc/story/cafe.ts declares the counter, with stock that restocks each day and a daily discount.
Jobssrc/story/cafe.ts and src/story/park.ts declare the weekend job and dog walking.
Generatorssrc/story/park.ts makes two visitors each day from the town's pools.
Wardrobesrc/world/things.ts declares the coat and neck slots, the raincoat and the scarf.
Messages, feed and devicessrc/world/phone.ts builds the phone and its apps, and src/story/ava.ts and src/story/sam.ts hold their texts and posts.
Unlocks and cheatssrc/world/cheats.ts declares a free cheat and a supporter one, and the unlock whose code is in .env. src/unlocks/supporter.ts is the content the code opens.
Debugsrc/game.ts adds the debug plugin only when withDebug is set, which src/main.tsx sets in development.
The game modulesrc/game.ts exports the release build and three probes, which ifloom snapshot renders every scene in. tests/build.test.ts runs the check, the build check and the snapshot comparison.

The novel

The Letter, in examples/novel, is a novel in three chapters about a letter on the mat addressed to someone else. It has no plugins, locations, characters or clock. Its tests are in tests/novel.test.ts, and every path below is under examples/novel/.

KeyMeaning
Inputssrc/story/ch1.ts asks for the reader's name, and the prose prints it as {{playerName}}.
saveablesrc/story/ch1.ts refuses a save until the reader has typed a name.
Statssrc/world/stats.ts declares courage, which src/story/ch3.ts reads to open the braver ending.
Remembered choicessrc/story/ch2.ts reads chapter one's choice with { chose: 'ch1.mat#open' }.
Kv counterssrc/story/ch2.ts counts fibs with { kv: 'fibs', by: 1 }, and src/story/ch3.ts reads the count back as a range.
Turnssrc/story/ch1.ts ends a turn at the end of each chapter.
Endings and New Game+src/story/ch3.ts declares finished, carries readBefore over with carryOver, and offers Read it again with a newGame command.
Save migrationssrc/game.ts is version 2, with a step that renames version 1's lies to fibs, and names each save after the reader with saveName.
The React UIsrc/layout.tsx is one centred column with no sidebar, and src/main.ts opens on a title page.

The café

The Corner Café, in examples/cafe, is a management game where a turn is a week. Staff and dishes are entities with numbers of their own, and the player hires and loses staff in play. Its tests are in tests/cafe.test.ts, and every path below is under examples/cafe/.

KeyMeaning
Kinds and entity statssrc/world/staff.ts declares the unique kind staff with skill, morale and wage, and src/world/menu.ts the kind dish with price and quality.
Entities made in playsrc/story/hiring.ts hires Dev or Fen with create, each with their own stats.
each and removesrc/world/actions.ts tires every member of staff at the end of a week, and removes those whose morale runs out.
Actionssrc/world/actions.ts declares the week's buttons, with costs and blocked reasons, and ends the turn from one of them.
Macros and valuessrc/rules.ts works out the takings and wages as macros and the payroll as a value, and types its calls in EffectRegistry.
Stat levelssrc/world/stats.ts shows reputation in levels, with a notice when it goes up.
Triggerssrc/world/triggers.ts watches the till and the staff, and gives a good review once when two of the staff are happy.
The React UIsrc/layout.tsx puts the staff and the menu in the story with EntityTable.
The game modulesrc/game.ts starts the playtest with the opening scene closed, using probe.

Last updated on

On this page