Made a 2d game, but graphic performance is not very good

Discussion in 'Mac Programming' started by demaxism, Jan 3, 2013.

  1. macrumors newbie

    Jan 3, 2013
    pretty like the old-fashion low resolution game, with pixel charactor, like the 1980's NES games,
    I just made a simple such old fashion game on the app store, but seems run slow , occationally below 50fps. what wondered me is how could a low-spec 8-bit NES game run in full fps, however my game is in unstable speed, even with dual-core modern machine...? maybe is my machine's problem, anyone try it? its free on app store. name is "Rock in Code"
    here is some screen shot

  2. macrumors G5


    Nov 25, 2005
    The speed of the software obviously depends on the developer. We don't know what you are doing, so it's hard to say what the problem or problems are.
  3. macrumors 6502a

    Jul 23, 2008
    Have you ever heard of complexity? Or Big O Notation?
  4. macrumors member

    Nov 24, 2012
    Can you post some code from your drawing routines? It's hard to tell what the problem is when you aren't giving any information as to what your code is actually doing.

    Are you using OpenGL, SDL, what?
  5. macrumors 6502a


    Jan 4, 2002
    Austin, TX
    You need to use "Instrumets" in Xcode on your game to see where the performance problems really are. Many times the slow code is not at all what you may think it is. Maybe you are allocating and releasing a lot of memory blocks over and over in a tight loop instead of allocating once and reusing them, who knows.

    To learn how to use Instruments you can go to the Mac Dev Center at and watch, for free, the "Development Videos" from WWDC 2012 for the "Learning Instruments" session. And you should probably look at the "Optimizing 2D Graphics and Animation Performance" session videos.

    All of this is totally free and you can watch it over and over as much as you need to. Also there are sample code projects that go with the sessions so you can download and look at the exact same code as that used in the sessions.
  6. macrumors newbie

    Mar 10, 2011
    What does your fundamental game loop look like?

    Assuming that you're not inadvertently doing some crazy processing (which a profiler would tell you, as suggested by Sayer), this is probably down to a problem with the design of your basic game loop.

    Could you summarize your technique? Are you rendering frames on a timer? NSTimer? Do you expect to get called 50 times per second (hence 50fps)? If so, you might want to study how timer invocations happen (you're likely not being called that often). As well, you might want to consider how these oddly-spaced game-steps affect your update logic. For example, if you assume that you step the game every N milliseconds, but actually you're stepping it every N+dt milliseconds, then eventually those dts accumulate to the point where you've missed several steps that should have happened.

    You might get something out of this thread and the commentary linked to in it:

Share This Page