Javascript timers
        Posted  
        
            by resopollution
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by resopollution
        
        
        
        Published on 2010-05-06T07:08:08Z
        Indexed on 
            2010/05/06
            7:28 UTC
        
        
        Read the original article
        Hit count: 455
        
I'm starting on a javascript MMORPG that will actually work smoothly. Currently, I created a demo to prove that I can move characters around and have them chat with each other, as well as see eachother move around live.
Now Javascript timers are something I have not used extensively, but from what I know, correct me if I'm wrong, is that having multiple setIntervals happening at the same time doesn't really work well b/c it's all on a single thread.
Lets say I wanted to have 10 different people nuking fireballs at a monster by using sprite background positioning with setInterval -- that animation would require 10 setIntervals doing repainting of the DOM for sprite background-position shifts. Wouldn't that be a big buggy?
I was wondering if there was a way around all this, perhaps using Canvas, so that animations can all happen concurrently without creating an event queue and I don't have to worry about timers.
Hope that makes sense, and please let me know if I need to clarify further.
© Stack Overflow or respective owner