Proposed 3D Game Objects using the revised LinkedObject struct:
Weapons can be Melee or Projectile,
Weapons own their bullets, and bullets know what weapon fired them.
In turn, a Weapon knows what Player Owns it (or not).
Weapons are collectively Owned by a Player, who has just one ready at any moment,
but can also be Owned by the World, in which case they have NULL Owner.
The Player also can carry lots of Items around in their Tardis-like backpack ;)
The Player can switch weapons and continue firing without issues.
Players themselves are stored in a Linked List collective.
Sound good?

;------------------------------------------------------------------------
;Structure defines a LinkedObject bullet-in-flight (or arrow or missile etc).
;The information for the Projectile's Mesh and Texture are contained
;in the next Structure, the Weapon which fires it (it's Parent).
LinkedProjectileObject STRUCT
LO LinkedObject <> ;Common Header for all objects to be stored in LL's
Position D3DVECTOR3 <> ;Position of Projectile in World
Velocity D3DVECTOR3 <> ;Speed and Direction
Energy FLOAT ? ;Projectile Energy determines its damage
Decay FLOAT ? ;Projectile Velocity and Energy modifier
LinkedProjectileObject ENDS
LPLKPROJECTILE typedef ptr LinkedProjectileObject
;------------------------------------------------------------------------
;Structure defines a LinkedObject Weapon.
;Weapons are Owned by a Player('s Hand), or NULL=Owned by World and free to good home.
;Weapons are either melee or they fire projectiles.
;Projectiles fired by a Weapon are Owned by it.
LinkedWeaponObject STRUCT
LO LinkedObject <> ;Common header for all objects to be stored in LL's
Position D3DVECTOR3 <> ;Position of Object in World if nobody Owns it or Owner's Hand if Readied
Velocity D3DVECTOR3 <> ;Momentum of Object in World if its been thrown etc
aVelocity D3DMATRIX <> ;Angular Rotational momentum of Object in World
Orientation D3DMATRIX <> ;Current Orientation of Object in World
WeaponType DWORD ? ;Melee or Projectile
lpWeaponMesh LPD3DMESH8 ? ;Pointer to DX8 Mesh for Weapon
lpWeaponTex LPD3DTEXTURE8 ? ;Pointer to DX8 Texture for Weapon
lpProjectileMesh LPD3DMESH8 ? ;Pointer to DX8 Mesh for Projectiles if any
lpProjectileTex LPD3DTEXTURE8 ? ;Pointer to DX8 Texture for Projectiles if any
Gravity FLOAT ? ;Gravity applied to projectiles can be NULL
WeaponEnergy FLOAT ? ;Damage from a direct hit (and initial TTL for projectiles)
BlastRadius DWORD ? ;Whether the impact creates a Blast Radius
Ammo DWORD ? ;Unlimited? lol
FiringRate FLOAT ? ;Sanity Check
DecayRate FLOAT ? ;Projectile Energy modifier
lpProjectiles LPLKPROJECTILE ? ;Pointer to one of this Weapon's Projectiles-In-Flight
LinkedWeaponObject ENDS
LPLKWEAPONOBJECT typedef ptr LinkedWeaponObject
;------------------------------------------------------------------------
LinkedPlayerObject STRUCT
LO LinkedObject <> ;Common Header for Objects to be stored in LL's
Position D3DVECTOR3 <> ;Player Position in World
Velocity D3DVECTOR3 <> ;Player Momentum in World
aVelocity D3DMATRIX <> ;Player Angular Rotational momentum in World
Orientation D3DMATRIX <> ;Player Current Orientation in World
lpPlayerMesh LPD3DMESH8 ? ;Pointer to DX8 Mesh for Player
lpPlayerTex LPD3DTEXTURE8 ? ;Pointer to DX8 Texture for Player
Weapon LPLKWEAPONOBJECT ? ;Pointer to one of Player's Weapons in a Linked List
Item LPITEMOBJECT ? ;Pointer to one of Player's Items in Player's Inventory LL
Score DWORD ? ;Player Score
HitPoints FLOAT ? ;Player Health
Armour FLOAT ? ;Player Damage Modifier based on Player's Inventory
LPLKPLAYEROBJECT typedef ptr LinkedPlayerObject
;------------------------------------------------------------------------

I know I've forgotten things.
I just want to hammer out something workable here, thinking in terms of first/third person 3d game engines.
Let's knock out some generic 3d Game objects that use the Linked approach intelligently,
and we can reduce the nonlinear access times and optimize list access through multiple hierarchical lists.
Comments?
Posted on 2002-08-16 08:28:46 by Homer