ok I’ve noticed that if I make a video in the timeline and set the frames per second to lets say … 20 per second…
a movieclip with 20 frames will take 2 seconds to play on a slow computer and will skip frames… however lets say I place a stop code on the first frame of that clip and place a code which says “on enter frame go to and play next frame” the clip will then take significantly longer on a slow computer because it does not skip frames such as when I put them on a timeline.
I found this a HUGE problem when I made a racing game. On my speedy laptop I finished the race in no time, on my slow computer on the other hand the race took FOREVER. “on enter frame car movs X amount faster” now if 1 frame takes forever to render the computer waits for it to finish then next frame it begins to move again.
I want to make online multiplayer flash games however if the onEnterFrame function is such a significant problem then how will I get around it? is there a way to change this so it skips frames accordingly much like when I place something to run through the stage as opposed to with actionscript and onEnterFrame.
You need to learn how to optimise your animation and game engine so that it’s not overloading typical computers. Whether it’s through using cacheasbitmap or other bitmap rendering techniques that avoid vector redraws, better maths, reducing stage quality, or using less cpu intensive effects such as masking/filters where necessary. In games where performance has been an issue, I’ve implemented FPS monitoring which dynamically switches off features to maintain rate on slower pc’s.
This doesn’t help much because even if it is optimized so long a it not running at the “MAXIMUM” frames per second then during a multilayer game it will always be unequal. if One is going at 40 FPS and the other at 38 then it will throw off the entire game. This isn’t a big deal to the eye for for multilayer it is.
With a multiplayer game you send and receive periodic game data, so whether a player is running at 38 or 40 fps is irrelevant - at the moment in time they receive the data from the server the positions are updated. If there’s something within the game that is relevant to a timeline frame (I’d avoid this and use purely programmatic animation myself in this situation) then on the server pulse you can compensate for any discrepancy. There are also the considerations of latency compensation, and predictive calculations of data between updates but these are topics outwith the discussion around framerate.