Trizbort 1.5.7.1 Released

Trizbort1571I released today another version of Trizbort (1.5.7.1).  This version focused mainly on fixing some bugs and making the app a bit more user friendly for keyboard users.  There were a few new features that I think are pretty nifty.

As always you can download the latest bits at http://bit.ly/trizbortjl

If you are interested in seeing or playing with some code, you can find that on GitHub at http://bit.ly/TrizbortSource

Bug Fixes

First with the bugs.  I thank everyone that made suggestions and reported bugs as they were much appreciated and made my job much easier.

Some of the highlights of things fixed:

  • Made the naming of regions a bit more robust as the user could enter some characters that would either break the save file or would break Inform if exported to code.
  • I also made the region setup form a bit more robust as there were a few ways to you could break the app if you tried hard enough.
  • I tried to clean up the exporting to Inform7 by making sure the app wouldn’t generate bad I7 code.  Some of these changes naturally fall through to I6 and TADS3, but I still need to do some work there as I’m not as familiar with those languages.
  • SmartSave better handles an unsaved Trizbort file better.
New features

As I have a long list of suggested feature ideas, I want to try to include some of those with each release (new features are usually more fun to play with than fixed bugs anyway)

Some highlights:

  • Selected rooms and connections are now much more noticeable and it doesn’t really interfere with the coloring of regions.
  • New keyboard shortcut (Ctrl-Shift-A) to select all rooms of a particular region (I’ll add a menu item later for you mouse users).  Select one room of the region you are interested in and press Ctrl-Shift-A and viola that region is selected.
  • Ctrl-Alt-Arrow to resize selected room.  That keystroke is pretty standard to handle resizing so I wanted to be sure to include it.
  • Arrow keys will now move selected rooms around.  Previously the arrow keys always moved the map, now if you have rooms selected it will move the rooms instead.  Nothing selected still moves the map as before.
  • Added some more context menu items and shortcut keys for quick access.

 

Advertisements

July 2014 – Update

Where did the summer go, kids are getting ready to go back to school, football season is upon us (for anyone readying this not familiar, American high school football is huge in the section of northeast Ohio I’m at….often drawing more fans and played in bigger stadiums than some area universities.) I’ve been working on a bunch of different projects, probably should narrow down and focus.

I’ve got an interesting idea for a new work that as an interesting mechanic in it which I’m vetting through the technical details now. This will be an Inform project so working through some areas there I’ve not tackled before. The story itself is a bit more complex than others I’ve done, so kind of wondering if I have the writing chops for that or not.

As I mentioned in my last post, I’m part of a small team that have been investigating doing other type of games as well. We’ve all done graphical games in the past, but none of us have released anything or really finished anything to a degree where it was truly playable. We’ve begun to play with the Unity3D engine and I must say, I’m quite impressed. In really just a few hours (maybe 10 or so spread out over a week), I’ve managed to implement a pretty decent Asteroids remake with quite a few extras. The true test was when my 9 and 13 year old boys say and played it for over an hour this weekend and were striving to beat each others high score.

I know that’s not necessarily IF related, but looking down the path of creating something like King’s Quest next. Nothing revolutionary, but I think it would be fun to do. I won’t be giving up the pure parser pieces as their is something special, pure and clean about the them that you can’t get anywhere else.

I hope to have more to talk about next month once I’m free to talk about a few things that I can’t now, but for now……go north my friends.

Inform 7 Gems – Pathfinding

Simple pathfinding is really pretty easy in Inform 7.  A very simple example of having a NPC following the player around can be coded up pretty simply.

Kitchen is a room. The description of kitchen is "Smells of last night's dinner still linger in the air."

Family-room is a room. The printed name of family-room is "Family Room". The description of family-room is "A sole rocking chair sits facing the large screen television in the corner." Family-room is south of kitchen.

Dining-room is a room. The printed name of dining-room is "Dining room". The description of dining-room is "A table sits in the middle of the room with just two chairs on either side." The dining-room is north of the kitchen.

The den is a room. The description of den is "The den contains a student desk with a simple wooden chair." The den is west of the dining-room.

The kitten is an animal. The kitten is in the kitchen. The description of kitten is "The small fluffy kitten sits and looks expectantly at you."

Every turn:
 let course be the best route from location of the kitten to the location of the player;
 if course is a direction, try kitten going course.

Pretty simple, yet useful in a lot of situations.  The manual has a decent set of examples with character movements.

What about doors?

As it stands doors will present an issue for the pathfinding routines.  To handle doors, just change the best route line to something more like the following:

let course be the best route from location of the kitten to the location of the player, using doors;

What about closed doors?

This might be ok for a human NPC that can open doors, but for the kitten, how do we stop them from entering through closed doors?

The kitchen is a room. The description of kitchen is "Smells of last night's dinner still linger in the air."

The family-room is a room. The printed name of family-room is "Family Room". The description of family-room is "A sole rocking chair sits facing the large screen television in the corner."

The dining-room is a room. The printed name of dining-room is "Dining room". The description of dining-room is "A table sits in the middle of the room with just two chairs on either side." The dining-room is north of the kitchen.

The den is a room.  The description of den is "The den contains a student desk with a simple wooden chair." The den is west of the dining-room.

The kitten is an animal. The kitten is in the family-room. The description of kitten is "The small fluffy kitten sits and looks expectantly at you."

The kitchen-door is a door. the kitchen-door is north of family-room and south of the kitchen. The kitchen-door is closed. Understand "door" as kitchen-door. The printed name of kitchen-door is "kitchen door".

Every turn:
  let course be the best route from location of the kitten to the location of the player, using doors;
  if course is a direction:
    repeat with doorway running through visible doors:
      if the other side of doorway from the location of the kitten is room course from the location of the kitten:
        if doorway is open:
          try kitten going course;
        otherwise:
          say "You hear a scratching from the other side of the door.";

Let’s add one more tidbit to this little example.  What happens if there isn’t a best course for the kitten to get from it’s location to the player’s location?  In this case, the pathfinding returns the value nothing for the variable course.  When does this happen?  It will occur when the kitten is already in the location of the player, it can occur when there is no direct route between the player and the kitten, and it can occur when there is some criteria we put on the pathfinding that doesn’t match up (there may be other reasons as well, but I’m just going to expand on these few).

Let’s look at the first situation, when the kitten is already in the location of the player. In our path-finding routine in our Every Turn rule, we are already checking to make sure that course is a direction, which if it’s nothing, it won’t be. So let’s add a quick otherwise on that if.

if course is a direction:
 repeat with doorway running through visible doors:
   if the other side of doorway from the location of the kitten is room course from the location of the kitten:
     if doorway is open:
	try kitten going course;
     otherwise:
	say "You hear a scratching from the other side of the door.";
otherwise:
  if location of kitten is the location of the player:
    say "The kitten sits and looks up at you expectantly";

There we are simply checking locations and if they match, print a quick little message.

Now we’ll expand on that a bit with some criteria to keep the kitten out of certain rooms. Let’s say we have some kitten repellent that we’ve put in the Den. Add the following line somewhere in your code.

A room can be kitten-friendly.  A room is usually kitten-friendly.

This way we can make all rooms kitten friendly be default.

Then on the code defining the Den, let’s change it to the following to make it unfriendly to kittens.

The den is a room.  The den is not kitten-friendly.  The description of den is "The den contains a student desk with a simple wooden chair."  The den is west of the dining-room.

Then we will simply make that final otherwise in our every turn rule to read;

	otherwise:
		if location of kitten is the location of the player:
			say "The kitten sits and looks up at you expectantly";
		else:
			say "The kitten tried to enter [the location], but thought better of it."

Now we have this basis for pathfinding for an NPC, that can be expanded on greatly. There are also a few extensions you can get that encapsulates some of the more complex stuff for you, but for simple situations this is really pretty easy to put together.

Pathfinding can be used in many other situations, not just with directional relations between rooms. For example, it could be used in conversational models. I believe Glass by Emily Short is a good example of someone doing this.  I’ll be exploring some other usages that perhaps I’ll write about in the future.

I’d be interested in hearing about or seeing code for any creative usages of the built-in pathfinding functionality.

EDIT (12/22/2013):  Found a small bug in the above code that I detail out in another post.