17

I'm developing Side Scroll 2D Game, using AndEngine

Game image

I'm using their SVG extension (I'm using vector graphic)

But I discovered strange and ugly effect, while moving my player (while camera is chasing player exactly, means while camera is changing its position)

Images of my sprites looks just different, they are like blurred or there is effect like those images would be moving (not changing their possition, just jittery effect, really hard to explain and call this effect properly) Hopefully this image may explain it a bit:

Game image 2

Its more or less, how does it look in the game, where:

a) "FIRST" image is showing square, while player is moving (CAMERA isn't) image looks as it should

b) "SECOND" the same image, but with this strange effect "which looks like image moving/blurring during camera moving [chasing player])

Friend of mine told me that it might be hardware problem:

"the blurring that you notice is actually a hardware problem. Some phones "smooth" the content on the screen to give a nicer feel to applications. I don't know if it's the screen or the graphics processor, but it doesn't occur on my wife's Samsung Captivate. It happens on my Atrix and Xoom though. It's really noticable on the Xoom due to the large screen size."

But seems there is way to prevent it, since I have tested many similar games, where camera is chasing player, and I could not notice such effect.

Is there a way to turn this off in code?


I'm grateful for previous answers, unfortunately, still problem exist.

Till now, I have tried:

  • casting (int) on setCenter method which is being executed on updateChaseEntity
  • testing game using PNG images, instead of SVG extension and vector graphic
  • different TextureOptions
  • hardwareAcceleration

If someone have different idea, what may cause this strange effect, I would be really grateful for help - thank you.

Stewbob
  • 16,759
  • 9
  • 63
  • 107
Matthewek
  • 1,519
  • 2
  • 22
  • 42
  • 4
    For the record, there is no *bump*; that is generally frowned upon here at StackOverflow. Editing your original question to include additional information is the preferred way of attracting attention to it. – casperOne Dec 09 '11 at 19:29
  • Is it possible that this is just LCD blur? – BRPocock Dec 22 '11 at 21:57
  • I'm not sure, I have tested many games on my phones, and found a lot without such effect, also its visible on different devices. I'm not an expert :( – Matthewek Dec 24 '11 at 09:14

5 Answers5

1

Some devices (Xperia Play) bleed everywhere when trying to draw things that are moving quickly. For example a red icon on the application list leaves a blur behind it. You could try hardwareAcceleration in the manifest (on and off) to see if it makes a difference.

You'd probably get the same effect if you weren't using svg

FunkTheMonk
  • 10,908
  • 1
  • 31
  • 37
1

When your player's just going to the right and camera begins chasing him, all other sprites except player are moving to the left. Try to print the absolute coordinates of your "blurring" sprite (or some of its anchor points) to the log. The X-coord of sprite should be decreasing linearly. If you notice it's increasing some times, it could be a reason of blur.

Hope this will help.

geekyvad
  • 101
  • 3
0

It sounds like it's due to the camera moving in real increments, making the SVG components rest on non-integer bounds, and the SVG renderer making anti-aliasing come into effect to demonstrate this. Try moving the camera in integer increments by casting camera values to int.

Chris Dennett
  • 22,412
  • 8
  • 58
  • 84
  • Thanks for answers! In my camera implementation (Extension of BoundCamera) I override @Override public void setCenter(final float pCenterX, final float pCenterY) { super.setCenter((int)pCenterX, (int)pCenterY); } Because setCenter is being executed on updateChaseEntity. But it doesn't change anything, is this way you meant or I did it wrong? Thanks again – Matthewek Dec 06 '11 at 17:32
  • Nope, that's what I meant. Odd -- I thought that would fix it. Hmm. – Chris Dennett Dec 06 '11 at 17:34
  • Well... if your entity is on position XX.5 and you round your camera position on integer let's say XX.0 then your entity still will be drawn on subpixel. You can keep everything integer... track your entities position in floating point but for rendering use integer. I don't know if this is the problem but if you are desperate you can give it a try. – Aleks Dec 06 '11 at 17:57
  • Thanks for answer, but isn't it the same solution, that Chris Dennett suggested? – Matthewek Dec 06 '11 at 19:05
0

I'm not familiar with this engine but I wonder why would you use vector graphics for pixelated art style. I'll be surprised if your character in the screenshot is really a vector art... maybe it's texture imported in SVG? I attempted back in the day to use flash a few times and I was making the same mistake... I'm not saying it's not possible but it's not intended to create pixel art with flash or any other vector software. There is a reason why most flash games have similar look.

Aleks
  • 1,177
  • 10
  • 21
  • As you noticed, player texture is not a SVG, its just a PNG, because I haven't created decent vector for my players (current is just for test purposes) With SVG extension, I do not have to worry about quality, scaling and so on, also game size is lower in compare to games where you have to provide graphics in different resolution. I'm not expert obviously, but I found it useful. – Matthewek Dec 06 '11 at 18:30
0

Best way to debug it, is try a different looking sprite. Maybe it is just the slow response time of your device display. I'm also an Andengine developer, and never seen such behavior.

Sometimes you fix jittering using FixedStepEngine, it might help.

If you can post your code maybe we can better help you.

Oren Bengigi
  • 994
  • 9
  • 17
  • 1
    Thanks for answer. Nope, its not a jittery, I had such effect, after changing normal engine and physic world to limited fps engine and fixed step physic world. But I have fixed it with mCamera.onUpdate(0.1f); in my chasing entity update. Hopefuly I'm doing something wrong, so here it is (code with example, how I'm loading my textures, which options im using, and how I'm attaching my sprites) http://pastebin.com/sCSgRhS9 [I just removed 99% of code from this class, which is useless for preview purposes] Thank you for help – Matthewek Dec 26 '11 at 17:36