Box2d and Tile-based environments

Hey guys I'm using box2d for physics in my tile-based game.

The problem i'm having is what is described in the manual:
"Polygons may not slide smoothly over chains of edge shapes or other polygon shapes that are aligned. For this reason, tile-based environments may not have smooth collision with box-like characters. This problem will be addressed in the future."

Basically if I set my main-character's body as box-like, then he stutters (and sometimes gets stuck) whenever he walks in-between tiles (the tiles are boxes positioned one after another, and hes walking on top of them).

I have kindoff fixed this by making the character's bottom-half a circle instead of a box, this instead makes him occasionally bounce up 1~2 pixels every once in a while, especially when he moves fast...
I was wondering if there is any known way to reduce this jitter, and just have smooth sliding over these boxes. (it really is a shame because this behavior makes box2d almost unusable for 2d tile-based games).


What i'm doing now to fix this, is i have an algorithm that combines line-segments with the same slope that are next to each other into 1 line segment, so that box2d only sees 1 big line, instead of multiple line segments. This is pretty inconvenient since i have to treat different tiles as part of the same body instead of each tile having its own body... But if theres no other solution then its good enough.
Hello,

According to the manual, Chapter 13, Limitations, point 2,

"Polygons may not slide smoothly over chains of edge shapes or other polygon shapes that are aligned. For this reason, tile-based environments may not have smooth collision with box-like characters. This problem will be addressed in the future."
I know that, I even quoted that exact message in my original post.

I was asking if there's known work-arounds for this.
I posted a few of my work-arounds in my post in-case other people have the same problem; I was wondering if there were other things I could try though...
cottonvibes,

Three possibilities as far as I know:
1) Make your character a circle (that can rotate).
2) Use a chain of edges for the floor instead of a chain of polygons.
3) If you have a row of boxes that are side by side and are the same height (for your floor) make them one long box rather than several smaller ones. However, I doubt this solution will completely resolve the issue for you since I imagine your don't want your floor to always be completely flat. But in limited circumstances it might be worthwhile.

Regards,
Q
Thank you for your input Questor.

I currently was already doing everything you mentioned, it does work smoothly..
The 3rd thing mentioned is what really helps the most, and it is a good work-around for the issue.

however its slightly inconvenient cuz i had to treat multiple rows of boxes as part of the same body.
originally i wanted to have every 'tile' its own body, so i can do collision events easily like that.
its not totally necessary for my game engine... just would have been nice.

anyways thanks for the help.
it would be nice if this issue was fixed eventually (it'd make life easier for a lot of tile-based game makers), but for now we can use these workarounds.
I plan to make movement smooth across edge chains. So for tile based games, you'll need to wrap the perimeter with a chain.
I've used the edgechain approach for quite a long time, and it works well in most cases and has better performance than alternatives such as polygon decomposition. The one case where it sometimes fails though is when you're walking towards a corner, and in that case, you can sometimes get snagged.

I talked to mayobutter about this, and he says that it's because you sometimes will slam into the vertical edge (if walking sideways), and this will particularly happen if your actor is fixedrotation.

I can provide a demo if requested.

Original thread: https://box2d.org/forum/viewtopic.php?t=4836