Coding day and a lucky find

I wrote some truly horrible code today which I’m embarrassed will see daylight, but at least it works now. Getting the trains to report the time till arrival accurately posed some weird problems. There is surely a less clunky way to write it. BUT IT WORKS and I never want to think about it again. (Until I do, then will refactor mightly.)

Briefly went out in the sun and cold to do an errand and feed yatima’s cats. On the way home there was some pretty nice free furniture out on the curb. I have been meaning to replace the kids’ desk with a nicer one (which means a bunch of measuring and a time consuming errand and a conumdrum of getting a desk delivered). Their old desk is a very janky thing that is not quite a desk. Maybe it was a side table? It has a shelf underneath that stops you from putting your legs properly under the desk. And I had to repair one side of it with duct tape. But it was free and was on the sidewalk a block away.

And!!!! Now!!!! Another free desk just across the street from our house, a much better one, solid, sturdy, with one small drawer, very desky, just the right size (bigger) and painted a pleasant, not too childish, bright blue. It is in good shape but not so nice that you would need to worry about messing it up. As you may guess I got Danny to carry it with his mighty muscles across the street and then we both shoved it up the stairs. It looks super nice now. As usual, I forgot to take a “before” pic.

My feeling of triumph! The desk is good! I have arranged it beautifully in the room! I hope the kids will be impressed with me but of course mostly I just hope they like it and use it.

Danny has been livestreaming on Code Therapy a bunch today talking with someone named lambda malformation and some other …. probably Lisp nerds…. It’s soothing and he doesn’t seem to mind if I suddenly start cursing my screen or talking to the cat in the middle of his livestream.

My game is getting a little more fun and playable. I’m filling out 24th St. Mission station and its surroundings and I’ve started on 16th. Some of the puzzles are now in place. Next I might add conversations or more complex behavior with the NPCs (currently a tamale lady (not THE tamale lady), a flower seller, a street preacher, and a raccoon.

blue desk in a little room

Exploring multisensory descriptions in Inform7

Over the past week I’ve been experimenting with different ways to make an interestingly playable game where the player’s point of view can be multisensory in various ways. So, for example, a character who is hearing and sighted would experience visual, sound, touch, and scent based room descriptions, while a Deaf character would not get the sound descriptions.

One way is to use Touchy Feely extension by Quantum Games. I ended up forking this and adding a few things to fix a couple of errors in the extension, and then adding more options as default descriptions for items. This extension builds in some commands like smell, touch/feel, listen, and taste. You can set the sound of a room, a person, or an object very easily just like you set the (visual) description.

With those rules, and a few others, I started writing rooms like this:

The Bedroom is a room.
The description of the bedroom is
"[if the player is sighted]A small room with white walls and some posters hanging up. The bed has a colorful striped bedspread and paisley sheets. The doorway is in the west wall.[end if]
[if the player is hearing] There is an air filter humming loudly in the corner.[end if]
[if the player is not sighted and the player is not hearing] A small room with a bed in it. The west wall has a wide doorway.[end if]"

The sound of the bedroom is "A loud air filter in the corner fills the room with white noise."
The scent of the bedroom is "The air in here seems very clean and fresh."
The bed is scenery in the bedroom. The description is "A soft, comfy bed. You give it an experimental bounce."
The pillow is scenery in the bedroom. The description is "A nice, soft, squishy pillow."
The bedspread is scenery in the bedroom.
The bedsheet is scenery in the bedroom.
The air filter is scenery in the bedroom.
The doorway is scenery in the bedroom.
The walls are scenery in the bedroom.

Things that are scenery aren’t described until you examine them. I wrote a general search command called (explore, or tap ) which conveniently lists all these “scenery” aspects of a room for non-sighted characters. Sighted characters have to examine them one at a time.

The problem with this method is that it is clunky and I’m repeating various elements of the room description. Ideally, I’d be able to replace a bunch of Inform7 behavior so that:
– Each room (and thing) can have a visual, sound, etc description.
– The game checks if the player has those senses
– The game concatenates the various sensory descriptions appropriately

This turns out to be difficult. I got into reading the Standard Rules (which, from the Inform7 IDE, you can see as an extension) and then realized what I wanted to do was basically happening in the Carry out looking (this is the room description body text rule): section of code. I thought maybe I could hack in a check on the sound of the room and print that.

But! This code refers to the Inform6 core of the game, with

To print the location's description:
(- PrintOrRun(location, description); -).

I tried copying THAT and doing something like PrintOrRun(location, sound), which didn’t work because location and description here are constants from Inform6, I think.
Not sure how to pursue this further. Maybe in future as I get more familiar with the guts of Inform.

So, I tried another way. I suppressed the room description body text rule like so:
The room description body text rule is not listed in any rulebook.
And copied it and pasted it into my example game with a slightly different name.

Carry out looking (this is the room descriptions body text rule):
if the player is sighted:
if the visibility level count is 0:
if set to abbreviated room descriptions, continue the action;
if set to sometimes abbreviated room descriptions and
abbreviated form allowed is true and
darkness witnessed is true,
continue the action;
begin the printing the description of a dark room activity;
if handling the printing the description of a dark room activity:
now the prior named object is nothing;
say "[It] [are] pitch dark, and [we] [can't see] a thing." (A);
end the printing the description of a dark room activity;
otherwise if the visibility ceiling is the location:
if set to abbreviated room descriptions, continue the action;
if set to sometimes abbreviated room descriptions and abbreviated form
allowed is true and the location is visited, continue the action;
print the location's description;
if the player is hearing:
say "[sound of the location][paragraph break]";
otherwise:
say "[feel of the location] [scent of the location] [taste of the location] [paragraph break]";

Because I’m not using the “print” function the sound and other sensory qualities of the room are described under the actual room description. That might be OK but now I need to learn how to elegantly write a room description that is broken out into visual, sound, and other qualities. I also need some kind of bare bones description that doesn’t show to the player unless the player character is deaf-blind. This will take some practice to learn to write well, and some more refining of how I show which bits of the descriptions.

Note that I will probably be adding in low vision and hard of hearing (by taking the visual and sound descriptions and munging them a bit.)

Rewiring brain for new code

What can I say – I worked on my game all day again today. It was great. The feeling of seeing the entire huge structure holographically and knowing (more or less) what to do and how to break it down into pieces is just glorious. I’m all fizzy with ideas at really random times.

I spent some time trying to understand some excellent advice on the interactive fiction forum and halfway got there. Then needed to chill out a bit and let it percolate, so I worked through some of the examples in the inform7 manual and played around. At some point I realized a different way to approach the problem and plunged back in, making my magic elevator a room again instead of a vehicle.

Finally got that working around 6pm. But only imperfectly. Then had another epiphany, threw it out and refactored it again and now it is seamless! I thought of some good improvements and noted them as issues for later.

However, I still have to solve the original hard problem because my rideable vehicle (ie a wheelchair) has to be able to enter and exit another vehicle (the train.) It’s still satisfying to have the elevators work so neatly, in the meantime.

Danny and I went grocery shopping, he cooked (lamb with mint sauce and roast potatoes) and I cleaned up. He is still muttering into his beard about Lisp and stuff but I was too sunk into my own thing to know what about. A cosy and fabulous weekend.

Considering elevators

Yesterday I worked on my game for a while and we went to a friend’s (fan)vid watching party. Along the way we came across Orquestra de Calle 24 and people dancing in the BART plaza, then the entire Women’s March once we popped out of the station at Powell. Thousands of people with signs, drums, & that spine-shivering thing where you hear a cheer begin way down at another end of the march and it travels up and passes you like a wave!

The party was in a gorgeous building, the Medico-Dental building, and I assumed it was someone’s friend’s office. It was a dentist’s office with a huge screen TV and interesting decor – not at all dentist-y feeling – Odd things like a table made of what might have been an aluminum alloy cast of a gnarled section of a giant tree – Rococco chairs and mirrors and silver trays but then also a raw unfinished wooden beam with orange paint “MEETING ROOM” under a CAUTION HARD HATS REQUIRED sign. As we were leaving I found out that it was booked using something called Peerspace. Huh!!

It was nice seeing everyone – the vids were amazing – And I had fun dressing up. I had some doctors appointments near there and went into the Sephora to look for a specific shampoo and lotion – having never been in one of those stores before. And I was like Oh holy fuck I don’t wear makeup, like, I own one lipstick and an eyeshadow, but, now I want some because it is all strangely alluring and pretty and looks like candy. That was a couple of months ago and since then we have all been putting on “cyberpunk makeup” and now I own 4 colors of metallic matte lipstick (Fenty has a nice pencil one, but I like the Anastasia liquid matte a lot better.) So I busted out that stuff yesterday and had fun with it. Lipstick seems to have advanced since I last really wore it in like, 1990. It stays on and is not bothersome. As long as I feel properly like it’s a fun game and I’m in drag, all is well. Not really into it otherwise. (It is GLAM BUTCH CYBORG makeup.)

liz in silver blue lipstick

And, today I figured out a way around a problem that has been bugging me. I had modeled an example elevator which went between two floors, based on the simplest example in the Inform7 recipe book. Couldn’t figure out how to fix the logic to make it go to three or more floors, and also, with that and the more complicated elevator example (a skyscraper in Dubai) and a third way I thought of, I would end up with the problem of having to write 100 uniquely named elevators, each with their own logic. That would be tedious and make the code unnecessarily bloated so I have gone another route.

Instead of having the elevator be a room, I made it a vehicle, and put any room where the elevator could possibly be, into a region called Liftlandia. If the player is in the Liftlandia region, then the elevator is in the location of the player. I had to start it in nowhere, and haven’t quite gotten it to appear on the first time the player enters a room in Liftlandia. But, it works. If you try go up or down in Liftlandia (because you see stairs) it doesn’t let you- you need to use the elevator. Once you’re in it, you can go up and down to the rooms in whichever direction it’s possible.

Now, I’d like a nicer way to have the player push a button to go to the desired floor. With my ‘magic vehicle’ solution, I can write in a P, C, and S button (for Platform, Concourse, Street) and they are pushable. I’m not quite sure how to have the buttons take you to the correct place but it should be possible.

Along the way I also had to abandon my desires to build a nice simulation of the real life map because it was a huge pain in the ass and I am aiming for a different level of abstraction. Not without a pang but already you see that I have to have at least 3-5 “rooms” for each of 52 stations (platform, concourse, street, and likely something extra like more outside locations, or secret rooms in the stations, or whatever.) Mapping each station expanded that to like, 20 or more locations per station.

I started adding some NPCs with simple behaviors and I may try next to add “scenes”. For example, I’d like musicians to wander by, or, for some kids to get on BART and set up to dance and pass a hat and for stuff like that to happen randomly. Some NPCs or scenes would happen in particular locations and others might wander.

For the actual game aside from my mechanical difficulties, there will be magic and time travel, I still want to simulate various mobilities and sightedness states, and I have a sort of poetic mood or atmosphere in mind which stretches back to a book I never really wrote called The Secret Life of Buildings but which I could describe as a holographic vision of things that will lead people to see the city around them differently, and love it more deeply. (And to look things up.) We will see. And, I’m still working on another game with Milo. I may start systematically pasting in, running, and modifying each example from the Inform7 recipe book, as it is very helpful way to learn to make complicated things happen in the game.