Defold Timer - The native timer extension


#41

I just tried adding the timer as a dependency and it works for me :confused:

Do you use any other extension? Could it be some trouble with that one?


#42

I do not know. The original timer is saved, but the phone does not work. Project Exploere says that ext.manifest and timer.cpp can not be built.

So I used the timer module provided by britzl. I use it as a module and it works fine.


#43

I’ve updated the extension to support that timers can cancel other timers in their callback functions. This did previously cause crashes in the extension (a typical case of iterating an array and removing elements at random).


#44

I’ve tried to build your cool extension for windows and got an error: < sys/time.h > not found.


#45

Btw, I noticed that NE’s Update function is called three times more often that GameObject’s one. Why?


#46

Do you have fixed Delta Time setup in your game.project?


#47

display.variable_dt = 1
I’ve tried to uncheck this flag and nothing changed.


#48

Are you by any chance starting the engine on the device as a debug target? That “connection app” doesn’t share the Lua context, so it’s started once per Lua context (3 of them in the engine)
Or if you have the project setting script.shared_state = false you get the same thing.


#49

Thank you! I’ve found, that the script.shared_state flag is false.


#50

How can I find out the context of the call?


#51

It’s the params->m_L (doc)


#52

Yes, but how can I understand, that this context is for scripts, and this one is for graphics?


#53

Good question.
I guess the easiest way is to check if the context contains either the go or render modules.


#54

I’ve updated the extension to support Windows as well. Please give it a try and let me know if it’s working as expected.


#55

Yes, it’s working!


#56

Tried to build HTML5 version with timer but failed. Is there a way to use this extension with HTML5?


#57

Oh, it doesn’t work on HTML5?! I took a look at the output and found that apparently I was missing an include (stdlib.h). I’ve added this and pushed a new version of the extension. Thanks for pointing this out!


#58

Now everything seems fine. Thanks a lot!


#59

Can’t build Android app:

macOS also:

Linux also, but Linux is not supported, right? Or not?


#60

That’s not the timer extension issue, any extension fails with this error. That’s Defold’s bug in Editor 2. Use Editor 1 for now.