Static and AnimatedSprites "Jiggle" Against Tilemap - Has Anyone Else Seen This?
by Eric Bakutis · in Torque Game Builder · 08/30/2012 (8:44 pm) · 3 replies
I've been prototyping a standard top down dungeon crawler in TGB for a couple of months now, and while I'm making good progress, there's one polish bit that really bothers me. I'm primarily using tilemaps to build my levels, and placing Static and AnimatedSprites as needed for interactable objects (such as monsters, destructable objects, doors, etc).
The problem I'm seeing is subtle... as the player moves through the level (the camera is mounted to the player) these objects will almost imperceptibly "jiggle". In relation to the tilemap, they slide a couple of pixels up, down, left, or right, so it almost looks like there's an earthquake going on. At first, I suspected something in collision checks, but the problems occurs even if the object's collision is turned completely off.
The problem doesn't occur with AnimatedSprites that move about (such as monsters)... it's isolated to AnimatedSprites and StaticSprites placed at distinct X/Y positions.
The only thing I can think is that as I move the camera around, the renderer is processing the tilemap a few ticks before or after the animated sprites, leading to the two of them not lining up exactly the same each time the screen redraws. I don't have the faintest idea how to fix it, however.
Has anyone seen a similar problem when mixing tilemaps and Static or AnimatedSprites? Could anyone suggest a fix?
The problem I'm seeing is subtle... as the player moves through the level (the camera is mounted to the player) these objects will almost imperceptibly "jiggle". In relation to the tilemap, they slide a couple of pixels up, down, left, or right, so it almost looks like there's an earthquake going on. At first, I suspected something in collision checks, but the problems occurs even if the object's collision is turned completely off.
The problem doesn't occur with AnimatedSprites that move about (such as monsters)... it's isolated to AnimatedSprites and StaticSprites placed at distinct X/Y positions.
The only thing I can think is that as I move the camera around, the renderer is processing the tilemap a few ticks before or after the animated sprites, leading to the two of them not lining up exactly the same each time the screen redraws. I don't have the faintest idea how to fix it, however.
Has anyone seen a similar problem when mixing tilemaps and Static or AnimatedSprites? Could anyone suggest a fix?
#2
I moved the tilemap to 0,0 and then reset all of my objects on the hard "divisible by 5" points TGB seems to like (90, 95, 100, etc). Now, I have almost no jiggling at all. It's kind of facepalmy that I've been seeing this problem for months and only now thought to check that.
So, my mistake may be other's gain. :) It seems that putting the tilemap on a nice, even position (like 0,0) and putting all Static or Animated sprites cuts down on jiggling by a HUGE amount. I still see tiny amounts, but it's more minor screen-tearing than anything else.
08/30/2012 (9:26 pm)
So, I've been playing with it a bit more, and honestly, I think it was just a matter of being imprecise. After some digging, I noticed my tilemap had gotten scooched over to a kind of odd coordinate (X -14.0629, Y 16.0344)... something along those lines. All of my objects were on the grid, but my tilemap was not.I moved the tilemap to 0,0 and then reset all of my objects on the hard "divisible by 5" points TGB seems to like (90, 95, 100, etc). Now, I have almost no jiggling at all. It's kind of facepalmy that I've been seeing this problem for months and only now thought to check that.
So, my mistake may be other's gain. :) It seems that putting the tilemap on a nice, even position (like 0,0) and putting all Static or Animated sprites cuts down on jiggling by a HUGE amount. I still see tiny amounts, but it's more minor screen-tearing than anything else.
#3
08/30/2012 (9:53 pm)
I used to do that but that was annoying to check all the time and my above fix seemed to help anyway. :) Glad you solved it.
Torque Owner Alpha-Kand
Hunter's Meadow