Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solution is actually accepting that there are limits on how far you can optimize.</p> <p>Solving the gap problem will only cause the following to be introduced:</p> <ul> <li>If statements (branches) to handle the data exceptions (entities which are missing component).</li> <li>Introducing holes meaning you may as well iterate lists randomly. The power of DoD is that all data is tightly packed and ordered in the way it will be processed.</li> </ul> <p>What you may want to do:</p> <p>Create different lists optimized for different systems / cases. Every frame: copy the properties from one system to another system only for the entities that require it (which have that specific component).</p> <p>Having the following simplified lists and their attributes:</p> <ul> <li><strong>rigidbody</strong> (force, velocity, transform)</li> <li><strong>collision</strong> (boundingbox, transform)</li> <li><strong>drawable</strong> (texture_id, shader_id, transform)</li> <li><strong>rigidbody_to_collision</strong> (rigidbody_index, collision_index)</li> <li><strong>collision_to_rigidbody</strong> (collision_index, rigidbody_index)</li> <li><strong>rigidbody_to_drawable</strong> (rigidbody_index, drawable_index)</li> </ul> <p>etc...</p> <p>For the processes / jobs you may want the following:</p> <ul> <li><strong>RigidbodyApplyForces(...)</strong>, apply forces (ex. gravity) to velocities</li> <li><strong>RigidbodyIntegrate(...)</strong>, apply velocities to transforms.</li> <li><strong>RigidbodyToCollision(...)</strong>, copy rigidbody transforms to collision transforms only for entities that have the collision component. The "rigidbody_to_collision" list contains the indices of which rigidbody ID should be copied to which collision ID. This keeps the collision list tightly packed.</li> <li><strong>RigidbodyToDrawable(...)</strong>, copy rigidbody transforms to drawable transforms for entities that have the draw component. The "rigidbody_to_drawable" list contains the indices of which rigidbody ID should be copied to which drawable ID. This keeps the drawabkl list tightly packed.</li> <li><strong>CollisionUpdateBoundingBoxes(...)</strong>, update bounding boxes using new transforms.</li> <li><strong>CollisionRecalculateHashgrid(...)</strong>, update hashgrid using bounding boxes. You may want to execute this divided over several frames to distribute load.</li> <li><strong>CollisionBroadphaseResolve(...)</strong>, calculate possible collisions using hashgrid etc....</li> <li><strong>CollisionMidphaseResolve(...)</strong>, calculate collision using bounding boxes for broadphase etc....</li> <li><strong>CollisionNarrowphaseResolve(...)</strong>, calculate collision using polygons from midphase etc....</li> <li><strong>CollisionToRigidbody(...)</strong>, add reactive forces of colliding objects to rigidbody forces. The "collision_to_rigidbody" list contains the indices from which collision ID the force should be added to which rigidbody ID. You may also create another list called "reactive_forces_to_be_added". You can use that to delay the addition of the forces.</li> <li><strong>RenderDrawable(...)</strong>, render the drawables to screen (renderer is just simplified).</li> </ul> <p>Of course you'll need a lot more processes / jobs. You probably want to occlude and sort the drawables, add a transform graph system between the physics and drawables (see Sony presentation about how you may do this) etc. The execution of the jobs can be executed distributed over multiple cores. This is very easy when everything is just a list as they can be divided into multiple lists.</p> <p>When an entity is being created the component data will also be created together and stored in the same order. Meaning the lists will stay mostly in the same order.</p> <p>In the case of the "copy object to object" processes. If the skipping of holes really <em>is</em> becoming a problem you can always create a "reorder objects" process which will at the end of every frame, distributed over multiple frames, reorder objects into the most optimal order. The order which requires the least skipping of holes. The skipping of holes is the price to pay to keep all lists as tightly packed as possible and also allows it to be ordered in the way it is going to be processed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload