They run a thousand bytecode instructions (I think) before checking for autoyield (and so on) - so they should be quite fast. That is the only difference in speed compared to a normal game running just the vsync.
Modern cpus in phones are really fast anyhow so they should be fast enough - it really depends on the game.
I'm trying to rig my code in Dungeons so that the coroutine is use for the monster sprite 'brains', I'll then yield manually if running too fast - or process the brains continuously if running too slow.
The next version of Gideros has an extension I requested so that it makes doing this quite easy.
Use framecounter to slow down your game code to the frame - eg something like this
function game()whiletruedolocal currentFrame=Core.frameStatistics().frameCounter
repeatdo game code here...
until currentFrame==Core.frameStatistics().frameCounter
Core.yield(true)-- wait if going too fastendend
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Comments
Modern cpus in phones are really fast anyhow so they should be fast enough - it really depends on the game.
I'm trying to rig my code in Dungeons so that the coroutine is use for the monster sprite 'brains', I'll then yield manually if running too fast - or process the brains continuously if running too slow.
The next version of Gideros has an extension I requested so that it makes doing this quite easy.
Use framecounter to slow down your game code to the frame - eg something like this
https://deluxepixel.com
Likes: antix
https://deluxepixel.com
http://giderosmobile.com/forum/discussion/comment/48685#Comment_48685
So it should be practical to use coroutines extensively.
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
Likes: SinisterSoft, john26