A Better Silverlight Game Loop?

I've had a problem with my timers in my games.  Basically the problem is that when the loop happens too quickly I get a loop that has 0 ticks elapsed.  I am of the belief that there is an issue with resolution from the DateTime.Now which I use to tell how much time has elapsed between a game frame.  You can read more about the problem in this thread on the Silverlight site (I'm pretty innarticulate in it).  The higher the frame rate, the stranger my games appeared to behave and the more occurances of bugs (divide by zero, etc...).  This was less of a problem in Silverlight 2 because it had a limited frame rate at 60 frames.  In Silverlight 3, framerates can go much higher.

In my "Game Engine" I use different loop classes that were originally derived from the Silverlight Games 101 blog.  I've made some modifications from that original code and they all (DispatcherTimer, StoryBoardTimer and CompositionTarget) inherit from the base GameLoop class.

In order to fix my problem, I added a queue that keeps track of the last ten times and returns and average time elapsed.  The result has been very positive as I have not experienced a lot of the errors I used to have, and the games appear to be smoother. More...

Vector Space: Armada

The world's greatest game!  Ok, maybe not, but I played it a lot.  VS:A is the sequel to VS:0.  In this game there are six levels of play, and each one is pretty radically different.  This is because each level allows for a lot of scripting due to some flexibility in the design.  It also allows for folks to create their own levels too... though as of this date nobody has taken up the challenge.  Now bug free!!! (Or at least there are much less).

...My favorite level is the fifth, Last Defense.

Tower of Babble

Tower of Babble is a very challenging word game that you can play on facebook.  I made this with the help of the .NET Facebook API.  All in all that might have been a mistake, as the facebook Javascript api or just using their rest services was probably better suited for Silverlight.  The game is very playable, but is a bit unifinished.  I was hoping to sell it, but there aren't any takers.

Play Tower of Babble

Copyright © 2010 DDtMM

Powered by BlogEngine.NET 1.5.0.7