Had a thought the other day that I should share some code I wrote for tracing the edges of solid tiles in a tile-grid based game prototype I made - I did a cursory search online and didn't find anything like it before I started. The algorithm is straightforward enough but there are a fair number of steps.
It basically breaks an arbitrary-sized tile world into "chunks" (e.g. 10x10 tiles), and within each chunk traces the edges between solid & empty, joins them to create as few vertices & discontinuities as possible, and creates b2ChainShape's to accomodate. Here's a visual example from the game prototype I used it on (SubMiner):

If anyone would find this useful let me know, and I'll separate out the code and post it. The code is prettier than the placeholder graphics :). It's C++, using a bit of the STL (mainly vector<> I think). The one addition I didn't get time for was, between 10x10 chunks, to create "ghost vertices" in adjoining chain segments (the prototype I was working on didn't need it).
It basically breaks an arbitrary-sized tile world into "chunks" (e.g. 10x10 tiles), and within each chunk traces the edges between solid & empty, joins them to create as few vertices & discontinuities as possible, and creates b2ChainShape's to accomodate. Here's a visual example from the game prototype I used it on (SubMiner):

If anyone would find this useful let me know, and I'll separate out the code and post it. The code is prettier than the placeholder graphics :). It's C++, using a bit of the STL (mainly vector<> I think). The one addition I didn't get time for was, between 10x10 chunks, to create "ghost vertices" in adjoining chain segments (the prototype I was working on didn't need it).