[Bf-committers] Init Delay for BGE Sensors, ideas and support pls

Benoit Bolsee benoit.bolsee at online.be
Sat Jul 26 13:15:38 CEST 2008


Hi,

Adding a delay option to the always sensor is an interesting feature but
not strictly needed. You can achieve the sequencial result that you're
looking for in various way:
1) use sequential states to activate scripts in sequence: each script
will set the state to the next in the sequence. 
2) use a timer property and several property sensors set on increasing
values of the timer property: they will trigger the controllers
sequentially at well specified moments. 
3) use a global counter in GameLogic: the first script checks that the
counter is 0 et set it to 1 after executing, the second script checks
that the counter is 1 before executing and set it to 2, etc. For this to
work you will need a single always sensor in pulse mode that triggers
all the controllers.
4) if you have multiple scripts that must run in sequence, why not
having one large script that will do the all the work in sequence.

/benoit

-----Original Message-----
Date: Fri, 25 Jul 2008 19:09:45 -0700
From: "Dalai Felinto" <dfelinto at gmail.com>
Subject: [Bf-committers] Init Delay for BGE Sensors, ideas and support
	pls
To: "bf-blender developers" <bf-committers at blender.org>
Cc: Mike Pan <madonions at gmail.com>
Message-ID:
	<b8ebc13a0807251909y57f5abbdp251776268fa895ef at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi.

We are using different sensors from different objects to initialize and
run some Python scripts in BGE. Sometimes we need a specific script
initialization order, and we are having some troubles with the way
Blender handle it.

One idea we have so far was to implement an option in the Always Sensor
to delay the beginning of the scripts in a specific number of pulses.

Today I start coding it, and so far I have the GUI working, and I'm able
to save/read Blender files with the settings of the Always Sensor. So
far I can skip the first pulse for the AlwaysSensor, and make it runs
only after the next trigger pulse.

Beside that I realize that I can implement a counter system in the
SCA_AlwaysEventManager.cpp to create a delay system for all individual
Sensors.

So I have three questions:

1) It is better to have a generic init delay system for all Sensors or
it is useful only for the Always Sensor?

2) I'm not sure how can I delay it only for the AlwaysSensor. Apparently
I can't configure it only changing the SCA_AlwaysSensor.cpp.
    Initially I can think in two ways:
      a) code the AlwaysEventManager to check if the event is Always and
if it is try to delay it.
      b) add an option in SCA_EventManager.cpp to receive as an input
(int or short) in some of its methods and use it to add the initial
delay to the frames.

3) I'm not sure how the EventManager works. Does anyone have any
tips/suggestions/comments to help me in this matter, please ...



The patch so far to implement the GUI option for the AlwaysSensor
http://pasteall.org/1722/cpp . The patch so far to implement the GUI for
the Always Sensor + a general delay for all sensors (the delay came from
a inpu in the console) - http://pasteall.org/1723/cpp


Thanks for your time and assistance.

Best regards,
Dalai Felinto




More information about the Bf-committers mailing list