The Daily Click ::. Forums ::. Klik Coding Help ::. Timer-based Movements
 

Post Reply  Post Oekaki 
 

Posted By Message

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
6th July, 2013 at 06/07/2013 21:26:22 -

I've seen the option for "Timer-Based Movements" in the Frame properties, and it's checked by default. I'm just curious what it does?

 
Image

Tell 'em Babs is 'ere...

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
7th July, 2013 at 07/07/2013 02:33:18 -

Someone please correct me if I'm wrong about any of this. I highly recommend googling timer based movements for yourself just in case I am incorrect about any/all of this.

First and foremost: I believe that timer based movements only apply to movements that are built in to Multimedia Fusion. If you wish to use timer based movements with a custom engine you will have to set everything up yourself and code the game accordingly.

Timer based movements allow games to run at virtually the same "speed" on multiple systems that may not run the same game at the exact same speed due to a multitude of differences (hardware, software configurations etc.)

For example:

System 1 runs your game at 60 fps
1 frame updates approximately every 0.0167 seconds

System 2 runs your game at 30 fps
1 frame updates approximately every 0.034 seconds

This would result in the game running at HALF the speed on System 2, which means that while on System 1 an object that has moved 60 pixels to the right would have only moved 30 pixels on System 2.

Timer based movements exist to make sure that the person running the game on the slower system still plays the game at the same rate as the person on the faster system. Sure the framerate looks a little less smooth, but it will take the same amount of time for an object to move 60 pixels to the right on both systems. I've read that there is a way to smooth out this movement, but given my knowledge of Timer Based movements I would rather not even attempt to go into detail.

These movements work by measuring the amount of time passed between each frame (since framerate can fluctuate drastically) and adjusting the speed of the moving objects accordingly.

Lets say when our game runs at 60 fps our character moves at a rate of 6 pixels per frame when the player is giving input. If the frame rate drops to 50 fps the screen will only update 50 times per second, which would mean that the player will be moving a total of 300 pixels. Under perfect conditions (60fps) this would be 360 pixels moved in the same amount of time. A formula is used to adjust the players movement on-the-fly as the frame rate fluctuates.

See the chart below to see how the relation between framerate and an objects move rate. Assume the game is capped at 60 fps and that a moving object is moving at a rate of 6 Pixels per frame when the game is running at 60 fps.

P means Pixels

Framerate
60 fps - - - 50 fps - - - 40 fps - - - 30 fps - - - 20 fps - - - 10 fps
100% (6p) 120% (7.2p) 150% (9p) 200% (12p) 300% (18p) 600% (36p)
^Move Rate^








Edited by GamesterXIII

 
n/a

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
7th July, 2013 at 07/07/2013 10:43:10 -

Thanks for the response!

I figured I'd be something like that, I just tried testing my game on iOS and the character will speed up/slow down randomly. Sounds very confusing to me, but I'm trying to learn a bit about it. Thanks for your input!

 
Image

Tell 'em Babs is 'ere...

nivram



Registered
  20/07/2006
Points
  171
7th July, 2013 at 07/07/2013 15:28:11 -

To further add. This is from Francois:

A true alternative to "machine independent" option. The machine independent option works fine, but it does not have great latitude of working. It recovers application on machines slower by 25 -30% but above that, it begins to work badly.

Timer Based Movement calculates the number of pixels to move based on the time elapsed since the previous loop. So if your application runs slowly, or fast, the speed of the objects on the screen will be exactly the same. The tolerance is really high. Some games are playable from 10fps to 100fps.

The animations are also calculated based on the timer, so the animations will match the movements in timer based mode.

A check box in the frame properties allows you to turn on and off the feature. If "off", the application will behave just as up to now. If "on", the movements will be timer based. To preserve the compatibility with games made before this system was in place, the default setting for such games is off. You can very simply turn it on, by ticking the box. When you turn that on you must enter the next property (movement timer base) the running speed of your application. If it runs at 60hz, then enter 60. If you set this property correctly, there will be no difference in your game or application before and after turning this feature on.

If you create a new application, the property is set "On" by default. The movement timer base is also very powerful. It allows you to modify the speed of all objects of the frame at once. For example, if you created your application with a movement timer base of 50 and you turn it to 100, all your objects will move twice as fast.

The timer based movement will also be an invalueable feature for HWA games, as the speed of the application depends very much on the graphic card. On some machines, your application will run at 60fps (frames per second), and on others at 100fps. With the timer based movement, the application will have the same game play.

If you plan your application to run at various speeds, you must aviod using counters as timers, as the counters increment or decrement depends on the speed of the main loop, where as the movements depend on the timer. If there is too much of a difference between them, the events in the game will become out of sync. You should use the timer instead.

Some third party extensions my not be able to take advantage of this feature.

Marv

 
458 MMF2 & CTF 2.5 examples and games

http://www.castles-of-britain.com/mmf2examples.htm
   

Post Reply



 



Advertisement

Worth A Click