hello.
i found often the necessity of some tick as reference .
TICK:
it cam be done internally to the object itself (each frame >> tick += 1)
but is not necessarly(can just by chance) “synced” with other object.
plus , is better one tick rather than 200 (performances)
i discovered this lack often, lastly is to make message : how know if a message is old?(it can be 1 hour old or very new)
the messages(since is a list or dict that can become giant) should be cleaned each frame the messages old.
so the message can work in this way:
def sendMessage(self,ms,obTo):
messages = obTo.messages
tick = bge.tick
if not tick in messages:
messages[tick] = []
messages[tick].append((ms, self)) #or Message(ms,self)
for k in [k for k in messages if k!=tick]:
messages.pop(k)
(just a idea, maybe can be done from the object reader, or some other ways, but is doable if you have a “tick solid”)
the bge.tick cannot run on some dummy with “always true”, it must be done out of SCA (or before or after) out of range for a game object , otherwise is not “solid” (can be a wrong reference)
[curiosity : a int that each frame increase can become 36288000 … after ONE WEEK !!! i guess not should be a problem if is “infinite” , right?]
this should be as default(that not require custom code… i guess to a class read-only), strange that not there already… (or there somewhere?)
CALLBACKS:
then, what about add some list of calls (not know if callbacks is the correct name) excactly as scene.pre_draw.
with the difference thar run OVER the scene , so, it is ever a reference in each scene,ex:
bge.callBacks.append(func)
what you tink?