Difference between revisions of "Development:Misc Engine Work"
(→Collider) |
m (sp) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 16: | Line 16: | ||
* API : | * API : | ||
− | + | This is a rough outline. | |
+ | |||
+ | The next two functions get executed once usually when the unit is created. | ||
+ | |||
+ | Create an instance of the collider sending it the appropriate geometry | ||
+ | csOPCODECollider(vector<bsp_polygon>); | ||
+ | |||
+ | Optionally set if you want to return on first contact or not. | ||
+ | It defaults to not. | ||
+ | csOPCODECollider.SetOneHitOnly(bool); | ||
+ | |||
+ | The rest of the calls occur in your physics loops | ||
+ | |||
+ | Reset our list of collided pairs of vectors. | ||
+ | csOPCODECollider.ResetCollisionPairs(); | ||
+ | |||
+ | Check if a collision occurred, sending the other collider and transforms for | ||
+ | both colliders. Returns true if we collided. | ||
+ | csOPCODECollider.Collide(csOPCODECollider&, const csReversibleTransform* first, | ||
+ | const csReversibleTransform* second); | ||
+ | |||
+ | If true, retrieve the vectors that collided so we can act upon them. | ||
+ | csOPCODECollider.GetCollisions(); | ||
+ | |||
+ | We also need the number of collided vectors in case we don't have | ||
+ | first hit set to true. | ||
+ | csOPCodeCollider.GetCollisionPairCount(); | ||
* Features : | * Features : | ||
Line 23: | Line 49: | ||
* Limitations : | * Limitations : | ||
− | We currently only deal with triangular | + | We currently only deal with triangular geometry, no sphere or planar geometry. |
We currently only implement the TreeCollider, though Ray Collider is slated for inclusion too. | We currently only implement the TreeCollider, though Ray Collider is slated for inclusion too. | ||
* Status of Development : | * Status of Development : | ||
− | Currently compiles and links with VS using the TreeCollider. | + | Currently compiles and links with VS using the TreeCollider. |
+ | As of 2-11-2008 opcode will be used by default in svn | ||
* ToDo : | * ToDo : | ||
− | + | Make tree collider bug free | |
Implement the Ray Collider | Implement the Ray Collider | ||
Optimize tree type if possible/needed. | Optimize tree type if possible/needed. | ||
Line 68: | Line 95: | ||
GameUnit templates unit types. It inherits nothing. | GameUnit templates unit types. It inherits nothing. | ||
− | GameUnit wraps all public access to | + | GameUnit wraps all public access to its type with its own methods. |
* Intended purpose: | * Intended purpose: | ||
− | To reduce the complexity of Unit and remove | + | To reduce the complexity of Unit and remove unnecessary bloat. |
* Status : | * Status : |
Latest revision as of 13:04, 2 July 2010
Collider
Informational and ongoing development of the collider system.
- Source location : src/cmd/collide2
- Collider engine : OPCODE 1.3 from crystalspace 3d 1.2
- Colliders Supported : AABB Tree collider, Ray Collider
- Geometry Supported : Meshes should be triangles
If we eventually become an OGRE user, there is OgreOPCODE
libODE also allows access to OPCODE. and Bullet.
These API's are different from crystalspace3d, of which we're currently based from.
- API :
This is a rough outline.
The next two functions get executed once usually when the unit is created. Create an instance of the collider sending it the appropriate geometry csOPCODECollider(vector<bsp_polygon>); Optionally set if you want to return on first contact or not. It defaults to not. csOPCODECollider.SetOneHitOnly(bool); The rest of the calls occur in your physics loops Reset our list of collided pairs of vectors. csOPCODECollider.ResetCollisionPairs(); Check if a collision occurred, sending the other collider and transforms for both colliders. Returns true if we collided. csOPCODECollider.Collide(csOPCODECollider&, const csReversibleTransform* first, const csReversibleTransform* second); If true, retrieve the vectors that collided so we can act upon them. csOPCODECollider.GetCollisions(); We also need the number of collided vectors in case we don't have first hit set to true. csOPCodeCollider.GetCollisionPairCount();
- Features :
http://www.codercorner.com/Opcode.htm Suffice it to say that OPCODE allows for vastly smaller memory footprint and better performance than RAPID
- Limitations :
We currently only deal with triangular geometry, no sphere or planar geometry. We currently only implement the TreeCollider, though Ray Collider is slated for inclusion too.
- Status of Development :
Currently compiles and links with VS using the TreeCollider. As of 2-11-2008 opcode will be used by default in svn
- ToDo :
Make tree collider bug free Implement the Ray Collider Optimize tree type if possible/needed. Take advantage of additional features in opcode.
Unit Class
This section involved the intended work to overhaul the unit class to streamline and clean Unit up.
- Source location : src/cmd/unit_generic.h/.cpp
- Intended purpose : unit base class
- Intended structure :
Helper Classes Unit Types AI Weapons Network Graphics ---------------------------------------------------------------- Missiles * * * planets * * asteroids * * nebula * * jump points * * ships * * * * cargo * * Turrets * * * * Heirarchy: Inheritance - Unit -> UnitTypes Templated - GameUnit<UnitTypes>
- API Outline :
Unit is supposed to be the base class for all unit types. Unit can not be initialized independently. It should contain only code that is shared amongst all unit types. It should have methods to wrap around the helper classes that are shared in all units Unit Types inherit unit and include any needed non-unit included helper classes Certain functions can be overloaded where special situations related to a specific type occur GameUnit templates unit types. It inherits nothing. GameUnit wraps all public access to its type with its own methods.
- Intended purpose:
To reduce the complexity of Unit and remove unnecessary bloat.
- Status :
Pre-planning stage.