David's Blog

Mostly Hobby Stuff

MessageHub and Logic Nodes

leave a comment »

Today I spent time enhancing the logic system. The test problem I had was this: The player has to push a block(rigid body) across a bridge in order to create a step to climb onto a platform. The problem with this is that it is possible for the player to push the blocks off the bride into the void below. Once the player has pushed all the blocks off the bridge they should be informed that they have failed and be respawned at the last resurrection point.

The features I added to support this:

  • Rigid body state saving/restoration on resurrection(or when instructed to do so by a logic node).
  • Support for generating trigger events when a rigid body enters a trigger.
  • A counter logic node to count the number of blocks pushed off the bridge and trigger an event when they have all been pushed off.
  • A “Set” node which given a list of objects in the editor can determine if the object generating an event belongs to the set.
  • A way to cause the players death/mission failure.

The need to trigger a mission failure and selective state restoration caused me to add a global message bus, i.e. a central class which receives events and dispatches them to listeners. I guess there are downside to allowing global messages, however it is kind of bound to the problem, i.e. the events by there nature have global influence so it seems to be the cleanest way of doing it. Centralizing this in one place will allow me to, for example queue and synchronize the messages in future if needed.

feb11

Advertisements

Written by therealdblack

April 10, 2010 at 5:09 pm

Posted in Uncategorized

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: