How to Contol BGE "Clock Cycle" or "time based" management?


Firstly, my English is not that good. Quite hard for me to express myself/ides/question…

Q1: Does anyone can advice me on how to control Blender Clockcycle in BGE?
Q2: How to do time-based action for AI?

A massive numbers of object with AI/animated will reduce framerates. Using clock cycle, the AI can be categorize with high response AI, medium AI, low AI - (by using assigned priority on the AI). All process of AI will be completed before accepting user interaction/response/swapbuffer.


With clock cycle I think you mean the game loop?
There is no way and you shouldn’t do. All logic is already part of the game loop. If you slow down the logic, you slow down the game loop.

You could put your AI logic in a separate thread. That should be quite fine as long as the access to any game logic is reduced to a minimum. That means this can run parallel to the game loop. Be aware that threads bring in their own problems ;).

Anyway, you should always separate logic from animation. Animation is well integrated with the actuators already.
The logic can control the actuators parameters, but should not perform animation as long as an actuator can do it.

If you have an AI Python controller running with every frame, you should ask yourself if it is really necessary. Even if it seems to do nothing it eats time.

I hope it helps somehow.