About Store Forum Documentation Contact
Donations:
140$/mo



Post Reply 
Ctrl.update() performance
Author Message
Zervox Offline
Member

Post: #1
Ctrl.update() performance
I have noticed an issue with ctrl.update in the case if multiple objects share the same location.
350 objects;
86 fps when everyone is standing still.


Code:
ctrl.actor.vel(wish*desiredSpeed());
moving from separate locations.
66 FPS and increasing as more and more object is reaching destination.

When every object is moving from the same spot to another spot
60 FPS

Code:
ctrl.update((wish*desiredSpeed()), crouched, 0);
moving from separate locations.
40 FPS and drastically dropping when some objects on the way starts to share the same pos().

When every object is moving from the same pos() to another spot
6-7 FPS

Now I know there is additional processing done in ctrl.update but it doesn't add up the difference, as the time used in SetMatrixVel function(whatever this is) is exponentially increased for each object in ctrl.update as more and more objects starts to share pos() location.

EDIT:
Not sure if similar processing in ragdoll is done, with ignore group(Physics.ignore(AG_CONTROLLER,AG_RAGDOLL)), the same problem with performance happen as above the EDIT.

Seems ragdolls are awakened even if physics group AG_CONTROLLER and AG_RAGDOLL is supposed to ignore each other.
(This post was last modified: 07-22-2012 12:46 PM by Zervox.)
07-22-2012 05:03 AM
Find all posts by this user Quote this message in a reply
Rollcage Offline
Member

Post: #2
RE: Ctrl.update() performance
I can confirm I can replicate this issue. Moving lots of units using pathfinding from different locations has ~60 fps. Moving all from the same location ~7 fps.

Is there something we can do about this? Is there a setting or is that what Phyics.ignore is meant to do?
07-23-2012 03:47 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Ctrl.update() performance
Hi,

I checked the sample code that you've sent me, but I had following results:
characters stand still 96 fps, characters move at different locations 90 fps, characters move at same location 90 fps

Do you have Nvidia/ATI?
Does Physics is created with hardware acceleration?
Do you manually activate ragdolls? (they shouldn't be created at all until manually activated)

Edit: just tried with physics hardware acceleration disabled, and have the same results of 90 fps when chars are moving all at same location.

Are you performing the tests on the same sample code that you've provided for me?

If all characters are close to the camera then they use more bones for animation
Game::Chr::animateFaceBlend, Game::Chr::animateFingers

SetMatrixVel is internal method for setting matrix and velocity for each character skeleton bone to the GPU

Set D.viewRange(300) in the sample code, and zoom out the camera and look from above on the scene, what's the difference?
07-24-2012 02:14 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #4
RE: Ctrl.update() performance
I use the same code as I've sent you, I've tried zooming out, the FPS drops no matter how far I am away from the camera I can active the code by pressing a key, the more objects you use the more you notice the performance hit.
I can't expect people to use Hardware PhysX because AMD cards doesn't utilize hardware Physx and thus trying to optimize my code for those PC's would be wrong.

I can see the entire area at a distance of 200, when they are moving from one location to another from all separate position they consume 1/3rd to 1/10th randomly.

I have no idea about the ragdolls the way they are activated, but if they are created and is causing this then your code is updating them without me altering any source of it.

and my FPS is different with the exact same situation.

my fps when the 191 objects are moving is this.

140 FPS when all standing still.
when moving from separate location = 98, drops below 90 when many of them are starting to share location on their way to target. when they stop the fps increase slowly to the FPS I had before moving them all, until the last one stops and FPS goes from 130 to 140 just like that.
when moving from same space to another = 61~73, it jumps explicitly around in between the FPS when moving

and it doesn't explain why I am having better performance when moving alot of characters and NOT doing Physics.ignore moving the same amount of objects.

the ragdoll part is just things I've tested with the physics.ignore,
the ragdolls returns sleep == false even with physics.ignore if I move a character ontop of them(they shouldn't do that if they actually gets ignored)
which kinda makes me wonder if the Physics.ignore handling in some struct is broken.
(This post was last modified: 07-24-2012 05:28 PM by Zervox.)
07-24-2012 05:17 PM
Find all posts by this user Quote this message in a reply
Rollcage Offline
Member

Post: #5
RE: Ctrl.update() performance
Esenthel, i can replicate this using the esenthel rts source. I put 1000 human warriors on the map spread out. Fps stays around 60 when moving them. If i group 500 in the same location and send them to a new location fps drops to around 7fps. The same thing happens when 2 groups of units cross eachother on the way to different locations.

Hope this helps
07-25-2012 01:43 AM
Find all posts by this user Quote this message in a reply
Rollcage Offline
Member

Post: #6
RE: Ctrl.update() performance
Did anyone workout what is causing this? The fact that it only occurs in certain situations seems like it could be a bug
07-30-2012 03:17 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Ctrl.update() performance
(07-25-2012 01:43 AM)Rollcage Wrote:  Esenthel, i can replicate this using the esenthel rts source.
RTS is totally a different case, it uses dynamic obstacle avoidance (detects all nearby characters through 'Sector' and calculates the movement direction to avoid them), and doesn't use Actor for Physics
08-05-2012 02:14 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Ctrl.update() performance
Zervox: could you clarify your FPS results?
in 1st post you mention you have 6-7 FPS when moving from same position, and in last post you say you have 61~73 fps when moving from same position.

1) Ragdolls are not created by the engine unless requested, so they don't affect performance (use Physics.draw to see if ragdolls are visible)
2) Pathfinding for Game::Chr is not related to amount of neighbors (nearby obstacles)

If you have slow downs then it may be related to either:

1) physics processing (many actors at same position cause detecting many collisions) this is how PhysX and all other physics engines work, not EE related
2) if you have more charactes close to the camera, they use more bones for animations, Game::Chr::animateFaceBlend, Game::Chr::animateFingers
3) more objects close to camera = more pixels to draw

You can check how long did it took to process physics simulation using Physics.simulationTime
08-05-2012 02:28 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #9
RE: Ctrl.update() performance
FPS is done on separate test, same performance drop is noticed in anycase. it even says so in the first post that the amount of objects are 380, not 191 which was the case of the test files I sent you.

fully aware of when ragdolls are supposed to be created. this was just a statement that ragdolls are being awakened from groups it should be ignoring, making the performance drop like crazy.

my slow down is related to your integration of PhysX.with PhysX itself I've never had issue throwing 1800 objects in a heap consisting of ball,box,convex and capsule all in one nice blend and still having my frames well above 100.



400 capsule actors standing still on one spot, 0-1ms

400 capsule actors moving in the same spot with ignore group(obviously), 18-20ms, using ctrl.actor.vel(wish);

400 capsule actors moving in the same spot with ignore group(obviously), 31-57ms, using your ctrl.update() call,

400 capsule actors moving to one location without ignore group, everyone in one huge lump of objects at final destination, 6-14ms, everyone except some objects in the center has are still moving forcing collision,3-4 objects has gotten inside the target position of the waypoint.ctrl.actor.vel(wish);
using ctrl.actor.vel(wish);

400 capsule actors moving to one location without ignore group, everyone in one huge lump of objects at final destination, 10-24ms, everyone except some objects in the center has are still moving forcing collision,3-4 objects has gotten inside the target position of the waypoint.ctrl.actor.vel(wish);
using your ctrl.update() call

now although your method is alot slower, the other way doesn't react correctly to gravity of course, but it doesn't warrant the time difference.
and the speed of execution is nothing else than terrible.

Now I can't figure out why Controller would add such overhead contra going directly to actor.

in this case.
disabling animation and drawing althogether won't do me any good. easily noticed on the time used in start.stopsimulation.
(This post was last modified: 08-06-2012 09:10 PM by Zervox.)
08-06-2012 09:07 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: Ctrl.update() performance
ctrl.update is not just for setting velocity, but also for detecting collisions between controller and the ground.
08-26-2012 02:18 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #11
RE: Ctrl.update() performance
I don't really notice having any problems with tons of objects colliding with terrain, my problems lies within the interaction of ignored groups, where my performance drops way to low when ignoring groups contra having the same amount of objects colliding and pushing each other.

There is another thing with ragdolls as I've mentioned earlier in the posts here, they get awakened from their sleep even though they are 'ignoring' collision with AG_CONTROLLER, from what I would presume, this should not happen,else what is the point of doing ignore.
(This post was last modified: 09-01-2012 08:49 PM by Zervox.)
09-01-2012 06:21 PM
Find all posts by this user Quote this message in a reply
Post Reply