Forum C# addTimers are consitently not working! Need hep!

addTimers are consitently not working! Need hep!

Postby robscherer123 » June 24th, 2013, 4:25 am

I've posted this before and received no help and now it is becoming a major issue. Every room I created my game loop is not firing at all. This is the addTimer function that I create at the top of the server code as shown in the playerIO examples. Suddenly every room is not working and players cannot even play the game correctly. I've had to refund a few players money because they are fed up with it. Is there something wrong with the PlayerIO service, what is going on?? When I run it on the test server it works great, but when I upload it still does not work. I did not change ANYTHING, I wasn't even at work on my computer today/ Some help would be appreciated..
robscherer123
Paid Member
 
Posts: 307
Joined: December 12th, 2012, 8:46 pm

Re: addTimers are consitently not working! Need hep!

Postby robscherer123 » June 24th, 2013, 5:29 am

...Well all of a sudden my game is working. After rushing like heck in the middle of the night to try and fix this, I've found that the AddTimer function was rendered useless. I made it so I could manually call it myself, and every time I did the AddTimer was not firing at all. I tried calling it literally a hundred times and it would not work. It rendered my whole game un-playable for about 3 hours... It ramdomly stopped working for hours and is now working, randomly. What's the deal? I changed nothing at all whatsoever.

Is there any word on what the heck was/is going wrong? Is there at least some kind of alternative timer that doesn't rely on that piece of junk AddTimer to work? I'm having the AddTimer fail way too often and it's really making players mad and lowering my overall ratings for the game, not to mention making my game almost un-playable without a game-loop running on the server. Could I somehow use a while loop or something of the sort to call my game loop?
robscherer123
Paid Member
 
Posts: 307
Joined: December 12th, 2012, 8:46 pm

Re: addTimers are consitently not working! Need hep!

Postby jbrettob » June 25th, 2013, 3:18 pm

Hi there,


Well that's odd, I haven't got this problem before...
Refer to this topic: http://playerio.com/forum/post46413

This is the way I'm currently using it and I haven't logged if it's actually working without the problem you have:

Code: Select all
private const int _TICK_COUNT = 50;

public override void GameStarted()
{
   AddTimer(onTick, _TICK_COUNT);
}

private void onTick()
{
   // insert here my gameloop
}



Thinking out of the box, perhaps the error is not within the AddTimer, but somewhere in the gameloop() itself?
Game Designer & Developer | Flash | AS3 | Unity3D | C#
w: jbrettob.com | blog: blog.jbrettob.com | @jbrettob
User avatar
jbrettob
 
Posts: 19
Joined: April 9th, 2012, 3:51 pm
Location: The Netherlands, Europe

Re: addTimers are consitently not working! Need hep!

Postby robscherer123 » June 25th, 2013, 3:29 pm

Yea, it's very odd. lol that topic was also posted by me. =P

The way you have it set up is just how I do. Exactly like this.

Code: Select all
bool hasGameLoop = false;
AddTimer(delegate{
     hasGameLoop = true;
     gameLoop();
}, 31);



Whenever it is broken, hasGameLoop will consistently report false, no matter when I trace it. Luckily every room on my entire server hasn't went into "broken mode" like it did when I first posted this, but the problem still happens fairly consistently. I don't believe the problem is with my game loop, and if it is I would think "hasGameLoop" should at least be getting set to true. There are no errors in my error log from this whenever this happens either.

I tried using a normal C# Timer but whenever I do I get some error warning about I can't use it because the PlayerIO package is already using it with the AddTimer.
robscherer123
Paid Member
 
Posts: 307
Joined: December 12th, 2012, 8:46 pm

Re: addTimers are consitently not working! Need hep!

Postby SmallJoker » August 1st, 2013, 4:49 pm

try to see the boolean to true in your loop function and not in the delegate(), for this you need to make the boolean public.
SmallJoker
 
Posts: 50
Joined: March 28th, 2012, 12:22 pm

Re: addTimers are consitently not working! Need hep!

Postby robscherer123 » October 2nd, 2013, 4:59 pm

I just thought I'd report in here. This used to be a very frequent problem. I'm not sure if PlayerIO changed anything, but I rarely EVER see this problem anymore at all. So if anybody changed anything, thanks! It's been fixed!
robscherer123
Paid Member
 
Posts: 307
Joined: December 12th, 2012, 8:46 pm


Return to C#



cron