sasikalar / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

LogicBrick behaviour is not working properly #191

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I created a test-case and the property names itself says what should be 
expected (and what result BGE would give)

I also started to fix the problems. Let's summarize:

1) IDLE-Mode didn't work properly. It would be expected that only 
impulse-changes are fired to the controller. Which would have the result that 
e.g. a property-actuator is only executed when the sensors state changed. 
Actually there seems to be two kinds of actuators. One that are only fired when 
there is an impulse right now (like MessageAct,PropertyAct,...) and one that is 
activated by an impulse and deactivated by a negative impulse (like MotionAct 
or SoundAct)

In code there is one list that holds all active actuators (m_ain in 
gkLogicManager). Once all actuators got processed every actuator that got 
BM_OFF is removed from the active list. In order to delete them I let all that 
'oneshot' Actuator set themselfs BM_OFF after processing. They'll get active 
with a new impulse. That seems to fix the problem

2) If an actuator is connected to two or more controllers, the last 
controller's pulse is taking in account only. e.g. you have one sensor that 
gives a positive puls to controller A, and one sensor with a negative pulse to 
controller B and both are connected to Actuator C would result that actuator C 
is not executed.

I fixed this by creating a list that starts clear every frame. If a controller 
is processed I push every coressponding actuator in that list and set the pulse 
state to the controllers pulse-state if the actuator was not in the list 
already.
If it would be in the list I only set the state of the actuator if the state is 
positive.

3)Nand / Nor
Nand and nor only fired for positive pulse-states but actually both states has 
to be processed. At least I got the behaviour of BGE but this isn't tested that 
well cause I didn't had that good ideas for use-cases.

XOR might have the same problem, but for that I have absolutely no use-case. 
Maybe someone else can help here out!?

4)Frequency actually didn't work at all. Just as a delay-timer at the 
beginning. The fixes befor also fixed that problem. Additionally I prevent 
frequency from qorking for IDLE-Mode (as it is in the BGE as well)

5)Invert-Problem in Sensors
Some combinations that should have been dispatched wasn't because some 
invert-cases weren't taken in account.

Actually that's it. Some comments and tests would be very appreciated.

Original issue reported on code.google.com by thomas.t...@googlemail.com on 18 Oct 2011 at 2:03

Attachments:

GoogleCodeExporter commented 9 years ago
The patch was applied to trunk.
Thanks a lot.

Original comment by harkon...@gmail.com on 22 Oct 2011 at 12:51