Stencyl 3.4.0 is now out. Get it now!

Problems with pixel-snapping

MichaelPel

  • *
  • Posts: 458
Project settings
  • 256x128 canvas
  • 3x scale
  • pixel-snapping
  • flash

Problem #1
My current camera behavior is a regular smooth lerp, but due to the small canvas size, it simply can't be enjoyably smooth. Is it possible to render the scene pixel-perfect and then scale that up, so that the game canvas is nice and pixely, and then move the camera on the finished product for a smooth, lovely result?
Solved

Problem #2
I'm rendering text on actor loops that are, for example, above certain actors. When the camera is moving, the drawn text is "moving" slightly off where it should be drawn, does not snap to grid, and looks bad. What is the cause and can I do anything about it?

Problem #3
I'm not sure if it has anything to do with my project settings, but I'll bundle it in. Sometimes the camera, for a single frame, offsets by a lot resulting in a jerky movement. It happens with my lerp camera, with static set camera center to actor etc. Is this a known bug? I haven't encountered this before.

Thank you in advance :- )

« Last Edit: January 11, 2018, 02:49:06 am by MichaelPel »

designpeg

  • *
  • Posts: 541
i've come across this problem, I think it's because when you scale a scene say x3 or use a higher res device like ipad (could be upto x4) when you move an actor by 1 pixel in the engine, it jumps 3  real pixels, (or 4 in my ipad example). so if you use follow actor for your camera movement, it looks jerky.   If you move the camera using a tween, (by using the change value block), it will actually move the camera through all the actual pixels.

MichaelPel

  • *
  • Posts: 458
Quote
If you move the camera using a tween, (by using the change value block), it will actually move the camera through all the actual pixels.
Thanks! This solves my first problem then. Any ideas about the other two?

designpeg

  • *
  • Posts: 541
Not sure about the other 2 without looking at the code, but maybe similar to an issue I had which caused me jitter. Basically I had an actor which I wanted to be draggable onscreen with a mouse joint, while I moved the camera to another part of the scene, the issue turned out to be the order things happened in when in different behaviours eg. if I had a loop that said move actor by x number of pixel left each frame, then another behaviour that said move camera to position of the actor the position of the actor wouldn't have changed until that frame was actually drawn to screen, meaning it was slightly out. My solution was to move the actor drag behaviour and the camera movement into one behaviour so that I could be sure everything happened in the correct order. Maybe this could give a clue to your problem?