Today I officially started "porting" my game from Windows to Mac, and I ran into.... many problems. I solved a few right away, but the rest are listed below. Any insight or tips would be helpful. I've never owned a Mac, and I have almost zero PB-for-Mac experience except a small program I wrote at school 2 years ago.
Disclaimer: This Mac still has OSX 10.5. I know it's years old. I fear (or hope?) that upgrading the OS and Xcode will fix some of these.
1. The default subsystem is Cocoa, and "carbon" is the alternative, right? I ask because my game (60 FPS on Windows XP) gets about 30 FPS on the default Mac subsystem and 45-60 on "carbon". (I don't know why there is so much difference - the game is just a bare Screen with mostly 2DDrawing and some rare Sprite commands. I played with SmartSync, SetFrameRate, and Delay but saw no good changes.) Carbon runs better for me, currently, but I should probably target Cocoa for the biggest Mac audience, yes?
2. The game will freeze (spinning rainbow cursor) at seemingly random times. I have to kill it with the debugger. Neither the debugger nor the Purifier indicate anything is wrong. I have not found a consistent cause yet.
3. My game runs in both windowed and fullscreen modes. In both cases, I call CloseScreen() when I'm done. But on the Mac, if I call CloseScreen() while in a WindowedScreen, the whole display does a black fade effect (as if closing a FullScreen) then I get an IMA crash.
4. Also, when I open in WindowedScreen, the keyboard works fine. When I switch from WindowedScreen to FullScreen within the game, it works fine. But if I initially open in FullScreen, the key states seem messed up... for example my game thinks Escape is being pressed when it is not... I will try to write up some example code.
5. One of the old Mac bugs that played mono sounds at double-speed seems to be fixed. But I ran into another sound error: at least one of the Ogg Vorbis music files I streamed was at HALF-speed... not sure why, will investigate more.
6. Finally, perhaps the most concerning to me... player deaths "randomly" occur while standing on moving platforms (cause = illegal collisions) which never happens in the Windows version. This is strange, because my collision and physics are all custom written, using just PB math commands, so I would expect them to run identically (they are on similar Intel processors, not sure if that matters). This worries me that there might be some fundamental difference in the way floating points are being calculated or something...
Other observations:
7. The help file says #PB_Window_MinimizeGadget automatically adds #PB_Window_SystemMenu, but this wasn't true for me. I only had the yellow minimize button, I had to manually add SystemMenu to get the red close button.
8. The keyboard constants seem to differ between Cocoa and Carbon compiles... is this normal?
9. Does the Mac IDE not highlight matching braces? If not, why?
I know this is a big list, and without code snippets, it's hard to help. But it's only Day 1, I will report any solutions I find as I go. A friend with OSX Mountain Lion has offered to install PB and test Cocoa/Carbon versions for me... I will see if that helps at all.


