Mac lag and timing/sync problems

For all the help you need with Armagetron!
User avatar
apparition
Match Winner
Posts: 630
Joined: Sun Dec 03, 2006 9:59 am
Location: The Mitten, USA

Mac lag and timing/sync problems

Post by apparition »

0.2.8.3.1 has a lag issue that seems to be unique to newer Macbook Pro computers. Both regiT and I have the latest 15in MBP (he has the second latest) and they both have a very jittery, very skippy lag at the beginning of some rounds that smooths over after 5-15 seconds. This never happened on our old computers (regular Macbook and a Dell something or other). Any ideas what the problem is?
Last edited by apparition on Tue Jul 26, 2011 4:14 pm, edited 1 time in total.
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Re: Weird lag on new Macbook Pros

Post by dlh »

Just a guess, but could it be a malfunction with how Mac OS X determines whether to use the integrated or discrete GPU? You can use gfxCardStatus to manually make a choice.

Otherwise, a debug recording could help determine the problem.
scene
Core Dumper
Posts: 128
Joined: Fri Aug 14, 2009 4:58 am

Re: Weird lag on new Macbook Pros

Post by scene »

I actually have this same issue on my macbook
User avatar
apparition
Match Winner
Posts: 630
Joined: Sun Dec 03, 2006 9:59 am
Location: The Mitten, USA

Re: Weird lag on new Macbook Pros

Post by apparition »

Trying gfxCardStatus.

Something else I didn't mention is that when I'm spectating the glitchy twitchy yuck actually makes it unwatchable. If I'm not playing, it's terrible. It reminds me of the twitchiness of PREDICT_OBJECTS but exaggerated like crazy.

Still testing.
User avatar
apparition
Match Winner
Posts: 630
Joined: Sun Dec 03, 2006 9:59 am
Location: The Mitten, USA

Re: Weird lag on new Macbook Pros

Post by apparition »

Using Integrated (as opposed to Discrete) is terrible, but it isn't the problem. I suppose I'll have to learn how to do a debug recording...
User avatar
ppotter
Match Winner
Posts: 451
Joined: Sun Sep 28, 2008 12:45 am

Re: Weird lag on new Macbook Pros

Post by ppotter »

I think it's the same issue I posted about a while back (got no response :() Once the jittering stops the lag-o-meter's are huge?

Not sure what caused it, and it only stopped once I bought a new computer (though it's still a a mac)
scene
Core Dumper
Posts: 128
Joined: Fri Aug 14, 2009 4:58 am

Re: Weird lag on new Macbook Pros

Post by scene »

yeah actually a lot of times for me once it stops the lagometers return to normal. But this causes a lot of deaths for me at the grind during fort, forces me to brake in order to not dig too hard. I've noticed that typically button mashing a little bit and doing some rapid turns gets rid of it quicker, but that doesn't help for games that have a grind at the start :?

I noticed it on my old mac powerbook G4 as well
User avatar
noob_saibot
Round Winner
Posts: 237
Joined: Tue Apr 29, 2008 5:39 am

Re: Weird lag on new Macbook Pros

Post by noob_saibot »

I too have the same computer and problem. Sometimes after a few minutes it passes, but often comes back too.
WINNER OF: Ladle 47 .... preSsure's mom & Durka's mom

"If you're not part of the freaks, you're part of the boredom." -Perry Farrell
User avatar
Phytotron
Formerly Oscilloscope
Posts: 5042
Joined: Thu Jun 09, 2005 10:06 pm
Location: A site or situation, especially considered in regard to its surroundings.
Contact:

Re: Weird lag on new Macbook Pros

Post by Phytotron »

Hey, I'll throw in my centavos on this one too. It's actually a few separate things, in my case.

One is the odd, jumpy behaviour that looks like prediction is on. The difference in my case is that it can occur at any point in a round, can be intermittent or indefinite, and is often just one player doing it. Very strange.

Second, is the lag bomb followed by huge lagometers. There are also odd, seemingly random times when a player's lagometer will disappear completely.

Along with that, I've long experienced this phenomenon.

There's also the fact that every time a player enters or exits, I get a little lag bomb jump. Worse, any time a player explodes near me, little lag bomb jump. Any time a player grinds hard near me, lag bomb jump. I've described that as a sort of "stick and slip" long time ago, where the action seems to hang for a split-second then catch up where it would have been had it not paused.

And I always notice a player's ping jumps just after he's been killed, mine included.

All kinds of oddities, and I've no clue which or to what degree any are abnormal. Or relevant to this topic, for that matter. But hey, there's some hay.

And I'm using an eMac. Also, all of the above occur in servers where myself and other players have low pings.
User avatar
apparition
Match Winner
Posts: 630
Joined: Sun Dec 03, 2006 9:59 am
Location: The Mitten, USA

Re: Weird lag on new Macbook Pros

Post by apparition »

Here is the debug recording. Please take a look. It only happens for like 2 seconds once the round I play in starts, but you get the idea. I don't know about the lag-o-meters since I have them turned off and didn't see potter's comment until after I made it. Thanks!
Attachments
MBP Bug.rec.zip
MBP Jittery Bug
(457.97 KiB) Downloaded 152 times
User avatar
dlh
Formerly That OS X Guy
Posts: 2035
Joined: Fri Jan 02, 2004 12:05 am
Contact:

Re: Weird lag on new Macbook Pros

Post by dlh »

Your recording plays back fine, and the issue you describe is apparent. I've never experienced lag like that on my Mac, which has a Nvidia graphics card.

You said this only happens on your new computer, which has an AMD graphics card. For everyone experiencing this problem, do you all have ATI (AMD) graphic cards?
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: Weird lag on new Macbook Pros

Post by Z-Man »

apparition wrote:Here is the debug recording. Please take a look.
Done. The problem there is that during the round countdown, about half of the timer sync messages arrive extremely delayed, making your local timer be around 150ms late because the system relies on the average delay of timer messages to be about half your ping. For you, some messages are over 300ms underway, which is a lot for a ping of 50ms. Timer fluctuations anywhere between - and + your ping are usually no big problem, but here, it's three times your ping, hence the jumpiness. I'll see what happens if I give obviously (hah, not so easy, see rant later) delayed packets a lower weight in the average, packages coming unusually early is not something I expect to happen.
In the meantime, try enabling VSync. Your FPS rises to exuberant numbers between rounds, maybe that has some negative effects on the networking system. And try to play wired.
Also, the framerate is somewhat unstable around the beginning, hinting at problems with sync between GPU and CPU (worst is a jump of around 300 ms at T=68). Set the Swap Mode in Performance Tweaks to Finish to fix it, and do tell if that helps or not. The Flush setting is the default for your configuration and we need to change it if it's the wrong thing to do.

Phytotron: the ping update after death/kills is due to the player data being all synced at once. The ping fluctuates all of the time, but you're informed of the change more often right when player score change. The rest of the problems could also be timer sync problems, one of the problems you reported (the insane hiccups) would be your system clock adjusting itself automatically, compensating a fairy large drift every now and then. See rant.

General rant: timer syncing is important to get right and impossible to get completely right if you have to take real world network fluctuations and real world borked timer implementations into account. There is just nothing you can rely on.
User avatar
Phytotron
Formerly Oscilloscope
Posts: 5042
Joined: Thu Jun 09, 2005 10:06 pm
Location: A site or situation, especially considered in regard to its surroundings.
Contact:

Re: Weird lag on new Macbook Pros

Post by Phytotron »

dlh wrote:For everyone experiencing this problem, do you all have ATI (AMD) graphic cards?
ATI Radeon 9600. Got ATI Displays, Vsync on (apparently, downloaded that back in 09, after I started playing again). Swap mode set to Finish.

Is there anything particular to Macs and their system clocks, versus PC's or other OS's? How about its (optional) use of a network time sync? (I would think other OS's have the same ability, but perhaps it operates differently. I dunno.)
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: Weird lag on new Macbook Pros

Post by Z-Man »

The mac timer sucks differently :) We have those timer interfaces available:
On Windows, the standard system timer. Its resolution is bad (1ms on XP, 40 ms on 9x) and it is subject to jumps when something (NTP) adjusts the clock.
On Windows, the high performance counters. They have superb resolution and are quick to query. Unfortunately, on overclocked systems, they sometimes run faster by the overclock rate, something which is very, very hard to compensate automatically without hitches, and on some multicore AMD systems, they return different timers depending on which core you happen to run right now, so they jump around and are completely useless.
On Mac and Linux, gettimeofday(). Good resolution (microseconds), but also, when something adjusts the clock, the timer jumps.
So yeah, you should probably disable net time sync or set it up so that it only syncs once on system boot. We can compensate the tiny drift gettimeofday() can have just fine, but time adjustments can be indistinguishable from freezers.

Oh, and just discovered (it's newish): clock_gettime(CLOCK_MONOTONIC_RAW) on Linux. nanosecond resolution, no adjustments ever, Let's switch to that when possible.

Edit: and of course, we're making a mistake with the sync code: we sync anew every round. It'd be much more accurate to somehow use the sync from the last round and applying a delta. It's not too hard to do. Next small project :)
User avatar
Jonathan
A Brave Victim
Posts: 3391
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Re: Weird lag on new Macbook Pros

Post by Jonathan »

On a Mac you could use mach_absolute_time.
ˌɑrməˈɡɛˌtrɑn
Post Reply