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
{
plaintext,
json
}
Thoughts are welcome.