Rick Posted May 29, 2012 Share Posted May 29, 2012 I have 16 zombies and a player in my scene. Each have a controller to them. If the zombies have an entity type that collides with the player but not other zombies I get 60+ fps and all is good, minus the stacking up on each other they do. If I have all controllers collide with each other, and all these zombies are always moving towards the player, as soon as they are all around the player always trying to move closer but colliding with each other I get about 1 fps. 1) I assume this is just how controllers work? Many collisions with controllers each frame just kills the fps or am I missing some magic command to reduce this? 2) Any suggestions on how to handle this differently while still using controllers? I'm thinking about stopping the zombie movement if it collides with the player or another zombie and if not moving try moving again every 1 second or so to reduce the physics. This could of course lead to some strange looking behavior as the zombies are closing in on the player and happen to just bump into each other so curious what others would try. Thanks! Quote Link to comment Share on other sites More sharing options...
Josh Posted May 29, 2012 Share Posted May 29, 2012 I'd like to see what your physics geometry looks like in the scene. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted May 29, 2012 Author Share Posted May 29, 2012 I just have a flat terrain with 16 zombie models and a player model I placed in the scene. The models themselves aren't doing any sort of collision as I don't set any entity type for them. When I load the scene I loop through and give each zombie and the player a controller. I have an update method called each frame for the zombies and it points the zombie at the player, and sets a move variable via: _move = Curve(1 * _speed, _move, _moveSmoothing / AppSpeed()); It them updates the controller and positions the model to the controller location. As you can see from the screenshot once the zombies have surrounded me I get .78 FPS. http://dl.dropbox.co...842/zombie1.png Quote Link to comment Share on other sites More sharing options...
Josh Posted May 29, 2012 Share Posted May 29, 2012 Your character models have a physics body made out of a high-poly mesh. If collision is being tested against those it will be very slow. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted May 29, 2012 Author Share Posted May 29, 2012 Those model physics bodies aren't being considered in the collisions. Only the controllers have an entity type assigned to them. If I set the zombie controllers to an entity type of 2 and the player to 1 and given the default collisions the engine uses when a scene is loaded it does collision between player and zombie but not zombie and zombie in terms of the controller and I get 25 fps. This would lead me to believe that having this many controllers on screen with them colliding each frame is something LE doesn't handle very well. I'll play around with replacing those models in the scene with a LoadMesh() so no physics file is loaded and see how that works just to be sure to rule anything happening with those models behind the scene. Quote Link to comment Share on other sites More sharing options...
Josh Posted May 29, 2012 Share Posted May 29, 2012 I don't think so, the controller-controller test is very simple. It's possible maybe the collisions are being discarded after the test? I don't think so, but that sounds like a possibility. Let me know the results when you use LoadMesh. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted May 29, 2012 Author Share Posted May 29, 2012 Strange results. In my scene parsing logic I use LoadMesh() and delete the model loaded. I also tried CreatePivot() instead of LoadMesh(). With CreatePivot() everything is fine. All the "zombies" go around me and sometimes it might drop to 30 but it goes right back to 60 and is fairly consistent at 60. With LoadMesh() for the models if I run around in circles and don't let the zombies get me I get 60 fps. This tells me it's not the poly count of the models themselves. Once I let the zombies all gather up on me, over about 10 seconds it'll slowly degrade the fps until it reaches 0 and it stays there.. So why would it be that if my player model is moving around not letting the zombie controllers touch me but they are touching each other the fps stays at 60, but if the zombie controllers/meshes touch me and gather on the player the fps starts dropping then and only then to 0 and doesn't recover. The meshes shouldn't have anything to do with the collisions right? Here is the update function that gets called each frame. It's pretty basic so I wouldn't think this would matter. void Actor::Update(Camera& camera) { UpdateController(_controller, _rotate, _move, _strafe, _jump, 50000); PositionEntity(_model, EntityPosition(_controller)); } Quote Link to comment Share on other sites More sharing options...
Josh Posted May 29, 2012 Share Posted May 29, 2012 With CreatePivot() everything is fine. Ah, I think I know what is happening. Unnecessary ray casts or collision tests are slowing it down, I bet. Let me look into it further... 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted May 29, 2012 Author Share Posted May 29, 2012 Cool thanks! Quote Link to comment Share on other sites More sharing options...
Game Producer Posted June 3, 2012 Share Posted June 3, 2012 I noticed similar earlier, but thought "it's just how controllers work". Would be most splendid if there's solution for this. Quote Intel Dual Core 3GHz / GeForce GTS 450 - 1024 MB / Driver ver 267.59 / 8 GB RAM / Win 7 - 64 bit / LE2.50 / BMAX 1.48 game producer blog - Dead Wake Zombie Game powered by Leadwerks Engine Twitter - Unfollow me Link to comment Share on other sites More sharing options...
Naughty Alien Posted June 14, 2012 Share Posted June 14, 2012 solution is very simple..make controllers to collide with, just and only world geometry, not other controllers...then, create cylinder bounding space, with same size as controller, and position it on same position as controller is, and final, check cylinder bounding spaces intrusion, instead of controllers..similar technique im using for my system and it can run hundreds of characters with no slowdown at all.. Quote Link to comment Share on other sites More sharing options...
Rick Posted June 14, 2012 Author Share Posted June 14, 2012 Yeah, I guess I was just hoping Leadwerks would have handled that for me. It is interesting that Josh says that it should be. Hope he's able to find something out with this. Thanks for the workaround idea NA. Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted June 15, 2012 Share Posted June 15, 2012 ..i understand you Rick..I assure you that provided physics is not good enough for any serious project..thats why i use Bullet..also, AI should guide/control/check avoidance and distance for NPC's and it shouldnt depend on physics collision, but one set with level. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.