Thanks for this very interesting answer Claudio !

One again your help is precious ! 

If really happens only on startup, an easy but not robust way can be to 
> schedule the update of problematic actors only after a small amount of time 
> after the on_onter.
> You can use an action Delay(e) + CallFunc(schedule_the_update) to this 
> end. 
>

It only happens on startup, so I could probably do this, but a friend of 
mine tested the program, and the problem was even worse on his computer. I 
have no sure way to choose a delay time, and I don't like this kind of 
hack, but I'll use it if I don't find a better solution.

 

> Profiling the code proved it was pyglet's clock.py unschedule function 
>> that took 1.52sec running, but I don't really know what this means...
>>
>>
> Suspicious, but needs investigation about why so much.
>

Since I installed pyglet 1.2alpha1, I have the source for pyglet, I might 
try to investigate a bit more, but as you already realized, i'm not an 
advanced python user, and it might prove to hard for me.
I don't understand what cocos could unschedule, so it could be interesting 
to have a look anyway.
 

>  A common workaround to deal with infrequent big dt's is to intercept the 
> clock and :
>

> if dt > dt_thershold:
>     dt = dt_safe
>
> where dt_safe depends on the app.
>
> For consistency is better if the general app clock can be cheated; for 
> pyglet in the general case that is not so straightforward.
>
> But in some situations it suffices to do this dt cropping in the 
> individual update(self, dt) for a handful of problematic entities.
>
> Do you think it can work in your use case ?
>

I guess I'll use this solution for now, it should work ok. Or maybe I'll 
schedule character.update() only after 5 layer updates, since the dt values 
are always normal after 5 loops.
I don't understand why there is such a slowdown, though. This character 
sprite is created after everything else. I should have been more careful 
when it appeared, I don't remember which code commit introduced this lag. 
Maybe I should go back in modifications to see what caused it.

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/cocos-discuss/-/_MoXCrLAMXMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en.

Reply via email to