Ejemplo n.º 1
0
//-------------------------- ctor ---------------------------------------------
Raven_Bot::Raven_Bot(Team* team, Raven_Game* world,Vector2D pos):

  MovingEntity(pos,
               script->GetDouble("Bot_Scale"),
               Vector2D(0,0),
               script->GetDouble("Bot_MaxSpeed"),
               Vector2D(1,0),
               script->GetDouble("Bot_Mass"),
               Vector2D(script->GetDouble("Bot_Scale"),script->GetDouble("Bot_Scale")),
               script->GetDouble("Bot_MaxHeadTurnRate"),
               script->GetDouble("Bot_MaxForce")),
                 
				 m_pTeam(team),
                 m_iMaxHealth(script->GetInt("Bot_MaxHealth")),
                 m_iHealth(script->GetInt("Bot_MaxHealth")),
                 m_pPathPlanner(NULL),
                 m_pSteering(NULL),
                 m_pWorld(world),
                 m_pBrain(NULL),
                 m_iNumUpdatesHitPersistant((int)(FrameRate * script->GetDouble("HitFlashTime"))),
                 m_bHit(false),
                 m_iScore(0),
                 m_Status(spawning),
                 m_bPossessed(false),
                 m_dFieldOfView(DegsToRads(script->GetDouble("Bot_FOV")))
           
{
  SetEntityType(type_bot);

  SetUpVertexBuffer();
  
  //a bot starts off facing in the direction it is heading
  m_vFacing = m_vHeading;

  //create the navigation module
  m_pPathPlanner = new Raven_PathPlanner(this);

  //create the steering behavior class
  m_pSteering = new Raven_Steering(world, this);

  //create the regulators
  m_pWeaponSelectionRegulator = new Regulator(script->GetDouble("Bot_WeaponSelectionFrequency"));
  m_pGoalArbitrationRegulator =  new Regulator(script->GetDouble("Bot_GoalAppraisalUpdateFreq"));
  m_pTargetSelectionRegulator = new Regulator(script->GetDouble("Bot_TargetingUpdateFreq"));
  m_pTriggerTestRegulator = new Regulator(script->GetDouble("Bot_TriggerUpdateFreq"));
  m_pVisionUpdateRegulator = new Regulator(script->GetDouble("Bot_VisionUpdateFreq"));

  //create the goal queue
  m_pBrain = new Goal_Think(this);

  //create the targeting system
  m_pTargSys = new Raven_TargetingSystem(this);

  m_pWeaponSys = new Raven_WeaponSystem(this,
                                        script->GetDouble("Bot_ReactionTime"),
                                        script->GetDouble("Bot_AimAccuracy"),
                                        script->GetDouble("Bot_AimPersistance"));

  m_pSensoryMem = new Raven_SensoryMemory(this, script->GetDouble("Bot_MemorySpan"));
}
Ejemplo n.º 2
0
FalconGameEntity::FalconGameEntity(VU_BYTE** stream, long *rem) : VuGameEntity (0,"VuGame")
{
	VU_ID			sessionid(0, 0);
	VuSessionEntity *session;
	uchar			size;

	// VuEntity part
	memcpychk(&share_.entityType_, stream, sizeof(share_.entityType_), rem);
	memcpychk(&share_.flags_, stream, sizeof(share_.flags_), rem);
	memcpychk(&share_.id_.creator_, stream, sizeof(share_.id_.creator_), rem);
	memcpychk(&share_.id_.num_, stream, sizeof(share_.id_.num_), rem);

	SetEntityType(share_.entityType_);

	VuSessionFilter filter(Id());
	sessionCollection_ = new VuOrderedList(&filter);
	sessionCollection_->Register();

	// VuTarget part
	memcpychk(&share_.ownerId_.creator_, stream, sizeof(share_.ownerId_.creator_), rem);
	memcpychk(&share_.ownerId_.num_, stream, sizeof(share_.ownerId_.num_), rem);
	memcpychk(&share_.assoc_.creator_, stream, sizeof(share_.assoc_.creator_), rem);
	memcpychk(&share_.assoc_.num_, stream, sizeof(share_.assoc_.num_), rem);
	memset(&bestEffortComms_, 0, sizeof(VuCommsContext));
	bestEffortComms_.status_ = VU_CONN_INACTIVE;
	memset(&reliableComms_, 0, sizeof(VuCommsContext));
	reliableComms_.status_ = VU_CONN_INACTIVE;
	reliableComms_.reliable_ = TRUE;

	// vuGroupEntity part
	memcpychk(&sessionMax_, stream, sizeof(ushort), rem);
	short count = 0;
	memcpychk(&count, stream, sizeof(short), rem);
	for (int i = 0; i < count; i++) 
	{
		memcpychk(&sessionid, stream, sizeof(VU_ID), rem);
		if (sessionid == vuLocalSession)
			selfIndex_ = i;
		session = (VuSessionEntity *)vuDatabase->Find(sessionid);
		if (session)
		{
			sessionCollection_->Insert(session);
		}
		//	    AddSession(sessionid);
	}

	memcpychk (&domainMask_, stream, sizeof(ulong), rem);
	memcpychk (&gameType, stream, sizeof (FalconGameType), rem);
	memcpychk (&rules,	stream, sizeof (class RulesClass), rem);
	memcpychk (&size, stream, sizeof (uchar), rem);
	gameName_ = new char[size+1];
	memcpychk (gameName_, stream, sizeof(char)*size, rem);
	gameName_[size]=0;
}
Ejemplo n.º 3
0
// constructors & destructor
FalconGameEntity::FalconGameEntity(ulong domainMask, char *gameName) : VuGameEntity(domainMask, gameName)
{
	gameType = game_PlayerPool;
	// KCK: To keep this from conflicting with entities we plan to load, force
	// the creater to something non-zero for single player games.
	if (!share_.id_.creator_){
		share_.id_.creator_ = 1;
		// Make a new collection with a filter to match
		VuSessionFilter filter(Id());
		sessionCollection_->Unregister();
		delete sessionCollection_;
		sessionCollection_ = new VuOrderedList(&filter);
		sessionCollection_->Register();
	}
	SetEntityType((unsigned short)(F4GameType+VU_LAST_ENTITY_TYPE));
}
Ejemplo n.º 4
0
BolaEntity::BolaEntity():BaseGameEntity( 
	BaseGameEntity::GetNextValidID() ),
	mFSM(this)

	//da problemas ese mFSM (this)
{
	Bola_ID = ID();
	SetEntityType( Bola_TYPE );

	mBola = d3dcore->Resource_Load( L"img\\alienship.png" );
	
	
	//Use antes un random, pero salían dos naves cada vez.

	if(d3dcore->Random_Float(0.0f,10.0f)<5.0f)
	{
		mBolaDir.x=1.0f;
		mBolaDir.y=1.0f;
	}else
	{
		mBolaDir.x=-1.0f;
		mBolaDir.y=1.0f;
	}
		
	
	//mPos = getPosicion;
	
	std::vector<BaseGameEntity*>& Barras = EntityManager::Instance()->GetType( Barra_TYPE );
	
	mBolaPos = D3DXVECTOR3( ((BolaEntity *)Barras[0])->getBolaPos().x, ((BolaEntity *)Barras[0])->getBolaPos().y,0.1f);
	
	mBolaSpeed = 150.0f;
	mBolaRadio = 20.0f;

	BolaSprite.pTexture = mBola;
	BolaSprite.TexCoord.x = 0;
	BolaSprite.TexCoord.y = 0;
	BolaSprite.TexSize.x = 1.0f;
	BolaSprite.TexSize.y = 1.0f;
	BolaSprite.TextureIndex = 0;
	BolaSprite.ColorModulate = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);

	mFSM.SetCurrentState(NormalMov::Instance());
	// estados de la entidad. La pelota por ejemplo, si conseguimos una poción, iría al doble de su velocidad... por ejemplo
}
Ejemplo n.º 5
0
//-------------------------- ctor ---------------------------------------------
ET_Bot::ET_Bot(Raven_Game* world,Vector2D pos): AbstRaven_Bot(world, pos)       
{
	m_pScript = ET_BotScriptor::Instance();
	
	SetEntityType(type_bot);

  SetUpVertexBuffer();
  
  //a bot starts off facing in the direction it is heading
  m_vFacing = m_vHeading;

  //create the navigation module
  m_pPathPlanner = new Raven_PathPlanner(this);

  //create the steering behavior class
  m_pSteering = new ET_BotSteering(world, this);

  //create the regulators
  m_pWeaponSelectionRegulator = new Regulator(m_pScript->GetDouble("Bot_WeaponSelectionFrequency"));
  m_pGoalArbitrationRegulator =  new Regulator(m_pScript->GetDouble("Bot_GoalAppraisalUpdateFreq"));
  m_pTargetSelectionRegulator = new Regulator(m_pScript->GetDouble("Bot_TargetingUpdateFreq"));
  m_pTriggerTestRegulator = new Regulator(script->GetDouble("Bot_TriggerUpdateFreq"));
  m_pVisionUpdateRegulator = new Regulator(m_pScript->GetDouble("Bot_VisionUpdateFreq"));

  //create the goal queue
  m_pBrain = new ETGoal_Think(this);

  //create the targeting system
  m_pTargSys = new ET_TargetingSystem(this);

  m_pWeaponSys = new Raven_WeaponSystem(this,
                                        script->GetDouble("Bot_ReactionTime"),
                                        script->GetDouble("Bot_AimAccuracy"),
                                        m_pScript->GetDouble("Bot_AimPersistance"));

  m_pSensoryMem = new Raven_SensoryMemory(this, m_pScript->GetDouble("Bot_MemorySpan"));
}