Game Development Community

Mac performance questions

by Nick Grandy · in Torque Game Engine · 09/11/2006 (5:48 am) · 5 replies

Hi

I'm working on a cross-platform Torque game, and am concerned about the performance on Macs. My mac setup is a Macbook Pro, 1.83Ghz, 1.5GB RAM, running 10.4.7 and XCode 2.4. I am using the Torque Game Engine with Synapse Lighting Kit, version 1.4.0. I have compiled my game and the example first person shooter (the orc village game) as universal binaries.

The performance of the orc shooter game is fine on the mac. The performance of my game seems to depend on the area of the level - in small interior spaces the performance is fine, but in exterior mission areas that are big and open, the performance is quite poor. By poor I mean maybe 5-10 frames per second and big pauses of half a second or even a second. The processors do not max out, but they both run at about 75%. Meanwhile, on a mid-level PC laptop, those big open mission areas perform just fine.

I know that many things factor into performance. Given my setup and game, I would expect better performance, so I'm trying to figure out if I'm missing something. Here are the basic factors I'm aware of:

Hardware: processor, RAM, video card - given my newish laptop, I would expect all of these to be fine. Perhaps the video card is subpar?
Engine: this is where my big question is. Does Torque simply not perform well on macs?
Levels: are there big pitfalls in level construction that will dramatically impair performance? Given the good performance on a PC laptop, I expect we have not done anything seriously wrong.

So, what insights do people have about this poor performance issue, and what suggestions are there to improve performance by tweaking the level or the engine?(I know of some tricks, like using different resolution images and textures depending on the camera's distance from an object. )

And finally, does Torque have any built-in tools to help track performance, eg to report frames per second?

Thanks,
Nick

#1
09/11/2006 (7:26 am)
The simple fps function is to open the console (~) and type "metrics(fps);" This will give frames per second and some poly count information.

The full list of metrics is here: http://tdn.garagegames.com/wiki/TorqueScript_Console_Functions_2
Using the right ones here will allow you to see how much of you video card memory is being used etc.

Just for reference - on a dual 2.0GHz G5 with an ATI 9600XT (very average) at a high screen size I average in the high 60s to low 70s and even in the worst case (whole village view with multiple explosions) I still run in 40s. Inside the huts the rate jumps to solidly 100 plus.

Are you sure you have a universal binary? Are you using the 1.4u SDK download build designed for Universal? It really sounds like the performance you get when your PPC code hits the emulator on a non x86 binary. (There is also a newer 1.4.2 OS X build on CVS as of late last week.)

There is no reason it should be that slow - I think there is some underlying fundamental problem - possibly with your OGL but most likely with your binary and when you find it the change will be dramatic. ;)

=Tod

PS There are performance issues with Torque and some dual core chips but those usually result in code running super fast not too slow.
#2
09/11/2006 (4:37 pm)
Hi Tod,
Thanks for your advice. A few followups.

metrics(fps) works well in the orc deathmatch, and on the universal version of that game i am running anywhere from 40-300fps. Super!

On the universal version of my game, calling metrics(fps) just makes a white bar show up - no text. What gives?

Now, as to whether I'm actually running a universal version: I am compiling from scratch on an intel mac, and when I do apple-i on the app to get info, it says it is a universal app. Is there some other way to make sure it is REALLY universal? Is it possible that it looks universal on the surface, but underneath it is not? (I suspect this is not the case becaues I have a PPC and a universal version of the orc deathmatch, and there is a big difference in performance).

I am also downloading 1.4.2 to see if the latest code behaves differently - I am posting questions about that process separately. :)

Thanks,
Nick
#3
09/11/2006 (6:59 pm)
I reread your original post and I am less sure it is a universal binaries issue. If you starter.fps compiles and runs fast then it doesn't appear to be a structural like I was suspecting.

Have you tried OGL not on a Mac? If this is an advanced game I suspect it was developed on a PC and you're now looking at the other platforms. Am I corrrect?
Also have you tried your Mac code on a PPC machine? Doing so would let you know if it is a Mac issue or an Intel-Mac specific issue. I know people are careful with unreleased code but I - or probably any number of Mac torque people - would be willing to try it and report back.

As for the metrics not reporting I'm afraid I'm not experienced enough to help, but I can suggest. Do you do font manipulation? Could the font be missing or printing white on white? Getting metrics working would be helpful because I think you will be wanting to print out the OGL metrics during the debugging process.

For speed problems in general I would treat them like any slow program and use the Mac development tools for optimizing your code. Shark should be able to give you a profile and percentages of where your code is spending its time and lead you as to where to look. The CHUD tools are supposed to be good but I think Shark should give you what you need to get started. I haven't used them against Torque because I'm just playing with the SDK at the moment but if the game is running 8x slower than expected the time sink should be obvious I would think.

Happy hunting - let us know how it goes,

=Tod

PS Hey, there's also a really cool OGL Profiler in the Developer > Applications > Performance Tools folder. Wow, thanks for making me look in there again.
#4
09/11/2006 (8:52 pm)
Hi,

I've been part of a team developing a Mac & Windows based Torque project, and my MacBook Pro 2.0Ghz runs our texture-heavy environment just fine -- typically faster than our mid-range Windows desktop PC's, in fact. If you have a copy of Windows that you could borrow (and a few gig's of HD space), you could try running on your MacBook Pro in Windows -- that would rule out video card wimpyness (well, aside from a chance the video drivers have a problem.)

Often, pauses in gameplay can be explained by insufficient texture RAM, where the video card has to swap in textures as it renders different parts of the scene. Have you tried temporarily removing the textures (as a test), reducing texture resolution, or enabling texture compression?
#5
09/14/2006 (7:15 pm)
@Nick:
1) Shark it. Make a fully-optimized ( -O3 or -Os ) build, with debugging symbols ( preferably DWARF format ), and use Shark on it. Shark is the best dev tool, ever .

2) On the fps bar being blank, if it's just a small vertical white bar, then the gui itself is getting squished. Just pop open the gui editor & expand it to show the text. If it's normal size & blank, see if echo(fpsMetricsCallback()); dumps anything to the console, and we can take the prob from there.