Hello Box2D forum users,
I'm trying to make a game that has an infinite 2D world, and am looking at Box2D to implement physics.
The world is tile-based, and split into 32x32 maps, each of which connects both horizontally and vertically to more maps. I'm planning to organise maps into larger rectangular regions (at the moment, I'm thinking 32 maps horizontally and 8 maps vertically).
The way I'm thinking of doing it is wrapping the tiles with chains of edges; this should work fine for a simple tile-based map. However, there's two things I'm unsure about. Firstly, the obvious issue of extending this to be infinite. I assume I can't just keep adding shapes to the world as the player moves around, and removing the shapes no longer in range, due to floating point inaccuracies; the plan is to set the origin to a corner of the current region. But I can see this having problems when moving between two regions, as it will have to translate every single shape in the world whenever that happens. Secondly, the player will be able to modify the terrain; how easy is it to remove/add sections from a static edge chain?
Thanks in advance,
Vit
I'm trying to make a game that has an infinite 2D world, and am looking at Box2D to implement physics.
The world is tile-based, and split into 32x32 maps, each of which connects both horizontally and vertically to more maps. I'm planning to organise maps into larger rectangular regions (at the moment, I'm thinking 32 maps horizontally and 8 maps vertically).
The way I'm thinking of doing it is wrapping the tiles with chains of edges; this should work fine for a simple tile-based map. However, there's two things I'm unsure about. Firstly, the obvious issue of extending this to be infinite. I assume I can't just keep adding shapes to the world as the player moves around, and removing the shapes no longer in range, due to floating point inaccuracies; the plan is to set the origin to a corner of the current region. But I can see this having problems when moving between two regions, as it will have to translate every single shape in the world whenever that happens. Secondly, the player will be able to modify the terrain; how easy is it to remove/add sections from a static edge chain?
Thanks in advance,
Vit