2

Ok i've got my game nearing completion, everything is working perfectly in it and it runs fairly well on my computer (running at around 99Mb RAM). But when i run it on my xBox, i tend to get occasional jitters of the main player character. I do have explosions and billboard effects inside my game however i'm doing all that rendering on the xBox GPU (that was originally causing the jitters when explosions occurred, but not anymore). The jitters are random as well, not when i'm spawning large amounts of units, or performing lots of actions. I'm at a loss as to why this is happening, any ideas??

P.s. The game does have multi-threading integrated into it, update on one thread, rendering on another thread.

Ice Phoenix
  • 1,001
  • 3
  • 16
  • 34
  • have you tried troubleshooting using a profiler? http://code.google.com/p/slimtune/ seems to be a decent profiler that will work with XNA. – Greg Buehler Feb 21 '11 at 07:12

2 Answers2

6

It sounds like the garbage collector is causing your jitters. On Xbox it kicks in every time 1MB of data is allocated. The amount of time it takes depends on how many references are in use in your program.

Use the XNA Framework Remote Performance Monitor for Xbox 360 to tell if you have a garbage collection problem. Read How to tell if your garbage collection is too slow by Shawn Hargreaves.

If you do have a garbage collection problem, you'll need a profiler that can determine which objects are generating the garbage. The CLR Profiler for the .NET Framework 2.0 is one option. It's not supported in XNA 4.0 by default, but Dave on Crappy Coding has a workaround. For strategies to solve your garbage collection problem read Twin paths to garbage collection Nirvana by Shawn Hargreaves.

Update: The CLR Profiler for the .NET Framework 4.0 is now available.

Empyrean
  • 1,823
  • 12
  • 10
  • I'll give this solution a go and see if it clears anything up. I'm also thinking it may possibly be floating point errors combining over time possibly (hopefully not something that complex though). – Ice Phoenix Feb 23 '11 at 04:32
  • Accumulated floating point errors shouldn't be a factor in player jitter. But if you want to check, replace all your floats with doubles temporarily and see if that makes a difference. – Empyrean Feb 23 '11 at 05:17
1

Sounds like your rendering thread is just sat there waiting for the update thread to finish what its doing which causes the "jitter". Perhaps put in some code that logs how long a thread has to wait for before being allowed access to the other thread to find out if this really is the issue.

Chris
  • 26,744
  • 48
  • 193
  • 345
  • I thought that may have been the issue as well, but i went back through some of my archived/backed up versions that didn't have multi-threading and they seem to have the same issue, i didn't really notice it then as i had bigger issues to worry about. Thanks anyway though. – Ice Phoenix Feb 23 '11 at 04:30