Supporting 100000 objects in box2d
#1 Members - Reputation: 119
Posted 19 June 2012 - 06:14 AM
1) Can box2d be scaled to use more than 100000 bodies?
2) Can box2d be scaled to do collision detection of more that 100000 shapes?
3) what is the order of the raycast algorithm used in box2d for checking if 2 bodies are in line of sight of each other?
4) What 2d engine can be used for rendering more than 100000 characters?
Thanks!
#2 Members - Reputation: 322
Posted 19 June 2012 - 07:00 AM
If you mean at a reasonable frame rate, No. My Core 2 Duo 2.4GHz can't deal with more than a few hundred active bodies. I don't think there are any general purpose physics engine that can deal with 100k.1) Can box2d be scaled to use more than 100000 bodies?
2) Can box2d be scaled to do collision detection of more that 100000 shapes?
This is more a hardware problem. My on-broad Intel HD Graphics 3000 can render around 8K 32*32 sprites with same texture at 60fps, while doing game logic and rendering simple background. With some decent graphic card you could do maybe like 50K simple sprites or particles, but 100K "characters" don't sound promising.4) What 2d engine can be used for rendering more than 100000 characters?
It could be possible if you came up with some clever optimization for your game, but I'll suggest you consider that do you really need 100K.
#3 Members - Reputation: 119
Posted 19 June 2012 - 08:03 AM
This is meant to be run on server, while showing only small part to frontend.This is more a hardware problem. My on-broad Intel HD Graphics 3000 can render around 8K 32*32 sprites with same texture at 60fps, while doing game logic and rendering simple background. With some decent graphic card you could do maybe like 50K simple sprites or particles, but 100K "characters" don't sound promising.
#4 Members - Reputation: 3700
Posted 19 June 2012 - 08:53 AM
This is meant to be run on server, while showing only small part to frontend.
This is more a hardware problem. My on-broad Intel HD Graphics 3000 can render around 8K 32*32 sprites with same texture at 60fps, while doing game logic and rendering simple background. With some decent graphic card you could do maybe like 50K simple sprites or particles, but 100K "characters" don't sound promising.
Then you don't have to render anything, to simulate 100k users on your server you need to either keep the simulation really simple or distribute the simulation across multiple physical machines. (Looking into distributed simulations is almost essential for any proper MMO project and is one of the biggest technical challenges that separate them from normal multiplayer games)
The voices in my head may not be real, but they have some good ideas!
#5 Members - Reputation: 119
Posted 19 June 2012 - 01:20 PM
#6 Members - Reputation: 3700
Posted 19 June 2012 - 02:25 PM
Is box2d scalable to 100000 characters? The problem with the engines out there including box2d is that they run a loop and in each loop check for collisions between objects. but if instead of checking for collision on each object in each loop if we calculate when the next collision for an object occurs using equations of motion then i think it will be the most efficient.
it really depends on what a character is, if it is just a box that you do collision detection on and nothing else then yes, Box2D should handle 100k of those unless you keep them all very close to eachother (But in that case you really don't need Box2D since detecting collisions between boxes is trivial), if you start adding in forces and actually use Box2D for what its meant for then it will most likely be far too slow for a game and there is no way around this, proper physics for 100k entities isn't really reasonable on todays hardware (Today this is solved by not doing any physic simulation at all for resting objects (objects tend to be put in a resting state if they havn't moved noticably for a few updates and are woken up again if a new force is applied to them or if the object they're resting against moves, this however doesn't work with characters as they tend to be constantly moving)
The voices in my head may not be real, but they have some good ideas!
#7 Members - Reputation: 600
Posted 19 June 2012 - 02:31 PM
on the other hand 100000 bodies means 100000 entities.
this means 100000 batches to renders all of them. i dont thing any cpu can handle that many render calls.
You need some awesome instancing method to keep batch count low.
even if you do so, say each character is 100 tris (low because of LOD), that is 10 million polygons, and you want 60fps?
i say: give up
#8 Members - Reputation: 690
Posted 20 June 2012 - 12:31 AM
EDIT: That quadtree collision video, top left corner says ~10,000 objects:
http://www.youtube.com/watch?v=jOGRwtPcQlU&feature=relmfu
After watching this, I think you should re evaluate your need for that many entities... lol
Edited by M6dEEp, 20 June 2012 - 12:59 AM.
#10 Members - Reputation: 1551
Posted 20 June 2012 - 11:05 AM
So, it really depends on how you're setting up your environment, and how many objects are truly active, and how close the objects are to each other.
BTW, this question should really go onto the Box2D forums. They would be able to give you more detailed answers.
---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)






