Big Bucket Software you like to use
Manipulation Strategies
October 30th, 2005

On my quest to move all game logic into the .config file, (and out of C++) I just migrated the ManipulationStrategy stuff into config.

So, what’s a manipulation strategy. Well… the condition that must be satisfied before an Item may be manipulated is defined by a ManipulationStrategy. There are currently two types:

  • Range
  • Rectangle

A RangeManipulationStrategy is used to ensure that the range (in pixels) between the Actor and the Item (Manipulator/Manipulatee) is tolerable. The RectangleManipulationStrategy is used to ensure that the Actor is standing inside a Rectangle. For example:

0:
{
    name  : "standing_nearby"
    range : 80
}

Is a RangeManipulationStrategy. To attach this to an Item…

3:
{
    name                  : "model.tissues"
    item_type             : "once"
    manipulation_strategy : "standing_nearby"
    visible               : 1
    enabled               : 1
    geometry              :
    {
        top_left : { x:69 y:163 }
        width    : 13
        height   : 8
    }
}

The advantage of the RectangleManipulationStrategy over the RangeManipulationStrategy is that sometimes, it’s not as simple as specifying ‘how many pixels’ may be between the Actor and the Item.

manipulation_strategy.pngThe lampshade on top of the bedside table is an example of where a RectangleManipulationStrategy is useful. In the screenshot, the green rectangle is the bounds of the ItemModel, and the yellow rectangle is where the Actor must be standing in order to manipulate the item. This technique is ‘better’ than calculating a range, because the range is measured from the foot of the actor, to the top-left corner of the ItemModel and so doesn’t make much sense in this instance.