My Computer or the Code?

Started by
15 comments, last by shane1985 18 years, 10 months ago
I'm working on a side scroller, and am running into some problems. I just added a parallax scroll effect for the background layer, but it seems like it's not running well. I'm almost positive that it's the code, but can't for the life of me figure out what's going on. Here's a download of the game. Use the arrow keys to move, space to jump, and F1 to exit (left shift also fires, but you don't really need that) Anyway, when I'm playing the game, it regularly skips, and the framerate drops to somewhere in the mid 50s. Also, the background layer scrolls fine most of the time, but every once in a while it looks like it vibrating. Does anyone else experience these problems with it? Also, since I'm assuming that you will, does anyone have any ideas about what the problem could be? Thanks! -Shane
Advertisement
Are you using double buffering?
did you take measures to keep a steady motion regardless of frame rate?

it may also be V-Sync issues.
its a good start..

The background scrolls fine its runs at a steady 61 fps for me that is until I shoot something and the explsion effect happpens it will drop to about 27 fps and thats nice an chopy .

im on a:
pentium4 2.4ghz
ATI 9700 pro
Yep, it's written in OpenGL, and I use OGL's double buffering mechanisms.
Also, I have taken measures to keep it steady.
I was referring to this article to implement some of these ideas.
Well, I figured out that the scrolling issue was definitely caused by forgetting to turn Vsync on, so it must have been tearing.

As for the major slowdowns with the particle effects, I don't know why it would drop to 27 fps, especially on your computer, which is faster than mine.

On my computer I don't really have any problems with the particle effects specifically; it's more just running around where I get intermittent skips.
Is it using the extension ARB_point_sprite ? I've heard of it causing some pretty nasty slowdowns on ATI cards.
Nope, right now it's just textured quads.
And it's only 100 per effect...
I don't think its a problem with opengl .. mine crawls to a halt .. its more than likely your game code, do you have some long running loops staling the frame rate ? are you creating destroying and destroying objects every frame ? the slow downs do not seem graphically related by any means , only because the drop in framerate seems linear, like a bad memory leak.

Also on another note, I don't understand how you could go that far writing a game and not noticing a problem that big ? That baffles me, seems to be a common recurring theme on this board.
-------------Become part of developing the specifications of a new language. Visit CodeBASIC.org
Well, first of all - try this version.

I removed the particle effects here, and fixed another problem that I found.
Also, it works better if Vsync is enabled (I'll have to add that in my game code then).

Btw, the problem only recently started to occur in this magnitude and I believe I have already solved the one you are alluding to. My question was mainly aimed at the momentary skips which have occurred throughout development.

<Edit>
Does anyone have any suggestions about how to better render the particle effects? Right now they are just textured quads with no optimizations whatsoever.
Tried it, works great .. runs smooth.
-------------Become part of developing the specifications of a new language. Visit CodeBASIC.org

This topic is closed to new replies.

Advertisement