Object shown twice during animation

IrishFarmer 101 Nov 01, 2005 at 18:08

Man, I’ve been asking a lot more questions than I intended, but this one has more to do with theory than anything solid like syntax or something.

I’m creating a second game with my 2D engine, and its modelled after Breakout. I started on this one so that I could get my hands dirty with a bit more advanced collision detection than a game like Missile Command would have. However, I’ve run into a graphical problem. My engine eliminates flickering with a back buffer. But now I’ve run into another interesting and almost-as-annoying problem.

Any object that has any kind of velocity leaves behind an after image respective to its velocity. So let’s say the ball that destroys the bricks and all of that will leave behind a second ball. Even the paddle, which moves pretty slow seems to double up.

Is there any way to eliminate this problem? I can’t imagine what would even cause this problem to occur. I slowed down the frame rate and the objects are ‘jiggling’ back and forth so I’m guessing it has something to do with the way the human eye interprets the monitor output. But how do I fix a problem like that?

6 Replies

Please log in or register to post a reply.

moe 101 Nov 01, 2005 at 18:22

As you assume it could be the eye playing tricks. If so it would be more noticeable on dark (black) backgrounds.
Also make sure you are clearing your back buffer properly before drawing into it. And check that your buffer flipping is correct so that you are not accidentally drawing twice into the same buffer.

the objects are ‘jiggling’ back and forth

What do you mean by that? Do they move back and forward instead of just moving forward?
You could check a proper movement by lowering your frame rate to 2 or 3 frames per sec.

IrishFarmer 101 Nov 01, 2005 at 18:36

Oops, I think I meant to say they aren’t jiggling back and forth. I slowed it down to 3 frames and it moves just like it should.

The background is black….but I like it that way. Hopefully that won’t be a problem.

All of the buffer code should be correct. I won’t go into details why I know that since it would be pretty long winded and pointless. However, it seems to me that the problem might be how long its taking the window to update. Say, when one frame is rendered, the next frame is rendered at such a speed that to the eye it looks like the last frame hasn’t disappeared yet.


Don’t know if this will help any, but this is a ‘faked’ picture of what it looks like. I used PrintScreen to take a picture of the game, but obviously it won’t show the problem so I just copied and pasted the ball to show what it looks like when you play the game.


NomadRock 101 Nov 01, 2005 at 19:14

I really think this is just your eye playing tricks on you. The cells in your eyes have a very hard time changing dramatically very fast, so I think you are literally just seeing an after image. If your ball was actually moving smoothly across the screen instead of moving in descrete jumps, then you would see what we commonly refer to as motion blur. The trick is either to slow it down, so the distance between the ball on one frame and another is smaller, or to reduce the contrast to reduce the strain on the eye.

Also, could you please try to make your topic titles a bit more descriptive? It’s tough deciding whether or not a thread titled “sorry” is something I can contribute to without reading it all :)

IrishFarmer 101 Nov 01, 2005 at 19:57

That’s what I assumed. But I could have sworn that I didn’t have the same problem with another pre-built engine I was using. Ah well. I’ll just ignore it for now since the point of this project is to learn. Don’t want to get distracted for no reason.

MJeannig 101 Nov 02, 2005 at 10:01

If print screen does not show up the issue then it probably dont happen. You may try to take a screenshot between each frame to be sure. Do you have an LCD screen ? They are more subject to remanence.

IrishFarmer 101 Nov 02, 2005 at 22:17

Well, I know for a fact that my engine isn’t rendering two objects at once. That’s not the problem. The problem is getting the engine to render the frames in such a way that it doesn’t cause this to happen because the more I watch it, its painfully obvious and even my dad was like, “Why are there two balls?” Which taken out of context sounds rather funny.

But I’m sure it has something to do with the speed at which my engine is capable of rendering or something stupid like that. Either way, its very bothersome but I think I may know a solution. We’ll see.