IF Text Emission and Aggregation

As a part of my C# IF Platform design experiment using ChatGPT-4, I’m at the point where I want to add one of my personal theoretical components, specifically a Text Engine.

In all current (parser-based platforms (that I’m aware of), text is emitted in a stream. Some of this text happens deeply in the compiler or in the execution engine so can’t really be altered without major rewrites of the existing platform.

So this is my idea. Here’s a sample of IF output broken down into parts:

{Room Title}
{blank line}
{Room Description}
{blank line}
{List of Exits)
{blank line}
{List of visible objects including containers with visible items
and supporters with visible items}

I’d like to go further and identify potential parts of the Room Description, like “Early Report, Embedded Report, and End Report” where some text is injected into the default room description in the beginning, middle, or end.

I’d also add contextual options for adding other separate line items in relation to other parts, like LineAfterRoomTitle and InParensWithRoomTitle. I suspect people would come up with templates for this sort of thing and a list of contexts to use for rules.

Rules would be simple text aggregation or insertion actions based on the given context. Each context would have a default rule. Authors or platform extenders could provide alternate templates, contexts, and rules.

Once the turn has completed, the execution engine would call _textEngine.Compile() which returns either a plain text string or a key/value pair list (maybe in json?). So the output would be an interface:

public interface ITextOutput
    TextType OutputType { get; set; }
    string Output { get; set; }

public enum OutputType

Thoughts are welcome.

1 Like

Not sure whether your idea is to work around streaming text that cannot be altered or is it a proposal on how that streaming text should work.

FWIW, what i do is the engine emits text as a sequence of messages containing additional metadata. These are collected and transformed into the visible presentation. Nevertheless the body text is mostly just that, text.

Specifically, i don’t need meta for parts of the output like room description, list of exits etc because the game does not need to follow any specific output format, eg such as the framing you have listed since not all games will present this way.

My understanding is your idea is to provide alternatives and rules so the game can customise the format.

That would indeed work.

What i do instead is to have the output framing under the story’s control. specifically, the story actually specifies the game main loop and what it does rather than having a “standard” one that can be customised.

Both. The author should have complete control over all emitted text and be able to take a final look before emitting the results.

I’m experimenting with ways to implement a solution that accommodates easy usage and perfect results.