Jump to content

How to work with many units?


Aily
 Share

Recommended Posts

Big scene :)

 

I have scene with ~1000 dynamic units (trees, buildings, enemies, etc...), each of it at destruction breack to 5-10 parts. Each part is automaticaly disapear after 5-10 seconds. Each part have their body (simple cube).

 

Wat way is the best to store such scene at gameplay?

 

For example building, when it in IDLE state, it have one mesh and one body for collisions. At destroy it breacking on 5 parts, that fall around it by physics. Each part have their own body - box.

 

Issue 1: Store one collection of 5 parts of building in memory, and at destroy any building create "on-the-fly" parts as copyentity() for each, creating body, attaching, and setting position at current destructing building (it's my case now, and here some bug)

 

Issue 2: At each of 1000 units create at loading tyme by same as 1 issue, but hide it, and on destruction building just show it, set all parts bodies mass and add force to them?

 

Does 2 issue can much slowdown CPU? It's because ~1000*5 = 5000 hidden units in scene, and 1000 visible at run time.

"Better" is big enemy of "good"

Link to comment
Share on other sites

I currently use your second method, that is I load all the parts and hide them then position, apply atributes and show them at the point of the expolosion/destruction so I can apply the forces to them. This works fine for me but I'm not using 1000s of destructible objects. Probably the most I have tried at any one time is 80. As I only have so many varients on destructible models there is a lot of instancing going on so I don't imagine the hit is that great. I guess you'll just have to experiment unless someone else can give you feedback on doing this with that number of objects.

 

I do sometimes have issues with instability in the physics when lots of exploding objects interact with each other, as all my exploding objects propgate their forces to items within a given radius and will cause them to explode too. It can result in a lot of random jittery movement of parts long after they should have stopped moving. I intend at some point to modify the way I apply forces as I think this may be contributing to this. Removing these part objects, as you do, might be a solution too as mine remain as dynamic debris after the destruction.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...