How to handle Player Objects

Started by
11 comments, last by Shannon Barber 23 years, 1 month ago
  class CWorld	{	//Observation	public:		AddObserver(CWorldObserver*);		RemoveObserver(CWorldObserver*);		//Determines which observers are ''within view''		//& sends the event notification to them		SpamEvent(CWorldEvent*);	private:		std::list<CWorldObserver*,...> m_listObservers;	};class CWorldObserver	{	public:		//Returns whether or not the observer reacted to the event		virtual BOOL EventNotification(CWorldEvent*);	};class CAvatar : public CWorldObserver	{			};  


I know much, but it''s a start
How should the Avatars send events to the World for propegation? I was thinking about making a static CWorld*...

Magmai Kai Holmlor
- The disgruntled & disillusioned
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Advertisement
Well the quickest thing to do would be

class CWorld : public CWorldObserver

Otherwise, if you wanted to use the CWorld as a mediator pattern, then (almost) all of the Avatar''s messages would go through the CWorld to get to the other game objects.
  class IAvatarObserver	{	public:		virtual void AffineMotion(CAvatar*              pAvatar,			                       const D3DXVECTOR3&    v3Position,										  const D3DXQUATERNION& qFacing,										  const D3DXMATRIX&     matAffine)=0;				virtual void StateChange(CAvatar* pEngine, const DWORD dwState)=0;	};class IAvatar	{	public:		virtual ~IAvatar()=0;			//Observation	public:		virtual HRESULT AddObserver(IAvatarObserver* pObserver)=0;		virtual HRESULT RemoveObserver(IAvatarObserver* pObserver)=0;			//Identitification	public:		virtual const GUID& GetID()=0;		virtual const wchar_t* GetName()=0;		virtual const DWORD Hash()=0;			//Movement	public:		virtual void Update(D3DXVECTOR3, D3DXQUATERNION)=0;		virtual BOOL HasMoved()=0;		virtual BOOL HasTurned()=0;				virtual operator D3DXVECTOR3()=0;    //returns current positon (Center)		virtual operator D3DXQUATERNION()=0; //returns current Facing direction		virtual operator D3DXMATRIX()=0;     //return current affine matrix				virtual void MoveAhead (float fElapsed_sec)=0;		virtual void MoveBack  (float fElapsed_sec)=0;		virtual void MoveLeft  (float fElapsed_sec)=0;		virtual void MoveRight (float fElapsed_sec)=0;		virtual void MoveUp    (float fElapsed_sec)=0;		virtual void MoveDown  (float fElapsed_sec)=0;		virtual float SetLinearSpeed(float fSpeed_mps); //returns actual speed				virtual void TurnLeft  (float fElapsed_sec)=0;		virtual void TurnRight (float fElapsed_sec)=0;		virtual void TurnUp    (float fElapsed_sec)=0;		virtual void TurnDown  (float fElapsed_sec)=0;		virtual void RollLeft  (float fElapsed_sec)=0;		virtual void RollRight (float fElapsed_sec)=0;		virtual float SetRotationSpeed(float fSpeed_rps); //returns actual speed		//Physics	public:		//Linear Mechanics		virtual void ApplyForce(D3DXVECTOR3 v3Force_N, float fDuration_sec)=0;		virtual void ApplyImpulse(D3DXVECTOR3 v3Impulse_Ns)=0;		//Rotation Mechanics		virtual void ApplyTorque(D3DXQUATERNION qMoment);				float fMass_kg;		D3DXVECTOR3& v3Velocity_mps;		D3DXVECTOR3& v3Acceleration_mpsps;		D3DXVECTOR3& v3Jerk_mpspsps;				float fRotationalInertia_forgot; //slug*ft²?		D3DXQUATERNION qRotationalVelocity_rps;		D3DXQUATERNION qRotationalAcceleratio_rpsps;		D3DXQUATERNION qRotationalJerk_rpspsps;	};  


Well, I''ve worked on the Avatar a little more, and this is what I have so far. Has anyone done anything with physics yet?

Magmai Kai Holmlor
- The disgruntled & disillusioned
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement