Getting the Required FPS in Silverlight
One the first code for any game will be setup a game loop. Here are some of the posts on how to achieve this in Silverlight applications:
Creating a Game Loop - Silverlight Games 101
Tip of the Day #5: Timers and the Main Game Loop - Mike Snows Silverlight Blog
Silverlight-Speed Loop
Creating a Game Loop - Silverlight Games 101
Tip of the Day #5: Timers and the Main Game Loop - Mike Snows Silverlight Blog
Silverlight-Speed Loop
You can see that there are two ways, one using the DispatchTimer and one using Storyboard. However I found that "The DispatcherTimer is a lower resolution timer than the timer behind the Storyboard class, which causes loss in fidelity. Additionally, the Storyboard execution is more stable across the different supported OSs and Browsers. I'll put together a sample to show the comparision." as stated in post Procedural Animation in Silverlight 2 | Adam Kinney, Continuum Explorer
So for my game I started using the empty storyboard method. But then I noticed that I getting only 60-62 FPS (frames per second) even when doing zero computations. This was causing some edge conditions manifest in collision detection like the objects passing through each other. One way to get rid of these was to increase the number of steps by increasing the FPS which I found can be by setting the EnableFrameRateCounter property to 120 in my case.
More Silverlight performance tips here.
More Silverlight performance tips here.
Comments