0
$\begingroup$

I have 2 scenes, both with logic. I am trying to convert all my logic as certain logic bricks cause small delays. I noticed that if I use python scripts instead, I will end up still sending messages which will lead into small delays. Is it possible to have 1 python script in one scene that does funtions for 2 objects in 2 different scenes? In other words, I won't have to be sending messages between scenes to remove the delay. If so, how would I identify an object from a separate scene? Thanks.

$\endgroup$
3
  • $\begingroup$ IDK about different scenes, but it seems like sending a message should be pretty fast. Have you tried making the messaging faster? $\endgroup$
    – Matt
    Commented Nov 12, 2015 at 1:44
  • $\begingroup$ @Matt and how would I do that? $\endgroup$
    – blackhole
    Commented Nov 12, 2015 at 1:53
  • $\begingroup$ It depends on a whole raft of things. Probably the most important is the payload. How are you sending the message, and what are you sending? $\endgroup$
    – Matt
    Commented Nov 12, 2015 at 2:06

1 Answer 1

1
$\begingroup$

Can you use 1 python script for multiple GE scenes?

Yes, you can.

This has nothing to do with messages, or delays. Python is executed by a Python controller. A Python controller gets executed (as each other controller) either once or never within a single logic frame.

Messages

Messages will be transferred after the logic bricks are executed but before the next frame starts. From perspective of logic - between the frames.

That is the reason why it takes exactly one frame between sending and receiving a message.

Effect:

  • When you perform operations while sending a message and operations when receiving this message ... you will notify a one frame delay.
  • If you do not want that, you should ensure all operations (except sending the message) react on the same event -> e.g receiving the message.

... how would I identify an object from a separate scene?

You can grab the scene and read the objects it has.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .