3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1] 2 3

Author Topic: ok need to find the bottle-neck...  (Read 5975 times)

« on: July 06, 2010, 10:16:35 PM »
ok a few things I need help understanding...(for those who will say optimize etc... I have, believe me as much as possible)

firstly starting with physx v7.0b of Rad.

ok I just noticed that I made a project with 38 car (shadows off and no collisions except with the environment) objects and 1 terrain and 1 gravity object. and runs at the same performance whether i enable (hw) or leave it at (sw) modes. but if i add any extra cars frame rate drops 2fps for every extra car. so is that meant to happen as I thought there would be a big benefit other than stability which is obviously improved. but (sw) and (hw) seem to be identicle on my system. so curious as to why that is...

secondly...

I just made an addon that is basically ejects bullet shells from a location (skinmesh master location).

the source contains 25 rigid body's(each is just a single sphere).each rigid body has it's own force and gravity object attached to it(now these bodies need to have their own for and and gravity as explained in a second), and a master skinmesh for the visual bullet shells from which imposters are made from but by default there is 25 imposter representing the rb's and 25 imposters for when the rb speed is less than x it moves the rb out of the way and places a free imposter at that location so that the rigid body's can be used again and again to eject a visual bullet shell from a weapon. when each rigid body is finnished falling to the ground itmoves to some location out of the game area and forces are stopped as is gravity and velocity and spin are set to zero.

that that in a nutshell and it works brilliantly. however...

after I add this addon to my project it runs fine but I need more than one of these and as soon as I add the second one, 3drad fps is zero and never updates and in the editor it drains to about 15-20 fps.

now in this scenaria I wonder what the bottle neck is. I was thinking maybe it was that I have a gravity and a force object for each rigid body and maybe there are too many internal check or something but that sort of defeats the purpose of useing the objects as to me they are just 3impacts iBodyAccelerationApply() function made easier to use. if that is the bottle neck is it possible to add this function to the script to save haveing to link all the force object but only if it is and if it would be faster.

I thought maybe collision couples but each rb has one collision and that is with the ground not eachother. but surely 3drad can handle 50 collisions going on at once with the same singular .ply rb (sphere to ply). and I'm sure I've had many more rb in 3Impact that only collided with the ground when not with eachother.

in my project before I import the addon have a 150 objects in total:

26 x scipts of average length nothing over the top.
1  x sunlight
56 x skinmeshes (no shadows)
33 x rb (5 are .ply's)
2 x camera( 1 is always disabled)
2 x exit fades
1 x text print
4 x gravity
4 x force
10 x joints
12 x groups (used as deviders not linked to anything)

so I'm adding an extra 80 objects behind the scenes with each bullet shell addon with 4 objects exposed in total (2xscripts,1x skinmesh and a .ply rigid body)

so although 80 object may sound like alot in 3Impact that wouldn't be much as 50 of those are force and gravity objects 25 are rigid bodies, 1 skinmesh and 3scripts in total.

for a grand total of 310 objects in the project.

an alternative example is if I have a project with just 4 of the same bullet shell ejection addons the project runs at about 15 fps i the editor. for a total of 320 object.


so in sumation(really sorry about this being so long but I had to explain myself properly) whether the objects are simple or complicated about 320 on my system irespective of the new physx system being implemented will no allow more objects than this to be added.

is there anything that can be done to allow for less internal check or more objects. would a 3drad version of 3Impacts iBodyAccelerationApply() be faster from a script than useing force and gravity objects?

so compareing with physx (which looks like it will be limited by 3drads limits)
each car would be made of 5 RB's, 4 wheel joints an force object * 38 is 380 + 1 gravity and 1 terrain. note: cars have no shadows or collision with eachother so without those things there would be a scaled reduction to around 300 objects aswell).

as the only way to add rigid bodies is one at a time so the list gets filled up fast if you just need an array of simple spheres to not collide with eacchother but to simulate falling for other objects etc.

so I guess I'm asking, can you see a bottle neck Fernando with the above information and can anything be done to increase performance? as I have had a version of this project done in 3Impact and it ran fine and although better optimised now and useing 3drad. I can't go back to 3Impact as it lacks the functionality that is in Rad and I was really hopeing to not have to cut alot of bling that can be done in 3Impact. if not I'll just have to work within these limitations but maybe I'm not understanding something.

thanks for any feedback on this :)



using 3Drad 7.22

system specs:
Windows 7 Home Premium 64-bit
Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz (4 CPUs), ~3.2Ghz
8 gig ram
Geforce GTX 650 1024 MB GDDR5
DirectX 11

jestermon

« Reply #1 on: July 06, 2010, 10:58:16 PM »
I know this is not the answer you are looking for, but if you remove RB's from the shell (since they are not critical to the game, and merely eye-candy), and use only  the imposters  that either follow a "eject-shell" paths, or do some other sort of motion sequence, you will be getting rid of a lot of collision detection and forces. This will really have an impact if you are duplicating options. As far as optimizing goes, this single step may help along the way..
my 2c
« Last Edit: July 06, 2010, 11:03:03 PM by jestermon »
« Reply #2 on: July 06, 2010, 11:54:39 PM »
thanks Jestermon, that is my fallback plan or go back to 3Impact which won't be so bad I guess, I can make it work if i have to there and stick to my christmass deadline as opposed to nailing another engine to skull before this game is released as I'd only really be missing a few bug fixes and all the imposter functionality that 3drad has and have instant access to 3impact postprecess etc...though would miss Rad.

the main issue here also is that with physx implemented the same scenario will arise once the object list is full (based on any users dev system of coarse and mine is around 300 objects in the list). so if I wanted to make physx based particles that could be interacted with it woulndt be possible even if physx could handle it no problem.

I'm guessing the only way around things like this, for the user side of things, would be a rigid body array object, a single rigidbody object that will allow for an array of x amounts of the same rb to be created under the one handle and all bodies under that array have the same properties(i.e. if the parent has collision with the ground then all others in the array would have the same(except not with eachother unless specified) and maybe rather than have an in/out from the rb array expose the body functions to the script that allow to control speed velocity etc... if it would be faster that way I'm not sure about that lower level stuff but it would free up the list for less checks and then this object would only be beneficial if it actually did take alot of the load off the engine/editor so I wouldn't know if something like this would be the best way to go about it.

just thinking outloud :-\
using 3Drad 7.22

system specs:
Windows 7 Home Premium 64-bit
Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz (4 CPUs), ~3.2Ghz
8 gig ram
Geforce GTX 650 1024 MB GDDR5
DirectX 11

psikotropico

« Reply #3 on: July 07, 2010, 12:27:41 AM »
that remembers me some abandoned projects I have in my HD... welcome to the club, man...

300 objects are too many objects for a 3dRad project... how long are the loading times? also, your specs are over the average... just figure anyone with less processors, ram and a crappy graphic card trying to run your game... Better if you find a way to having less objects in your level... probably you will need to forget some cool features of your game...

I'm spending more time trying to reduce the number of objects in my project than making it... don't give up yourself!

jestermon

« Reply #4 on: July 07, 2010, 01:14:07 AM »
......just thinking outloud :-\
One of the drawbacks of using a Visual type game engine like Rad, and others, is that most of the functionality is encapsulated, and can only be extended by scripts (graphic and engine specifics.. dll's cant go there)..
The advantage of c/c++ engines is that you have complete control, even beyond the engine itself, because the engine is merely a tool you can extend. Also of course the speed is mega-times faster than with scripting...It's always a trade off..
The problem that you have here is Fernando... Seriously.. The genius gives us stuff in Rad that will take us forever to replicate.. So we get addicted to the power in it's simplicity, and are pretty reluctant to move out of this comfort zone... But sometimes we have to, in order to do things beyond what a visual engine can offer.
You really only have two options.. Scale down or go full speed...

Edit: Sometimes I harp a little too much on finding the limits of a game engine, but it by doing this, that one can plan a game well, and define a type of game to function optimally within those limits :))
« Last Edit: July 07, 2010, 01:27:48 AM by jestermon »
« Reply #5 on: July 07, 2010, 01:37:32 AM »
I do agree with what you are saying psikoT, but...

rb's are fast to load and behind the scenes forces are easy to manage with a few lines of code and it would save the list being full so a rigid body array object, with body functions exposed in a script,would free the list for other objects, although I understand there are many complicated things in a tool like rad that don't always make these things easy.

the only real load time bottle neck I've seen is when not useing .dds textures as the engine has to make the mipmaps as they can be built into .dds textures.
not useing free textures as my object share different coords on the same texture so less textures being loaded.
and large skinmeshes.

so my project takes 10 seconds to load in the editor with all these optimisations though this can be quicker in some circumstances.

also my game is going to be geforce 8 series minimum. I was going to allow for shader model 2 cards but because of the game I'm making higher system specs will be required as most poeple with series 8+ cards have around the same specs as me.

at worst case scenario I'll see what I can do as far as faking stuff and weigh the pro's and cons and then make a decision if nothing much can be done. so I'm not giving up  :) but I have to see what's best for the game in general as there are a few other things like this I needed to implement aswell but thanks for the feedback.

@jestermon,  :) yeah I agree Rad has made me very lazy  ;D, I agree with your points aswell and it's going to be hard choice but I'll put on my thinking cap, and see what I can come up with and if i can fake what I need while making it look as good as physics I might be able to live with it.
using 3Drad 7.22

system specs:
Windows 7 Home Premium 64-bit
Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz (4 CPUs), ~3.2Ghz
8 gig ram
Geforce GTX 650 1024 MB GDDR5
DirectX 11
« Reply #6 on: July 07, 2010, 01:42:32 AM »
Quote
the main issue here also is that with physx implemented the same scenario will arise once the object list is full (based on any users dev system of coarse and mine is around 300 objects

Perhaps a comment from you on this, Fernando ?
AKA: The 3D Raddict http://www.3draddict.com/
« Reply #7 on: July 07, 2010, 02:46:50 AM »
Thanx for the report genetransfer!

Regarding v7 (sw) vs (hw) performance, in my tests, I always noticed a substantial difference. How exactly did you run the test? Was it on the same machine?

Regarding the bottleneck in your project, it's very hard to say without a thorough analysis of the project, but the total number of objects may be involved.

You should try changing the design a little and see what produces a noticeable performance improvement. For example, just as a test, you can try removing all force objects, just to see if that is the problem.

Another test could be reducing somehow the amount of collision checking (unlink all RBs), again just to see if that is the problem.

Once you know what the problem is, a solution will be easier to find.

Regarding 3drad versus writing your game in C++ (or C# or anything else) directly, based on my experience, if you implement exactly the same project with exactly the same functionality in C++ and 3drad, you will find that performance is almost identical.

This is because there no way to speedup collision detection, for example, if the collision detection engine you use behind the scenes is the same.

The same is true for the rendering engine. If both systems use DirectX and the same shaders and the same 3d models with the same textures, and the same view, rendering speed will be the same for both the C++ version and the 3drad version.

The only big difference is the time you took to develop the project in C++ versus 3drad  ;)

Of course its true that when working in C++ you have practically no limits in the kind of optimization you can do, for your specific project, because the flexibility you have with C++ is maximum.

Still, 3drad provides excellent flexibility as well and, if you know how things work behind the scenes, you can always find ways to achieve excellent optimization.

One thing to keep in mind however is that, no matter the development tools you are using, optimization of your projects (usually the very final step of development) is something that you can't do overnight. In some cases, it is as important as 20-30% of the whole development effort!
« Reply #8 on: July 07, 2010, 03:01:38 AM »
I dont know how the collision checking actually works,
but would it be any faster if:

For example:
You have scene with 100 boxes, sized 1m (all can collide eachother).

loop:
- Get distance from box1 to box2
-- If distance < 2m then: do actual collision check between box1 & box2
<repeat for all objects..

would it be any faster to check distance (and see if we are even close to hit),
than doing "full" collision check all the time..?
http://3dradder.blogspot.com/ <- Stuff 4 3DRad   | *Donate now: Post-prosessing shaders | External Script editor mEH*
« Reply #9 on: July 07, 2010, 03:49:16 AM »
Fernando, since performance optimisation is such a key area, would it not be useful to have a seperate forum section dedicated to it so that optimisation topics are all in one area and easy browse and discuss.
« Reply #10 on: July 07, 2010, 04:02:05 AM »
thanks Fernando.

on v7 it is on the same machine and I used nvidia control panel to disable physx. and achieved identicle results. though this is still a massive improvement over ODE, but I just thought there would be a difference between (sw) and (hw) mode.

as for collision detection in my project the only active body is the movement body until ragdoll is triggered and then that is only 11 bodies. and when the bullet shell ejection addon I made is in the project out those 25 bodies only half are in contact with the gound at any one time before being moved out of the game area it does run fine with one but if i add another bullet shell ejection addon frame rate start to crawl.

this project is almost identicle(only more optimised)to my 3Impact conterpart which ran at 60 fps and that was when my machine was a p4 with 6200gt card
VERY old video here and here(all ragdolls are active at all times) and here.as you see despite being ODE 3Impact can achieve what I'm wanting but 3DRad isn't designed for this kind of volume unless I guess it is made as a single object I guess.

and none of what I said is to detract from Rad at all, it is awsomeness it many areas and has really help me shape up my game in all aspects of development and will always be a tool I use to prototype with if I go back to 3Impact for this game.

anyway thanks very much Fernando!
using 3Drad 7.22

system specs:
Windows 7 Home Premium 64-bit
Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz (4 CPUs), ~3.2Ghz
8 gig ram
Geforce GTX 650 1024 MB GDDR5
DirectX 11
« Reply #11 on: July 07, 2010, 09:02:30 AM »
Fernando, since performance optimisation is such a key area, would it not be useful to have a seperate forum section dedicated to it so that optimisation topics are all in one area and easy browse and discuss.

Yes, done  :)

I have also moved the topic. Should anyone find other posts about optimization, please send me PM so I can move them too.

on v7 it is on the same machine and I used nvidia control panel to disable physx. and achieved identicle results. though this is still a massive improvement over ODE, but I just thought there would be a difference between (sw) and (hw) mode.

Yes there should be a noticeable difference. The only thing I can think of is that, even when you disable hw Physx on your card, somehow it gets switched on when 3D Rad initializes PhysX. If v7 performance is much better that v6 performance, for an identical project, this is certainly the case as PhysX, when in (sw) mode, isn't a lot faster than ODE.


Regarding the bottleneck in your project, if you have a similar project under 3Impact which is faster, it is possible that some particular object, present in multiple instances in your project, isn't fully optimized.

You should be able to confirm this by removing, just for test purposes, some objects and try to identify what is the object type that, when present in multiple instances, is causing the slowdown.

Not all objects affect performance when present in multiple instances, and not all affect it the same way. Knowing what object type is to blame, may allow me to see if some further optimization is possible.

Anyhow, thanx again for posting about these issues genetransfer!

psikotropico

« Reply #12 on: July 07, 2010, 12:42:25 PM »
I have also moved the topic. Should anyone find other posts about optimization, please send me PM so I can move them too.

http://www.3drad.com/forum/index.php?topic=3853.0
« Reply #13 on: July 07, 2010, 03:58:43 PM »
moved, thanx psikoT!

jestermon

« Reply #14 on: July 07, 2010, 06:33:14 PM »
:)
« Last Edit: July 07, 2010, 08:36:15 PM by jestermon »
Pages: [1] 2 3