I'm creating a mmorpg game with a little team, and we want to add a player-objets collisions system. We want players to be able to walk on a heightmap ground, and walk/be blocked by objects.

I found the bullet physics library (I already used his Java wrapper), but I don't know how to make it enough efficient for a VERY huge map, and a lot of players on it.

In this game, there will be a very huge world (loaded by a chunk system), with all players on the same world. So how can I made an efficient way to make player(AABB)-objects(shapes with triangles) collision system in a very big map?


2 Answers 2


You need to keep splitting your world into little parts. There are plenty ways of handling collisions between a height map and objects, but in the end, every method has the same problem; The Amount.

So you already took the first step, by deviding your world into chunk's. Next you need to change your server in way, that the server handles physic updates per chunk. Now you need to do the standard collision of an object against a heightmap to position it correctly. Next do collision against all objects with collision in one chunk.

For now you have a working solution. Next you need to take care of, finding the sweet spot for server X for chunk size. Find a good standard size of chunk the server is able to handle collision against quick, per users active at the same time.

So if many users are online on the same server the same time, chunk sizes need to shrink, as less players are online chunk sizes can grow.

You also need to be aware of, that there will be a max, that server X can handle the same time.

You could drastically raise your performance, if collision between player isn't mendatory, so only heightmap and physical objects.

In the end, it's a long way of optimizing these parameters and finding the sweet spot or even making it dynamically change.

  • \$\begingroup\$ Ok, and ho can i handle collisions in a chunk, and collisions when a player is on multiples chunks at same time ? \$\endgroup\$ Commented Sep 27, 2016 at 8:05
  • \$\begingroup\$ First of, what do you mean by how to handle collision in a chunk? There are multiple examples of howto collision on google. If you post a try and show what is not working we are able to help. But we are not here to write code for you. Secound, why should a player ever be on multiple chunks at the same time? \$\endgroup\$ Commented Sep 27, 2016 at 8:36
  • \$\begingroup\$ When i mean collision, i mean the method who make a player (or an aabb object) get pushed out of another object. The problem is that I didn't found any code to do this. And for the multiples chunks, i mean if somes points of the player aabb are in one chunk, and others in another chunk. I will post m'y code later, i'm currently at school. \$\endgroup\$ Commented Sep 27, 2016 at 10:18

I'm an independent game dev. myself, and I found a way to add collisions in 2d. I'm not sure if it'll work in a 3D game, but I'll try my best. If the player x y and z coordinates are a certain number it should collide on, then you could make that in an if statement. I'm sorry if that doesn't help, but I hope it does!

  • 4
    \$\begingroup\$ This is a very very very very bad method of adding collision. What if you want to add a new level? Do a simple swept AABB instead. \$\endgroup\$
    – Bálint
    Commented Sep 27, 2016 at 5:53
  • \$\begingroup\$ "if the player x y and z coordinates are a certain number it should collide on" yes, that's the core idea of collision detection: the trick is you need to provide some method to determine whether a given set of coordinates should be considered to be colliding with an obstacle. This answer does not suggest any such method, so it does not provide a solution to the problem. \$\endgroup\$
    – DMGregory
    Commented Jan 5, 2017 at 22:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .