So, I've already found some information on how to use box2d and tiledmap together.

Since I want to generate my top down map (100 by 100 tiles), I thought about only using box2d.

The tiles would be fixed and only the player (and maybe some other movable parts like chests, etc) would be dynamic. I'd also like to use box2dlights later, so using box2d seems convenient.

My only concern on this is the performance. I haven't used box2d much, so I don't know how it handles such a big amount of boxes (though not all 10000 tiles would be visible at the same time).

Does anyone know how the performance would be influenced or advice on how to achieve this easier?

Thanks in advance

  • 1
    \$\begingroup\$ Box2D is a complex physics library, so you'd be better using simpler algorithms to simulate collisions if you want good performance. \$\endgroup\$ – Alexandre Desbiens Jun 3 '15 at 12:47
  • \$\begingroup\$ @AlphSpirit I thing I won't need collision calculation anyway, because I'd like the player only to be able to smoothly move on a grid.. Is there a way to apply lights to the tiledmap? \$\endgroup\$ – RegisteredUser Jun 3 '15 at 12:58
  • \$\begingroup\$ There is plenty of resources on the Web for lighting a topdown map. If you still have questions about it, feel free to create a new question on this site. \$\endgroup\$ – Alexandre Desbiens Jun 3 '15 at 13:02
  • \$\begingroup\$ I doen't make a difference, if the tiles are visible or not, Box2D will update them anyways. But i don't think, that those 10000 tiles will create performance problems, as most of them are static as you said. Anyways, if you don't need any complex physics-calculation Box2D will be overhead. For lighting there are many other posibilities + it is possible to use Box2D lights without Box2D (no shadows!) as you can see here \$\endgroup\$ – Springrbua Jun 4 '15 at 7:41
  • \$\begingroup\$ @Springrbua Thanks for that. I decided to use my own map implementation for tiles and the player, since the player will only move from tile to tile (the movement is animated though). \$\endgroup\$ – RegisteredUser Jun 4 '15 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.