Kapitel 6: Feinarbeiten und Veröffentlichen

Es ist schön, eine Einführung ins Spiel zu haben. Deshalb sollte es eine Regel geben, die am Anfang das Spiel etwas vorstellt:

When play begins, say "Welcome to my game ! :-* .. [line break]I hope you know the story about the wolf and the seven little kids. You are playing the wolf. Your job is to get into the kids' house and to eat all seven kids! You can use a map of the world, which helps you to orient yourself. [line break]"

Außerdem sollte irgendwann klar sein, wann das Spiel eigentlich beendet ist. Irgendeine Regel sollte dazu den Code enthalten:

 [...] end the story saying "You have won!"

Das könnte man über eine globale Variable oder wieder über ein Attribut des Wolfs machen:

The player has a number called kids-eaten. Kids-eaten of the player is 0.

Instead of eating a goat-kid:
	Say "That was nice.";
	Increase kids-eaten of the player by one;
	Remove the noun from play;
	If kids-eaten of the player is 7:
		end the story saying "Hey! You won, you evil wolf."

Wir überprüfen nur beim Essen, ob die nötige Anzahl erreicht wird, aber das reicht bei unserem Spiel ja auch. Sonst müsste man die Siegbedingung in einer Every-turn-Regel abfragen.


Wenn das Spiel fertig ist, kann man es veröffentlichen. Dazu klickt man auf den Release-Knopf, und im Materials-Ordner erscheint eine übersetzte Datei im Format .zblorb oder .z5 oder .z8 – diese Datei kann man jetzt weitergeben, und jeder mit einem Inform-Interpreter kann die Datei dann abspielen.

Die Luxusvariante sieht allerdings so aus, dass man folgenden Code eingibt:

Release along with an interpreter, the source text, the introductory booklet, and a website.

Dann entsteht beim Release nicht nur die z-Datei, sondern eine HTML-Seite dazu, die die z-Datei zum Download anbietet, und ein Javascript-Interpreter, damit man das Spiel gleichauf der Webseite spielen kann, und eine pdf-Datei, die erklärt, wie das Spiel funktioniert, ist auch dabei. Die Elemente sind jeweils optional.

Das sieht dann insgesamt so aus.

Wer will, kann noch mehr Material zur Verfügung stellen:

Release along with an interpreter, the source text, the introductory booklet, a website, cover art and a file of "Landkarte" called "map.odg".

Dazu müssen die Dateien “Cover.jpg” oder “Cover.png” (empfohlen: 960×960 Pixel) und “Small Cover.jpg” oder “Small Cover.png” (empfohlen: 120×120 Pixel) im Materials-Ordner sein, ebenso eine Datei “map.odg” – könnte natürlich auch pdf oder mp3 sein.

Und jetzt der gesamte Quelltext:


"The Wolf and the Seven Kids" by Moritz.

When play begins, say "Welcome to my game ! :-* .. [line break]I hope you know the story about the wolf and the seven little kids. You are playing the wolf. Your job is to get into the kids' house and to eat all seven kids! You can use a map of the world, which helps you to orient yourself. [line break]"

Release along with an interpreter, the source text, the introductory booklet, and a website.

[Release along with an interpreter, the source text, the introductory booklet, a website, cover art and a file of "Landkarte" called "Map.odg". ]

[Dazu müssen die Dateien "Cover.jpg" oder "Cover.png" (empfohlen: 960x960 Pixel) und "Small Cover.jpg" oder "Small Cover.png" (empfohlen: 120x120 Pixel) im Materials-Ordner sein, ebenso eine Datei "Map.odg" - könnte natürlich auch pdf oder mp3 sein.]


The Wolf Cave is a room. "Here is your home. You got nearly everything in this cave that you need to invade the seven little kids. Light comes in from the west." West of the Wolf Cave is the Forest.

The Forest is a room. "This place is very large and it is dark here. You can go north, east, south and west. You can hear birds singing." South of the Forest is the Marketplace. West of the Forest is the Entrance Area. North of the Forest is the River.

The River is a room. "Here is a place where you can relax. Every time you did hard work, you can lie down next to the river and chill. A road leads south to a forest."

The Marketplace is a room. "You should not stay here for too long, because the mother of the kids is often here to buy some food. If she sees you, she will bump the shit out of you. In the north, you can see the trees of the forest."

The Entrance Area is a room. "Now you are in front of the house where the kids live. You have to go west to enter the house, or you can go east to the forest." West of the Entrance Area is the Kid House.

The Kid House is a room. "A nice house. There is only one room, and the exit is west."

The red hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a red hoodie. A hoodie is a sweater with a hood."

The black hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a black hoodie. A hoodie is a sweater with a hood."

The white hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a white hoodie. A hoodie is a sweater with a hood."

The piece of chalk is a thing. It is in the Marketplace. It is edible. The description is "Here is some chalk. You can use it, to write on a blackboard. If you eat it, your voice will get temporarily high and female."

The dripping cave ceiling is scenery in the Wolf Cave. The description is "There are drops at the ceiling. The whole cave is very wet and you can hear the drops hitting the ground."

The trees are scenery in the Forest. The description is "Lots of trees, some old, some new. Some have hearts cut into them." Understand "tree" as the trees.

The birds are scenery in the Forest. The description is "Small bodies that hop from tree to tree."

A goat-kid is a kind of thing. It is always edible. The description usually is "A poor, helpless little kid. Baaa-ahh." The indefinite article is "the".

The first kid, the second kid, the third kid, the fourth kid, the fifth kid, the sixth kid and the seventh kid are goat-kids in the Kid House.

Pitch is a kind of value. The pitches are high, middle and low.
The player has a pitch called voice. The voice of the player is low.

The player has a number called kids-eaten. Kids-eaten of the player is 0.

Instead of eating a goat-kid:
	Say "That was nice.";
	Increase kids-eaten of the player by one;
	Remove the noun from play;
	If kids-eaten of the player is 7:
		end the story saying "Hey! You won, you evil wolf."

Instead of going west from the Entrance Area:
	If the player is wearing the white hoodie:
		If the voice of the player is low:
			Say "You can't go through there. From inside, you hear voices shouting: 'No, you don't sound like our mother.'"; [Strichpunkt nicht vergessen]
		Otherwise:
			Continue the action;
			[regulär weitermachen, also den Spieler bewegen]
	Otherwise:
		Say "You can't go through there. From inside, you hear voices shouting: 'No, you're not our mother. Our mother has got white skin.'"

Instead of eating the piece of chalk:
	Now the voice of the player is high;
	Say "You feel a bit funny.";
	Remove the chalk from play.

Kapitel 5: Das Standardverhalten ändern

Wenn der Spieler einen Befehl eingibt, führt das (nach der Übersetzung durch einen Parser) zum Aufrufen einer oder mehrerer “Regeln”. Diese Regeln regeln das Standardverhalten in der Welt: Dinge, die sich in Reichweite befinden, kann man nehmen, wenn sie tragbar sind; sonst nicht. Essbare Dinge, die man mit sich führt, kann man essen; danach sind sie weg. Versucht man etwas zu essen, das nicht essbar ist, führen die Regeln zu einer entsprechenden Ausgabe an die Konsole – “You can’t eat that” oder so ähnlich. Und wenn man von einem Raum aus in eine bestimmte Himmelsrichtung geht, entscheiden die Regeln darüber, was geschieht – in der Regel kommt man an einen neuen Ort, wenn es den in dieser Himmelsrichtung gibt; ansonsten kriegt man die lapidare Meldung, dass das nicht geht.

Wenn man interessante Geschichten haben möchte und mit der Spielwelt auf interessante Weise interagieren möchte, muss man dieses Standardverhalten ändern. Man kann einen Weg zum Beispiel nur dann gehen, wenn bestimmte Bedingungen erfüllt sind.

Mit selbst geschriebenen Regeln ändert man das Verhalten der Welt. Am häufigsten sind das Instead-Regeln. Eine Instead-Regel wird, etwas vereinfacht gesagt, statt der eigentlich vorgesehenen Regeln angewendet. Hier ein paar Anwendungsbeispiele.

Hier kommst du nicht vorbei

Häufig möchte man, dass ein bestimmter Weg erst dann möglich wird, wenn bestimmte Bedingungen erfüllt sind. Unser Wolf soll erst zu den Geißlein kommen können, wenn er die Kreide gefressen hat und das weiße Kapuzenshirt trägt.

Allgemein:

Instead of going west from the Entrance Area:
	Say "You can't go there."

Das verbietet das Gehen unter allen Umständen. Das ist zu streng:

Instead of going west from the Entrance Area:
	If the player is wearing the white hoodie:
		Continue the action;
		[regulär weitermachen, also den Spieler bewegen]
	Otherwise:
		Say "You can't go through there. From inside, you hear voices shouting: 'No, you're not our mother. Our mother has got white skin.'"

Bei der Syntax muss man eigentlich nur beachten, dass jede Zeile mit einem Strichpunkt (nach einer Anweisung) oder Doppelpunkt (nach einer Kontrollstrukur) endet; ein Punkt kommt erst ganz am Schluss. Punkte innerhalb von Anführungszeichen gelten dabei nur als solche, wenn sie ganz am Schluss des Strings stehen.

Neben “wear” (im Sinne von: an haben) kennt Inform 7 unter anderem noch “carry” (in der Hand tragen), “have” (mit sich führen, in der Hand oder im Rucksack), “contain” (enthalten). Letzteres braucht man zum Beispiel bei “if the box contains the diamond”.

Allerdings muss der Wolf ja zwei Bedingungen erfüllen, mit jeweils unterschiedlicher Folge. Das geht zum Beispiel mit verschachtelten bedingten Anweisungen:

Instead of going west from the Entrance Area:
	If the player is wearing the white hoodie:
		If the voice of the player is low:
			Say "You can't go through there. [line break]From inside, you hear voices shouting: 'No, you don't sound like our mother.'"; [Strichpunkt nicht vergessen]
		Otherwise:
			Continue the action;
			[regulär weitermachen, also den Spieler bewegen]
	Otherwise:
		Say "You can't go through there. [line break]From inside, you hear voices shouting: 'No, you're not our mother. Our mothers has got white skin.'"

Jetzt klappt das auch mit dem Wolf und unser Spiel ist fast fertig. Wir müssen dem Wolf nur noch die Möglichkeit geben, seine Stimme zu erhöhen. Änderungen bei den Variablenwerten macht man mit dem Schlüsselwort now:

Instead of eating the piece of chalk:
	Now the voice of the player is high;
	Say "You feel a bit funny.";
	Remove the chalk from play.

Statt der letzten beiden Zeilen hätte man auch Continue the action. schreiben können. Dann wäre die Kreide auch weg und die Standardantwort würde ausgedruckt werden.

Auftauchende Gegenstände

Häufig möchte man auch, dass Gegenstände erst unter bestimmten Bedingungen auftauchen, oder dass sie verschwinden. Das geht so:

Instead of inserting [something] into the well:
	Remove the noun from play;
	If the noun is the ball:
		Now the frog is in the location of the player;
		Say "A frog appears next to you.";
	Otherwise:
		Say "You listen to the [noun] going down. And then the [noun] is gone."

Dabei steht [something] für: ein sichtbares und erreichbares Objekt der Klasse thing (oder Unterklassen davon). Wenn es bei der Regel nur um ein konkretes Objekt geht, nimmt man einfach dessen Bezeichner.
Ansonsten kann man noch [somebody] für Personen oder Tiere nehmen und [somewhere] für eine beliebige Himmelsrichtung.

Mit Personen reden

[Kommt später mal.]

Bislang lautet der vollständige Quellcode so:

"The Wolf and the Seven Kids" by Moritz.

The Wolf Cave is a room. "Here is your home. You got nearly everything in this cave that you need to invade the seven little kids. Light comes in from the west." West of the Wolf Cave is the Forest.

The Forest is a room. "This place is very large and it is dark here. You can go north, east, south and west. You can hear birds singing." South of the Forest is the Marketplace. West of the Forest is the Entrance Area. North of the Forest is the River.

The River is a room. "Here is a place where you can relax. Every time you did hard work, you can lie down next to the river and chill. A road leads south to a forest."

The Marketplace is a room. "You should not stay here for too long, because the mother of the kids is often here to buy some food. If she sees you, she will bump the shit out of you. In the north, you can see the trees of the forest."

The Entrance Area is a room. "Now you are in front of the house where the kids live. You have to go west to enter the house, or you can go east to the forest." West of the Entrance Area is the Kid House.

The Kid House is a room. "A nice house. There is only one room, and the exit is west."

The red hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a red hoodie. A hoodie is a sweater with a hood."

The black hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a black hoodie. A hoodie is a sweater with a hood."

The white hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a white hoodie. A hoodie is a sweater with a hood."

The piece of chalk is a thing. It is in the Marketplace. It is edible. The description is "Here is some chalk. You can use it, to write on a blackboard. If you eat it, your voice will get temporarily high and female."

The dripping cave ceiling is scenery in the Wolf Cave. The description is "There are drops at the ceiling. The whole cave is very wet and you can hear the drops hitting the ground."

The trees are scenery in the Forest. The description is "Lots of trees, some old, some new. Some have hearts cut into them." Understand "tree" as the trees.

The birds are scenery in the Forest. The description is "Small bodies that hop from tree to tree."

A goat-kid is a kind of thing. It is always edible. The description usually is "A poor, helpless little kid. Baaa-ahh." The indefinite article is "the".

The first kid, the second kid, the third kid, the fourth kid, the fifth kid, the sixth kid and the seventh kid are goat-kids in the Kid House.

Pitch is a kind of value. The pitches are high, middle and low.
The player has a pitch called voice. The voice of the player is low.

Instead of going west from the Entrance Area:
	If the player is wearing the white hoodie:
		If the voice of the player is low:
			Say "You can't go through there. From inside, you hear voices shouting: 'No, you don't sound like our mother.'"; [Strichpunkt nicht vergessen]
		Otherwise:
			Continue the action;
			[regulär weitermachen, also den Spieler bewegen]
	Otherwise:
		Say "You can't go through there. From inside, you hear voices shouting: 'No, you're not our mother. Our mother has got white skin.'"

Instead of eating the piece of chalk:
	Now the voice of the player is high;
	Say "You feel a bit funny.";
	Remove the chalk from play.

Anhang: Weitere Regeln.

Die meisten Regeln sind schon fest eingebaut. Man muss sie nicht kennen, man muss nicht einmal wissen, welche es gibt, aber für das spätere Eingreifen in die feste Regelwelt ist etwas Hintergrundwissen nützlich.
Es gibt unter anderem Check-, Carry-Out- und Report-Regeln. Sie werden hier für die Aktion etwas essen vorgestellt.

Check-Regel: Vor dem Ausführen der Aktion

Die Check-Regel zu einer Aktion bestimmt, ob die Aktion überhaupt ausgeführt werden kann. Essen kann man nur Essbares, das schreibt man in Inform so:

Check an actor eating (this is the can’t eat unless edible rule):
	if the noun is not a thing or the noun is not edible,
		stop the action with library message eating action number 1 for the noun.

Wenn die Check-Regel bestanden wird, geht die Aktion weiter an die nächsten Regeln:

Carry-Out-Regel: Das Ausführen der Aktion.

Die Carry-Out-Regel zu einer Aktion bestimmt, was durch das Ausführen der Aktion in der Modell-Welt verändert wird. Gegessene Objekte verschwinden:

Carry out an actor eating (this is the standard eating rule):
	remove the noun from play.

Danach geht die Aktion weiter an die nächsten Regeln:

Report-Regel: Textausgabe nach der ausgeführten Aktion.

Die Report-Regel zu einer Aktion bestimmt, was nach der Ausführung als Text ausgegeben werden soll.

Report an actor eating (this is the standard report eating rule):
	if the actor is the player, issue library message eating action number 2 for the noun;
		otherwise issue actor-based library message eating action number 3 for the noun.

Check-, Carry-Out- und Report-Regeln schreibt man selber nur dann, wenn man neue Aktionen erfindet, die von den Inform-Standardregeln nicht vorgesehen sind.


Außerdem gibt es unter anderem noch Regeln vom Typ “When” und “Every turn”:

When play begins:
	Say "Welcome to my game."

Every turn when the player is carrying the piano:
	Say "Uuuuh. That's heavy."

Kapitel 4: Eigene Klassen und Attribute

Wir wollen jetzt nur noch die sieben Geißlein in ihrem Haus haben. Außerdem soll der Wolf ja nur herein können, wenn er das richtige Kapuzenshirt an hat und wenn er die Kreide gefressen hat.

Zuerst die Geißlein

Man könnte natürlich sieben Mal das gleiche schreiben

The first kid is a thing in the Kid House. It is edible. The description is “A poor, helpless little kid. Baaa-ahh.”

Aber wir machen uns die Arbeit leichter und legen eine neue Klasse an, und zwar eine Unterklasse von thing. Das geht mit dem Schlüsselwort a kind of:

A goat-kid is a kind of thing. It is always edible. The description usually is “A poor, helpless little kid. Baaa-ahh.” The indefinite article is “the”.

Das mit dem Artikel brauchen wir, damit es dann nicht heißt: You see a first kid, sondern: the first kid.

Dann geht es ein wenig schneller:

The first kid, the second kid, the third kid, the fourth kid, the fifth kid, the sixth kid and the seventh kid are goat-kids in the Kid House.

Inform 7 ist dabei so schlau und versteht, dass das “s” in “goat-kids” ein Plural ist und die Klasse goat-kid gemeint ist.

Dann die Stimme des Wolfs

Ob der Wolf zu einem bestimmten Zeitpunkt das Kapuzenshirt trägt oder nicht, kann man leicht überprüfen. Ob der Wolf aber jemals die Kreide gefressen hat oder nicht, das merkt sich das Spiel standardmäßig nicht. Am einfachsten löst man das über ein Attribut des Wolfs, das angibt, in welchem Zustand er sich befindet – vor oder nach gefressener Kreide, beziehungsweise mit hoher oder tiefer Stimme.

Für den Anfang beschränken wir uns auf folgende Datentypen: text, number und truth state. (Entspricht: String, int, boolean.)

Wir haben verschiedene Möglichkeiten:

The player has a number called frequency. The frequency of the player is 10.

The player has a text called sound-of-voice. The sound-of-voice of the player is “low”.

The player has a truth state called highness-of-voice. The highness-of-voice of the player is false.

Alternativ kann man – ähnlich wie in Java beim Aufzählungstyp Enum – Werte vorgeben. Zuerst werden die möglichen Werte definiert (entsprechend der Enum-Definition):

Pitch is a kind of value. The pitches are high, middle and low.

Danach kann man ein Attribut von diesem Typ anlegen:

The player has a pitch called voice. The voice of the player is low.

Alternativ könnte man weniger objektorientiert arbeiten und eine globale Variable definieren, die keinem bestimmten Objekt zugeordnet ist:

Frequency is a number that varies. The frequency is 12.

— Und zuletzt gibt es noch eine Abkürzung, die man bei der Definition von Klassen verwenden kann:

A person can be good, bad or mediocre. People usually are good. [Inform weiß, dass people der Plural von person ist]

Das geht schnell und hat lediglich den Nachteil, dass diese Art Attribut keinen Bezeichner hat, auf den man sich im Code beziehen könnte.

Wenn wir uns für die Enum-Lösung entscheiden:

Pitch is a kind of value. The pitches are high, middle and low.
The player has a pitch called voice. The voice of the player is low.

– dann lautet der gesamte Code bisher:

"The Wolf and the Seven Kids" by Moritz.
 
The Wolf Cave is a room. "Here is your home. You got nearly everything in this cave that you need to invade the seven little kids. Light comes in from the west." West of the Wolf Cave is the Forest.
 
The Forest is a room. "This place is very large and it is dark here. You can go north, east, south and west. You can hear birds singing." South of the Forest is the Marketplace. West of the Forest is the Entrance Area. North of the Forest is the River.
 
The River is a room. "Here is a place where you can relax. Every time you did hard work, you can lie down next to the river and chill. A road leads south to a forest."
 
The Marketplace is a room. "You should not stay here for too long, because the mother of the kids is often here to buy some food. If she sees you, she will bump the shit out of you. In the north, you can see the trees of the forest."
 
The Entrance Area is a room. "Now you are in front of the house where the kids live. You have to go west to enter the house, or you can go east to the forest." West of the Entrance Area is the Kid House.
 
The Kid House is a room. "A nice house. There is only one room, and the exit is west."
 
The red hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a red hoodie. A hoodie is a sweater with a hood."
 
The black hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a black hoodie. A hoodie is a sweater with a hood."
 
The white hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a white hoodie. A hoodie is a sweater with a hood."
 
The piece of chalk is a thing. It is in the Marketplace. It is edible. The description is "Here is some chalk. You can use it, to write on a blackboard. If you eat it, your voice will get temporarily high and female."
 
The dripping cave ceiling is scenery in the Wolf Cave. The description is "There are drops at the ceiling. The whole cave is very wet and you can hear the drops hitting the ground."
 
The trees are scenery in the Forest. The description is "Lots of trees, some old, some new. Some have hearts cut into them." Understand "tree" as the trees.
 
The birds are scenery in the Forest. The description is "Small bodies that hop from tree to tree."

A goat-kid is a kind of thing. It is always edible. The description usually is "A poor, helpless little kid. Baaa-ahh." The indefinite article is "the". 

The first kid, the second kid, the third kid, the fourth kid, the fifth kid, the sixth kid and the seventh kid are goat-kids in the Kid House.

Pitch is a kind of value. The pitches are high, middle and low.
The player has a pitch called voice. The voice of the player is low.

Jetzt haben wir alle wichtigen Objekte angelegt. Aber noch kann der Wolf sich überallhin frei bewegen, ob mit tiefer oder hoher Stimme, mit oder ohne Kapuzenshirt. Dieses Standardverhalten der Objekte muss im nächsten Schritt angepasst werden.

Kapitel 3: Gegenstände anlegen

Wir brauchen als Gegenstände drei Hoodies (rot, weiß und schwarz) und ein Stück Kreide. Außerdem soll es ein paar unbewegliche Objekte geben, die vor allem zur Dekoration da sind und das Spielen befriedigender machen. Außerdem brauchen wir noch sieben Geißlein. Den Wolf spielen wir selber.

Allgemeine Gegenstände und ihre Eigenschaften

Die Klasse für Gegenstände ist thing:

The red hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is “This is a red hoodie. A hoodie is a sweater with a hood.”

The black hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is “This is a black hoodie. A hoodie is a sweater with a hood.”

The white hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is “This is a white hoodie. A hoodie is a sweater with a hood.”

Gegenstände haben in der Regel eine Beschreibung, die mit: the description is eingeleitet wird. Außerdem brauchen sie, jedenfall wenn sie von Anfang an im Spiel da sein sollen, eine Ortsangabe, zum Beispiel eben in the Wolf Cave. Der Ort sollte vorher angelegt worden sein.

Gegenstände haben außerdem bestimmte Attributwerte. Die wichtigsten sind:

  • wearable/not wearable – kann man anziehen oder nicht
  • edible/not edible – kann man essen oder nicht
  • portable/fixed in place (oder: not portable) – kann man mitnehmen oder nicht
  • scenery/not scenery (dazu später mehr)

Das mit dem wearable haben wir schon bei den Hoodies eingesetzt.

Dann packen wir auch noch die essbare Kreide dazu:

The piece of chalk is a thing. It is in the Marketplace. It is edible. The description is “Here is some chalk. You can use it, to write on a blackboard. If you eat it, your voice will get temporarily high and female.”

Das scenery-Attribut

Normalerweise werden alle Gegenstände in einem Raum eigens in einer zur Laufzeit generierten Liste ausgedruckt. Das sind vor allem die wichtigen Gegenstände, die einem in dem Raum sofort auffallen würden, und die man vielleicht mitnimmt oder benutzt.
Atmosphärisch wird die Geschichte aber erst dann, wenn es Gegenstände gibt, die reine Dekoration sind. Wenn ein Gegenstand den Attribtuwert auf scenery gesetzthat, wird dieser Gegenstand nicht in der Liste ausgedruckt, ist aber doch vorhanden – man kann sie betrachten und benutzen. (Standardmäßig: nicht mitnehmen, aber das kann man ändern.) Da diese Gegenstände nicht in der Liste aufgeführt werden, muss man durch die Raumbeschreibung den Spieler-Leser darauf hinweisen, dass es da noch etwas gibt, das man betrachten kann:

The dripping cave ceiling is scenery in the Wolf Cave. The description is “There are drops at the ceiling. The whole cave is very wet and you can hear the drops hitting the ground.”

Oder:

The trees are scenery in the Forest. The description is “Lots of trees, some old, some new. Some have hearts cut into them.” Understand “tree” as the trees.

The birds are scenery in the Forest. The description is “Small bodies that hop from tree to tree.”

Behälter und Oberflächen

Es gibt zwei wichtige Unterklassen von thing, nämlich supporter und container. In einen Container kann man Sachen tun, auf einen Suppoerter kann man Sachen draufstellen.

Wenn es sich um einen Behälter handelt, gibt es auch noch:

  • openable/not openable – kann man öffnen und schließen oder nicht
  • lockable/not lockable – kann man auf- und zusperren oder nicht
  • open/closed – ist zur Zeit offen oder geschlossen
  • locked/unlocked – ist zur Zeit zugesperrt oder nicht
  • enterable/not enterable – man kann hineingehen oder nicht
  • transparent/opaque (oder: not transparent) – ist durchsichtig oder nicht

Für die Geißlein-Geschichte brauchen wir das nicht, jedenfalls solange wir keinen Uhrenkasten haben wollen, in dem sich ein Geißlein versteckt. Deshalb nur kurz zwei Beispiele:

Ein Pappkarton:

The cardboard box is an openable container in the Living Room. The description is “Looks like an ordinary cardboard box.” [It is closed and not lockable. It is not transparent.]

Die Angaben in eckigen Klammern kann man eigentlich weglassen, da das schon die Standard-Attributwerte für Container sind.

Ein Sessel, betretbar (man kann darauf sitzen) und zu schwer zum Tragen:

The comfy chair is an enterable supporter in the Living Room. It is fixed in place. The description is “My! This looks comfortable.” Understand “comfortable” as the comfy chair.

Fehlen noch die Geißlein. Die kommen im nächsten Kapitel.

Wichtige Klassen und Attribute im Überblick:

Gesamter Code bisher:

"The Wolf and the Seven Kids" by Moritz.
 
The Wolf Cave is a room. "Here is your home. You got nearly everything in this cave that you need to invade the seven little kids. Light comes in from the west." West of the Wolf Cave is the Forest.
 
The Forest is a room. "This place is very large and it is dark here. You can go north, east, south and west. You can hear birds singing." South of the Forest is the Marketplace. West of the Forest is the Entrance Area. North of the Forest is the River.
 
The River is a room. "Here is a place where you can relax. Every time you did hard work, you can lie down next to the river and chill. A road leads south to a forest."
 
The Marketplace is a room. "You should not stay here for too long, because the mother of the kids is often here to buy some food. If she sees you, she will bump the shit out of you. In the north, you can see the trees of the forest."
 
The Entrance Area is a room. "Now you are in front of the house where the kids live. You have to go west to enter the house, or you can go east to the forest." West of the Entrance Area is the Kid House.
 
The Kid House is a room. "A nice house. There is only one room, and the exit is west."

The red hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a red hoodie. A hoodie is a sweater with a hood."

The black hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a black hoodie. A hoodie is a sweater with a hood."

The white hoodie is a thing. It is wearable. It is in the Wolf Cave. The description is "This is a white hoodie. A hoodie is a sweater with a hood."

The piece of chalk is a thing. It is in the Marketplace. It is edible. The description is "Here is some chalk. You can use it, to write on a blackboard. If you eat it, your voice will get temporarily high and female."

The dripping cave ceiling is scenery in the Wolf Cave. The description is "There are drops at the ceiling. The whole cave is very wet and you can hear the drops hitting the ground."

The trees are scenery in the Forest. The description is "Lots of trees, some old, some new. Some have hearts cut into them." Understand "tree" as the trees.

The birds are scenery in the Forest. The description is "Small bodies that hop from tree to tree."

Kapitel 2: Räume anlegen

Der Kopf des Spiels, der beim Anlegen einer neuen Geschichte automatisch erzeugt wird, sieht so aus:

“The Wolf and the Seven Kids” by Moritz.

Danach werden Raum-Objekte angelegt, analog zur Karte:

The Wolf Cave is a room. “Here is your home. You got nearly everything in this cave that you need to invade the seven little kids. Light comes in from the west.” West of the Wolf Cave is the Forest.

The Forest is a room. “This place is very large and it is dark here. You can go north, east, south and west. You can hear birds singing.” South of the Forest is the Marketplace. West of the Forest is the Entrance Area. North of the Forest is the River.

The River is a room. “Here is a place where you can relax. Every time you did hard work, you can lie down next to the river and chill. A road leads south to a forest.”

The Marketplace is a room. “You should not stay here for too long, because the mother of the kids is often here to buy some food. If she sees you, she will bump the shit out of you. In the north, you can see the trees of the forest.”

The Entrance Area is a room. “Now you are in front of the house where the kids live. You have to go west to enter the house, or you can go east to the forest.” West of the Entrance Area is the Kid House.

The Kid House is a room. “A nice house. There is only one room, and the exit is west.”

Jedes Raumobjekt besteht aus einem großgeschriebenen Bezeichner (der Leerzeichen enthalten darf) und der Klassenbezeichnung room. Danach folgt in Anführungszeichen die Beschreibung des Raumes. Die Beschreibung sollte bereits enthalten, wohin man von diesem Raum aus gehen kann, sonst muss der Spieler raten.
Die Beschreibung ändert sich während der Geschichte nur selten. Nicht enthalten soll sie deshalb Informationen über bewegliche Gegenstände oder Personen dort, denn die könnten in einem späteren Stadium des Spiels ja nicht mehr da sein.

Die Verbindungen zwischen Räumen gibt man einfach an, indem man schreibt:

The River is east of the Markeplace.

oder

East of the Marketplace is the River.

Die Verbindung in der Gegenrichtung wird dabei automatisch erstellt. Einen Fehler gibt es, wenn man “to the east” oder “in the east of” schreibt.

Achte auf Verschreiber: sonst hast du plötzlich mehr Räume, als du wolltest.

Verzichte vorerst auf Türen.

Gesamter Code bisher:

"The Wolf and the Seven Kids" by Moritz.

The Wolf Cave is a room. "Here is your home. You got nearly everything in this cave that you need to invade the seven little kids. Light comes in from the west." West of the Wolf Cave is the Forest.
 
The Forest is a room. "This place is very large and it is dark here. You can go north, east, south and west. You can hear birds singing." South of the Forest is the Marketplace. West of the Forest is the Entrance Area. North of the Forest is the River.

The River is a room. "Here is a place where you can relax. Every time you did hard work, you can lie down next to the river and chill. A road leads south to a forest." 

The Marketplace is a room. "You should not stay here for too long, because the mother of the kids is often here to buy some food. If she sees you, she will bump the shit out of you. In the north, you can see the trees of the forest."

The Entrance Area is a room. "Now you are in front of the house were the kids live. You have to go west to enter the house, or you can go east to the forest." West of the Entrance Area is the Kid House. 

The Kid House is a room. "A nice house. There is only one room, and the exit is west."

Kapitel 1: Nötige Software und Vorarbeiten

1. Die Entwicklungsumgebung für Inform 7 installieren (Windows, Mac, Ubuntu). Eventuell auch den Interpreter Gargoyle installieren, um andere, nicht selbst geschriebene Spiele spielen zu können. Quellen: Siehe “Links”.

2. Eine Idee für eine kurze Geschichte haben. Als Ausgangspunkt für ein Konzept empfiehlt sich, vom Schauplatz auszugehen, an dem die Geschichte spielt. Er sollte aus etwa fünf miteinander verbundenen Räumen bestehen. Ein typischer Raum wäre “Wohnzimmer”. Weniger geeignet ist “Burg” (die besteht aus vielen Räumen) oder gar “München.” Geschichten mit so großen Räumen sind denkbar, aber untypisch, ebenso Geschichten, die nur in einem Raum spielen.

Für die Geschichte sollte man ein paar Gegenstände brauchen, und eventuell auch Personen – die sind aber aufwendiger zu programmieren, wenn sie gut sein sollen.

Diese Anleitung benutzt dazu eine Schülerarbeit zu “Der Wolf und die sieben Geißlein”: Man spielt den Wolf, der ins Haus der Geißlein möchte. Er kommt aber erst ins Haus, wenn er die Kreide gefunden und gegessen hat und einen weißen Hoodie übergezogen hat, damit ihn die Geißlein für ihre Mutter halten. Dann kann er die Geißlein nehmen und fressen und das Spiel beenden.

3. Eine Karte zeichnen. Typische Himmelsrichtungen sind Nord, Süd, Ost, West, Südwest und so weiter, daneben auch oben und unten.

Kapitel 18: Aufgaben

Aufgabe

  • Jetzt ein paar Aufgaben zum Üben. Hier sind einige Gegenstände abgebildet und beschrieben. Setze sie in Programmcode um und stelle sie in einen Raum deiner Wahl. (Stecke alle in denselben Raum, das macht es einfacher.)
 

The black hat is a wearable thing. The description is “A black hat, with a grey hatband.”

 

The brown briefcase is an openable container. It is closed. The description is “A brown briefcase, made of leather. It’s not very new.” The carrying capacity is 2. Understand “bag” and “leather” as the briefcase.

 

The yummy bananas are edible things. The description is “Yellow and golden and delicious, just ripe for eating.” They are plural-named. Understand “banana” as the bananas.

 

The birthday cake is an edible thing. The description is “A birthday cake with seven candles.” Some candles are part of the birthday cake. The description is “Seven candles, in several different colours.”

 

The new backpack is a closed, openable and wearable container. The description is “A backpack for serious walking trips.” Understand “rucksack” as the backpack. The carrying capacity is 5.

 

The chest of drawers is a supporter. “A wooden chest of drawers with two drawers.” The first drawer is a container and part of the chest. It is openable and closed. The second drawer is a container and part of the chest. It is openable and closed.

Kapitel 17: Klassendiagramm und kleines Quiz

Hier siehst du die Vererbungshierarchie als Klassendiagramm dargestellt. Jede Unterklasse erbt alle Attribute der Oberklasse. Wenn sie nicht überschrieben werden, erben sie auch die Standardwerte. Unterklassen können außerdem zusätzliche Attribute einführen und diese wiederum an ihre Unterklassen weitervererben.

Aufgabe

Quizfragen:

Nr.

ja

nein

Frage
1 ( ) ( ) Kann jede Tür theoretisch einen Eigennamen haben?
2 ( ) ( ) Kann jedes Ding theoretisch betretbar sein?
3 ( ) ( ) Kann jedes Ding theoretisch offen sein?
4 ( ) ( ) Kann jeder Behälter theoretisch ein Pluralwort sein?
5 ( ) ( ) Kann jeder Raum theoretisch betretbar sein?
6 ( ) ( ) Kann es zu jeder Tür theoretisch einen passenden Schlüssel geben?
7 ( ) ( ) Kann es einen Behälter geben, den man wie ein Kleidungsstück trägt?
8 ( ) ( ) Kann es leuchtende Supporter geben?