An Auto-Flooring System

Nothing ground breaking (pun intended) but hopefully this will give some noobs (hey, that’s me!) a few ideas.

"Auto-Flooring" by John Doe

The story headline is "or How I Floored the Entire World".

[Note: It's ideal to give every room a unique floor, just for the sake of texture.]

Limbo is a room. [A holding area that can not be visited.]

A floor is a kind of thing. A floor is always scenery. A floor is always privately-named.  The description of a floor is usually "It keeps us from falling to the center of the Earth, at least." Before putting something on a floor: try dropping the noun instead.  Instead of looking under a floor: say "Maybe if you were a mole."  Before taking a floor: say "Much too much for one person to carry!" instead. Instead of doing something other than examining or taking or touching to a floor: say "Not likely to do much."

Outdoor Area is a region. Indoor Area is a region. [Note: Remember to place all rooms that can be visited into one of these two master regions.]

Understand "floor" or "flooring" as floor when location is in Indoor Area.
Understand "ground" as floor when location is in Outdoor Area.

An astroturf is a kind of floor. [A generic floor.]
100 astroturfs are in Limbo.
[Note: We can only have a maximum of 100 rooms with generic floors or we'll crash and burn at first run.]

Definition: a floor is natural if it is an astroturf. [Yes, I understand the humorous contradiction. It's... irony, or something.]

Instead of touching a natural floor contained by a room in Outdoor Area, say "Solid.".
Instead of touching a natural floor contained by a room in Indoor Area, say "Abused by years of heavy traffic."

Rule for printing the name of an astroturf:
	if the location is in Outdoor Area, say "the ground";
	otherwise say "the floor".

Definition: A room is floored if it contains a floor.
Definition: A room is unfloored if it does not contain a floor.
[Note: You cannot use a statement like this with backdrops, so flooring has to be scenery.]
[Well, you can. But you won't likely get the result you're looking for.]

When play begins:
	repeat with unfurnished-room running through unfloored rooms:
		move a random astroturf in Limbo to unfurnished-room.
		[This is a gap filler; if the room doesn't have a specific floor, now it gets the generic floor.]
		
Beach is a room. The description is "Picturesque, but difficult to walk on due to the sand. East lies a forest." The sand is a floor in beach. Understand "sand/sands/grain/grains" as sand. The description of the sand is "Like sands through the hourglass..." Beach is in Outdoor Area.

Instead of touching the sand, say "The more you tighten your grip, the more the grains slip through your fingers."

Forest is east of the beach. The description is "Trees and rocks. To the west is the beach, to the south is a garage." Forest is in Outdoor Area.

Garage is south of Forest. The description is "Keeps your car dry. To the north is a forest. To the southwest is a house." Garage is in Indoor Area.

Mansion is southwest of Garage. The description is "How fancy, what with the marble floors and all. To the northeast is a garage." A marble floor is a floor in Mansion. Understand "marble/floor" as marble floor. The description of marble floor is "Natural colors and specks. Thank you Mother Nature." Mansion is in Indoor Area.

Instead of touching the marble floor, say "Feels expensive. REALLY expensive."
Instead of taking the marble floor, say "Where are you planning to sell that, thief?"

The player is in Beach. The player holds a ball. The description of ball is "Drop it, and see where it rolls."

Enjoy. Improve. Hate. Mock.

Maybe add a bit to convert “entering floor” into “going down”.

As an addendum, I first approached this with the intention to do:

A floor is a kind of backdrop.
Uni-Surface is a floor.

A room can be floored or unfloored.
A room is usually unfloored.

When play begins:
	repeat with Place running through all rooms:
		if there is a floor in Place, now Place is floored; [failure!]
	move the Uni-Surface backdrop to all unfloored rooms;
	update backdrop positions.

That seems to work, until you try “carpet is a floor in Living Room” and then “x floor” when you’re in the Living Room and Inform wants to know which of the two floors you mean. So clearly “if there is a floor in Place” is a statement that fails with backdrops.

Is there a way to specify something like “if there is a floor visible/in-scope/touchable/etc. in a room, now that room is floored”?

Seems weird that a room can’t “contain” a backdrop as such.

Well, you know, you’ve gotta know when to call it ‘good enough’ sometimes. The Pareto principle needs to be my mantra to offset my neurotic tendencies.

But good idea, and one I don’t think I’ve implemented anywhere.

Instead of creating 100 floors, couldn’t you say

[code]A floor is a kind of supporter. A floor is usually enterable. A floor is usually scenery. Understand “floor/flooring/ground/rug/carpet/grass” as a floor.

Every room contains one floor[/code].

And go from there - rather than predicting the number of rooms.

See, great ideas like that are why I actually post here. Thanks for the suggestion.

Here’s how I riffed off that idea for anyone interested:

"New Floor Test" by John Doe

A floor is a kind of supporter.  A floor is usually enterable.  A floor is usually scenery.  Understand "floor/flooring/ground/rug/carpet/grass" as a floor. The description of a floor is "[FloorDescription]."

Before putting something on a floor: try dropping the noun instead.  Instead of looking under a floor: say "Maybe if you were a mole."  Before taking a floor: say "Much too much for one person to carry!" instead. Instead of doing something other than examining or taking or touching to a floor: say "Not likely to do much." Before entering a floor, try going down instead. Instead of touching a floor, say "Solid."

To say FloorDescription:
	if the location is:
		-- Garage: say "Hard and cracked";
		-- otherwise: say "Keeps your from falling to the center of the Earth, at least".

Every room contains one floor.

Forest is a room. The description is "West is a garage."

Garage is west of Forest. The description is "The floor here is made of poured cement. East is a forest."
Rule for printing the name of a floor in Garage: say "cement". Understand "poured/concrete/cement" as a floor when location is Garage. Instead of touching a floor in Garage, say "Cold and rough."

The player holds a ball. The description of ball is "Drop it, and see where it rolls."

The only thing I don’t necessarily like about it is that the “To say FloorDescription” requires you to return to that statement to add in floor descriptions instead of being able to throw the descriptions somewhere inline with the rest of the room/floor interaction paragraph. I.E. keeping all the stuff for the Garage and its floor in the same section.

But… I do think this system is superior to my initial method. Wish I would have thought of it.

Here’s an improvement using a rulebook to put the floor descriptions back with the rooms. So the basic idea is you have a default rule for the floor description (keeps you from falling to the Earth). And any room that wishes to set an override can add a rule to it (with a location test or any other condition, say after spilling milk maybe description could be “wet floor - watch your step”):

"Rulebook Floor Test" by Bugs_R_Us

A floor is a kind of supporter.  A floor is usually enterable.  A floor is usually scenery.  Understand "floor/flooring/ground/rug/carpet/grass" as a floor. The description of a floor is "[FloorDescription]."

Before putting something on a floor: try dropping the noun instead.  Instead of looking under a floor: say "Maybe if you were a mole."  Before taking a floor: say "Much too much for one person to carry!" instead. Instead of doing something other than examining or taking or touching to a floor: say "Not likely to do much." Before entering a floor, try going down instead. Instead of touching a floor, say "Solid."

Describing Floor is a rulebook.

To say FloorDescription:
	follow the Describing Floor rules.

rule for Describing Floor (this is the default floor description rule):
	say "Keeps you from falling to the center of the Earth, at least".

Every room contains one floor.

Forest is a room. The description is "West is a garage."

Garage is west of Forest. The description is "The floor here is made of poured cement. East is a forest."
Rule for printing the name of a floor in Garage: say "cement". Understand "poured/concrete/cement" as a floor when location is Garage. Instead of touching a floor in Garage, say "Cold and rough.".
rule for Describing Floor when location is the Garage:
	say "Hard and cracked"; rule succeeds.

The player holds a ball. The description of ball is "Drop it, and see where it rolls."

output:

[code]
Rulebook Floor Test
An Interactive Fiction by Bugs_R_Us
Release 1 / Serial number 151211 / Inform 7 build 6L38 (I6/v6.33 lib 6/12N) SD

Forest
West is a garage.

examine floor

Keeps you from falling to the center of the Earth, at least.

w

Garage
The floor here is made of poured cement. East is a forest.

examine floor

Hard and cracked.

l
Garage
The floor here is made of poured cement. East is a forest.

[/code]

Ah. Very workable.

What I don’t understand is why floors can’t be directly referenced by statements like ‘Understand “poured/cement/concrete” as the garage floor.’

It seems that creating things in the sense of “Names made by assembly” is pretty useless. You can say ‘Every room has a person (called its guard)’ but then you can’t say ‘The description of the museum’s guard is “An intimidating, but bored, looking fellow.”’ in a way that works. It compiles correctly as if it recognizes the object, it displays the object during play, but referencing it in source code does little to nothing meaningful.

Edit: A quick glance at the index reveals that Inform winds up creating “The museum’s guard” as an entirely new thing not placed anywhere in the world.

You can kludge by defining your “name made by assembly” as a kind of thing (including rooms, people, etc) then using every Room has a [insert your kind here]. I can’t seem to refer to the contained kind in initial story declaration, hence the decide phrase kludgery and the When play begins: rule to set the initial description. In the declarative part of the story it appears Inform is guessing it should create a new object before it fully checks for defined labels (the guard). Placing that logic within a phrase denies Inform from creating a new object (since compile time world creation declaration does not apply to phrases) forcing Inform to search completely through all defined labels.

"Rulebook Floor Test" by Bugs_R_Us

A floor is a kind of supporter.  A floor is usually enterable.  A floor is usually scenery.  Understand "floor/flooring/ground/rug/carpet/grass" as a floor. The description of a floor is "[FloorDescription]."

Before putting something on a floor: try dropping the noun instead.  Instead of looking under a floor: say "Maybe if you were a mole."  Before taking a floor: say "Much too much for one person to carry!" instead. Instead of doing something other than examining or taking or touching to a floor: say "Not likely to do much." Before entering a floor, try going down instead. Instead of touching a floor, say "Solid."

Describing Floor is a rulebook.
To say FloorDescription:
	follow the Describing Floor rules.
rule for Describing Floor (this is the default floor description rule):
	say "Keeps you from falling to the center of the Earth, at least".
Every room contains one floor.

A socializer is a kind of person.
Every room contains a socializer.
To decide which person is the socializer of (R - a room):
	decide on entry 1 of the list of socializers in R.

Forest is a room. The description is "West is a garage."

Garage is west of Forest. The description is "The floor here is made of poured cement. East is a forest."
Rule for printing the name of a floor in Garage: say "cement". Understand "poured/concrete/cement" as a floor when location is Garage. Instead of touching a floor in Garage, say "Cold and rough.".
rule for Describing Floor when location is the Garage:
	say "Hard and cracked"; rule succeeds.
When play begins:
	now the description of the socializer of Garage is "A very chatty mechanic that would talk all day about rods and pistons if you let him.".

The player holds a ball. The description of ball is "Drop it, and see where it rolls."

Test me with "x floor / x socializer / w / x floor / x socializer".

This is how I did it in my last game. You really don’t need a separate object for every room:

[code]The ground is a backdrop. “It’s just the ground beneath your feet.” The ground is everywhere.

A room can be indoor or outdoor. Understand “floor” as the ground when the location is indoor.

Rule for printing the name of the ground when the location is indoor: say “floor”.

Instead of putting something on the ground: try dropping the noun.
Instead of getting off the ground: say “There’s nowhere else to stand.”
Instead of entering the ground: say “You’re standing there already.”
Instead of looking under the ground: say “You’ll need a shovel for that.”[/code]

You have to remember to designate each room as indoor or outdoor, of course.

Dang it! Where is that stupid shovel!

Need? No. It’s probably just a strong want. Ha ha.

Yeah, I realize that most people have very simple floor requirements, but I’m neurotic and it’s helping me learn the nuances of an overly immersive environment.

Here’s my latest development, and I think it’s pretty much as good as I’m going to get unless someone else sees a way to streamline it.

I think it’s pretty slick (tooting my own horn).

"Another Flooring Method" by John Doe

Understand "above/upward/upwards" as up. Understand "below/downward/downwards" as down.
[So player can use them for directional travel.]

A flooring is a kind of supporter. A flooring is always scenery. A flooring is usually enterable. The description of a flooring is usually "Keeps you standing." A flooring is usually privately-named.

Definition: a room is floorless if it contains no flooring.
Definition: a room is floored if it contains a flooring.

Before putting something on a flooring: try dropping the noun instead.  Instead of looking under a flooring: say "Maybe if you were a mole."  Before taking a flooring: say "Much too much for one person to carry!" instead. Instead of doing something other than examining or taking or touching to a flooring: say "Not likely to do much." Before entering a flooring, try going down instead.

Instead of touching a flooring, say "Solid."

hard wood flooring is a kind of flooring. The description of a hard wood flooring is "Nice and fancy. Made from trees." Understand "floor" as a hard wood flooring.
tile flooring is a kind of flooring. The description of a tile flooring is "Simple, but easy to clean." Understand "floor/waxy/buildup" as a tile flooring.
dirt flooring is a kind of flooring. The description of a dirt flooring is "Not easy to sweep." Understand "dirt/dirty/ground/soil" as a dirt flooring. The printed name of dirt flooring is "dirty ground".

Instead of touching a dirt flooring, say "Dirty soil."
Instead of touching a tile flooring, say "Waxy buildup."

generic flooring is a kind of flooring. Understand "ground/floor" as a generic flooring. The printed name of a generic flooring is "ground".

A hard wood floored room is a kind of room. A tile floored room is a kind of room. A dirt floored room is a kind of room. An unfloored room is a kind of room.

[Note the distinction between 'floorless' and 'unfloored'; floorless has no flooring whatsoever, whereas an unfloored room has no 'designer' flooring.]

Every tile floored room contains a tile flooring.
Every hard wood floored room contains a hard wood flooring.
Every dirt floored room contains a dirt flooring.
Every unfloored room contains a generic flooring.

Mansion is a hard wood floored room. The description is "Quite posh. Inside the mansion is a bathroom, and a forest is visible to the west. A strange region beckons from above."

Limbo is up from Mansion. The description is "Seems a bit like a boring heaven here."

Forest is west of mansion. It is a dirt floored room. The description is "Nature's finest. To the east lies a mansion. A place is to the south."

Environment is south of Forest. It is an unfloored room. The description is "Just a typical ambiguous place. To the north is a forest."

Bathroom is a tile floored room. Bathroom is inside from Mansion. The description is "You know, where you get clean. A doorway leads out back to the Mansion."

Immaterial plane is a backdrop. It is everywhere. Understand "mist" as the immaterial plane. Understand "ground/floor" as the immaterial plane when the location is floorless. The description of the immaterial plane is "Just some mist, so it's very strange that you are staying afloat." The printed name of immaterial plane is "mist".

Before doing something to the immaterial plane when the location is floored, say "[We] [can't] see any such thing." instead.

Before putting something on the immaterial plane, try dropping the noun instead.
After dropping something in a floorless room, say "[The noun] hovers strangely."

Instead of looking under the immaterial plane: say "It's a long way down."  Before taking the immaterial plane: say "A bit too ephemeral." instead. Instead of doing something other than examining or taking or touching to the immaterial plane: say "Not likely to do much." Before entering the immaterial plane, try going down instead.

Instead of touching the immaterial plane: say "Your fingers float right through."

The player holds a ball. The description of ball is "Drop it, and see where it rolls."

It’s very easy to add flooring types with this method, and it’s very easy to implement on a per-room basis, as you only have to say ‘foo-room is a hard wood floored room’. It doesn’t get much easier.

You can simplify that even more if you make the immaterial plane object behave like a universal floor. Then you can create rooms as normal (Barn is a room.) and it’ll have a rudimentary floor and you only have to specify that a room has a particular flooring if it’s out of the ordinary.

I just liked playing with the concept of having an entirely floorless room as well. You know, if you’re Superman, Casper, Rogue or something.

Edit: One caveat with this is that if you’ve made it so rooms are in scope for certain actions (examining is the big one) then you’ll almost always get a conflict between the room type (tile floored, etc.) and what that flooring is Understood as “tile”. It can be cured by substituting it with tile-floored room or the like. That breaks the prose aesthetics ever so slightly, but, eh.