Acidic
Acidic

Reputation: 6282

Visual bug when moving a MovieClip

In my attempt to create a simple Pong-like game, I've encountered a very strange and at times severe visual bug.
When I set the ball (A Flash CS 5.5 library MovieClip) in motion moving around the screen at a rather fast speed, I've noticed that sometimes the edges of the ball would be cut-off for a short moment in the direction it is moving.

When it happens, it almost seems like the position of the ball MovieClip is slightly ahead of its own border and thus the part that is outside the border fails to get drawn.

Here's a picture that illustrates how this looks - at least for me:
enter image description here

You can also view the .swf file online here: http://megaswf.com/serve/2099366

Some technical data:

  1. I've been unsuccessful in capturing the with a screenshot no matter how much I tried.
  2. Sometimes I would open the .swf and the bug would be almost non-existent while at other times it was very blatant.
  3. I'm using an EnterFrame event function to increment / decrement the x and y position of the MovieClip.
  4. I have never encountered any such problem in any Flash app, in this machine or others.
  5. Truncating / rounding the x and y values of the MovieClip didn't help. Neither did setting cacheAsBitmap to true.

What in the world could be causing this problem?

Thanks in advance.

Upvotes: 3

Views: 489

Answers (2)

Nathan Goings
Nathan Goings

Reputation: 1154

I was having this same problem, under the same constraints. As I've added content to my game, this has become more of a problem. These options greatly reduce the artifact:

  • Enable JPEG deblocking and increase JPEG Quality (publish settings)
  • Decrease framerate
  • Enable Hardware acceleration (publish settings)
  • Upgrade your Flash Debug Player for Flash Professional
  • Use the non-integrated flash version in Google Chrome (This solved random crashes and fullscreen stutter for me)

Upvotes: 1

Cay
Cay

Reputation: 3794

I don't know the exact technical reason for this (I'm guessing it has to do with the screen refresh rate vs FPS) but I'm pretty sure its a screen artifact and not a real rendering bug (which is why you won't be able to get it on a screenshot). You can try several things to decrease the effect, like some kind of motion blur:

//on your game loop
mc.filters = [new BlurFilter(Math.abs(speed.x), Math.abs(speed.y),3)];

Or other visual tweaks... but bare in mind this thing is very noticeable on a black-circle/white-background situation, however on more complex scenarios the eye is much more forgiving.

I'm not sure there is a technical solution (reliable across machines/OSs/browsers), but you can also try with stuff like optimizing your game loop (blitting + steady framerate + updateAfterEvent())... though I'm not sure the result would be as one would like to think (I'm guessing it could help a little).

Upvotes: 0

Related Questions