Forum C# The main AddTimer sometimes does not fire

The main AddTimer sometimes does not fire

Postby robscherer123 » June 17th, 2013, 3:59 pm

I've come across the cause to a long time problem I've been having. My game is a side-scrolling RPG where monsters spawn in areas and always drop items after being killed. Since players began playing my game they've reported that on rare occasions enemies are not dropping items and are not spawning after they are all killed. After being completely stumbled as to what was the problem, I put in a "report bug" feature that players could click when they are experiencing the problem. It then reports a handful of important client and server variables back to me to help me diagnose the problem. This was the perfect solution to the problem.

In my variables I have found out that my main "counter" variable which is incremented in the main game loop is remaining at 0, which means the main AddTimer is not functioning at all when a new room is created. Again, this only happens on rare occasions, but it happens enough that it is a normal re-occuring problem.

I use the built-in timer thing that the PlayerIO examples show to use.

Whenever this problem happens, the GotMessage function on the server still works, but the gameLoop() is not working at all. Any help would be appreciated.


Code: Select all
// This is how you setup a timer
AddTimer(delegate{
       // code here will code every 100th millisecond (ten times a second)
        gameLoop();
       }, 31);
robscherer123
Paid Member
 
Posts: 313
Joined: December 12th, 2012, 8:46 pm

Return to C#