So I’m backtracking (again) through my Shadow code to expose data for UI purposes. This time I want to build word lists based on the state of the game. In order to do this, I need to manage the context of things, rooms, and doors.
I started out with a strongly-typed solution:
StoryContext is a kind. The EmptyContext is a StoryContext.
A Room has a StoryContext called context. The context of a Room is usually EmptyContext.
A Thing has a StoryContext called context. The context of a Thing is usually EmptyContext.
A Door has a StoryContext called context. The context of a Door is usually EmptyContext.
Section - Room Context
player hid in clockcase is a StoryContext.
player listening is a StoryContext.
abbot left quarters is a StoryContext.
Book - Word Lists
Word List is some text that varies.
Every Turn:
if the player is in Abbot's Quarters:
if the context of Abbot's Quarters is EmptyContext:
now Word List is "hide/in clock, look/at cot, look/at clock, look/at desk";
if the context of Abbot's Quarters is player hid in clockcase:
now Word List is "go/west, open/the door";
if the player is in Inside Clock Case:
if the context of Inside Clock Case is EmptyContext:
now Word List is "listen/with/tumbler";
if the context of Inside Clock Case is player listening:
now Word List is "listen"
I’m nearly positive that this is overkill. I could add a text property to Rooms, Things, and Doors and change that:
now the context of Abbot's Quarters is "the player has already hidden in the clock";
However, no one is going to read that sentence…it’s only for logic within the source. And too, comparing the context to a long string is silly.
I see this as sort of meta context, not game logic context. Or, one could consider it UI context. There is the danger that I will be managing game and UI context and missing things, but I have this nagging feeling that I want to keep their implementations separate…I can’t define why I feel that way. I just do.
Does anyone have any thoughts on guiding me to an optimal solution?
David C.
www.textfyre.com