Development:Misc Engine Work

From VsWiki
Jump to: navigation, search


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
   	Optionally set if you want to return on first contact or not.
   	It defaults to not.
   	The rest of the calls occur in your physics loops
   	Reset our list of collided pairs of vectors.
   	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.
   	We also need the number of collided vectors in case we don't have
   	first hit set to true.
  • Features :
 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.

Add more