Python vs. logic

Hi,

Yes, I know this is a problem that is often talked about, but I still have a question. In some of the levels of my game, I have 6 doors that are open by puting crates on 2 buttons for each door. For the moment I have a script that is run by each door and that tests if it should be open or not. Those scripts are liked to “always” sensors, so they are run each frame.

I was wondering if it would be better to like each doors to the corresponding buttons using only logic.

I’ve seen in another thread that linking logic blocks of different objects should be avoided. But the python solution doesn’t seem good. Maybe it would be better to have one script that deal with all the doors in one run.

I need to clean a little my .blend file then I’ll post it.

Thanks.

you shouldn’t have more scripts connected to always sensors than necessary. They are being run every frame. Could you connect it to an collision sensor instead of always?

Logic bricks should work too. Or one giant script.

How much impact on performance would logic between object cause?

Ahh… the age long question: Python vs Logic

How much impact on performance would logic between object cause?
It depends on the logic you use. Some logic bricks like the radar sensor and touch sensor, are very slow. From the most part, however, logic would be faster. Most likely, though, you won’t see much of a difference especially if your code isn’t very long. Another downside the Logic Bricks is that their messy.

In the end, it’s really up to you. Python and/or logic bricks wouldn’t make much of a difference in this situation.

I know that using an always sensor is a bad idea, espacialy when the script runing do nothing most of the time. I wanted to connect an “And actuator” of the door to property actuators of the buttons, but I’ve seen a post saying that you should not connect logic blocks from different objects (I cannot find it again).

I’ll try with the logic and the general script and see if it change anything. But as C-106 is saying, it shouldn’t do a use difference since the script run each frame for each door is less than 10 lines and don’t have very complex calculus.

Thanks for the answer guys.

And you could always stick an if statement in there to compartmentalise design