Monster's ready-to-use components - Door Control

Hello Blenderheads!

You want to create a game? You to add doors to your game? You do not know how to connect door wings with door openers?
Here is the ready-to-use solution for you:

Monster’s Door Control

What can Door Control do for you?

You do the artistic part:

  • create one or more openers (or closers). You add some minor logic to trigger the door open and close operations.
  • create one or more door wings. You add some minor logic to perform the animation according to your needs (yes, you are the one who knows how the door wings should be animated ;)).

You connect the parts with the Door Control … done.

The Door Control distributes the door requests from the openers to the wings. You can have as many openers, closers and door wings as you like. But one door control for each single door.

Check this video guide to see how easy this is:

The interface

A door wing needs a string property named “door request”.
It should react on these values:

  • open - which is set when the door should open
  • close - which is set when the door should close

A door opener/closer should trigger a Python controller with on of these BGE entry points:

  • door.requestOpen - to trigger a door open (all sensors should be positive)
  • door.requestClose - to trigger a door close (all sensors should be positive)

The roots (top parent) of the door wings, door openers should be parented to an instance of Door Control. Door Control will distribute the requests from the openers to the parented door wings.

The files

(written in 2.68a)

The component:
MonstersDoorControl.blend (2.74)
MonstersDoorControl.blend (90 KB) (obsolete)
The models from the video:
SwingDoorStarterSet.blend (218 KB)

I hope you like it

Monster

Planned versions:

version 1.1: with documentation strings
version 1.2: allowing linkable doors with additional openers - with video tutorial
version 1.3: safety sensor to prevent closing if blocked - with video tutorial
version 1.4: status feedback (e.g. for elevator lights) - with video tutorial
version 1.5: toggle door (open and close by the same signal) - with video tutorial

Further Ideas:

  • door modelling contest
  • door controller programming contest

I hope you like it

Monster

And I do like it :smiley:

Very nice.

I think I need to explain some of the design decisions.
The logic has several layers of abstraction. There is Animation, Animation logic and Controlling logic (and maybe more).

Animation logic
The animation logic defines how to play the open and close animation.

The gate in the example is pretty simple, it swings open and the same way back to close. This works in most of the cases.

But think about a more complex door with several parts animating one after the other or even parallel. This requires different logic for each different animation method. This happens as well when the close animation is different to the open animation (non-symetric animation). Additional a door open might get different animation with each open/close (like getting more dirty, or broken).

The animation logic depends on the animation. So the artists designing this animation knows the best how to achieve that. The current design of the DoorControl keeps pretty much freedom how to design the animation logic.

Controlling logic
The controlling logic (door control) defines when the door should open and close. It does not matter how the door is animated or even how long it lasts, or if it is the same animation all the time.

The component Door Control prevents the artist from reinventing this controlling logic all the time again and again. In a typical game there is a very limited number of different door controls. This supports a consistent feeling towards the player.

By placing this logic into a group it encapsulates the implementation details from the door designer and makes the game creation much simpler for the level designer. As additional benefit it is pretty easy to receive updates to the component from the door control developer.

Future
The current Door Control is pretty simple. It can open and close. That is all. In future versions you might be able to toggle open/close, lock and unlock the door etc… You will still be able to use the methods mentioned above.

Coming back to this question:

Yes, I thought about it. It is possible to create a component that combines door control logic and animation logic. The artist just adds its own model and animation without a need to care the animation logic. Which is less work.

If you think about it, you will see this is more restrictive than the method mentioned above. E.g. the animation logic includes the start and end frame so the component requires that the animation starts at frame 1 and ends with frame 11 all the time.

While this limits the freedom of the artists choices it is a valid interface between animators, game level designers and game flow designers (The duration of an open animation has impact on the motion/timing of a character).

This limitation depends on the specific game while door control is more generic. Therefore I did the design decision to let the animation logic be implemented by the artists (but providing an example in the video).

I hope you get the idea

Monster

using a sequence is always nice, and motions, this makes the door or ??? move along a path using a property :smiley:

Do you ever use logic sequencers monster?

How Cool is this.
Great job.

update: