On Programming

Yeah, sorry guys, still no new IF reviews from me — I’ve been using my spare time to work on my own IF project.

About which, here’s something interesting that happened: I’ve implemented this cat, named Frobozz, who wanders randomly around the house that the game largely takes place in. The problem I was having was that my pathfinding code doesn’t take closed doors into account (I tried, but doing so caused him to not want to travel through open doors either).

So, for example, if Frobozz tried to go east and the door in that direction was closed, he’d bounce off, and you’d see:

Frobozz saunters off to the east.

You hear a jingle, and look down to see that Frobozz has wandered into the room.

Less than ideal.

The solution I arrived at, with my limited knowledge of Inform 7? I implemented a second, invisible cat, named Shadow. When Frobozz wants to go somewhere, Shadow tries it first, and if he ends up still in the same room then Frobozz doesn’t bother trying.

My point basically is that for me, the most satisfying part of programming is when an utterly insane solution to a problem totally works.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s