當前位置: 首頁>>代碼示例>>C++>>正文


C++ ObjectManager::Init方法代碼示例

本文整理匯總了C++中ObjectManager::Init方法的典型用法代碼示例。如果您正苦於以下問題:C++ ObjectManager::Init方法的具體用法?C++ ObjectManager::Init怎麽用?C++ ObjectManager::Init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ObjectManager的用法示例。


在下文中一共展示了ObjectManager::Init方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: PlayGameServer

void PlayGameServer()
{
  r3d_assert(gServerLogic.ginfo_.IsValid());
  switch(gServerLogic.ginfo_.mapId) 
  {
    default: 
      r3dError("invalid map id\n");
      break;
    case GBGameInfo::MAPID_Editor_Particles: 
      r3dGameLevel::SetHomeDir("WorkInProgress\\Editor_Particles"); 
      break;
    case GBGameInfo::MAPID_ServerTest:
      r3dGameLevel::SetHomeDir("WorkInProgress\\ServerTest");
      break;
    case GBGameInfo::MAPID_WZ_Colorado: 
      r3dGameLevel::SetHomeDir("WZ_Colorado"); 
      break;
	      case GBGameInfo::MAPID_Laskar: 
      r3dGameLevel::SetHomeDir("Laskar_Village_V2"); 
      break;
	      case GBGameInfo::MAPID_WZ_Cliffside_Farm: 
      r3dGameLevel::SetHomeDir("WZ_Cliffside_Farm"); 
      break;
	      case GBGameInfo::MAPID_WZ_RaccoonCity: 
      r3dGameLevel::SetHomeDir("WZ_RaccoonCity"); 
      break;
	     case GBGameInfo::MAPID_WZ_RaccoonCity_Premium: 
      r3dGameLevel::SetHomeDir("WZ_RaccoonCity_Premium"); 
      break;
	     case GBGameInfo::MAPID_WZ_CARCANFLY: 
      r3dGameLevel::SetHomeDir("WZ_CARCANFLY"); 
      break;
     case GBGameInfo::MAPID_WZ_Cliffside_PVP: 
      r3dGameLevel::SetHomeDir("WZ_Cliffside_PVP"); 
      break;
	  	case GBGameInfo::MAPID_wo_wasteland: 
		r3dGameLevel::SetHomeDir("wo_wasteland"); 
		break;
		case GBGameInfo::MAPID_wo_inferno: 
		r3dGameLevel::SetHomeDir("wo_inferno"); 
		break;
		case GBGameInfo::MAPID_wo_eastern_bunker_tdm: 
		r3dGameLevel::SetHomeDir("wo_eastern_bunker_tdm"); 
		break;
		case GBGameInfo::MAPID_WO_Grozny: 
		r3dGameLevel::SetHomeDir("WO_Grozny"); 
		break;
		case GBGameInfo::MAPID_wo_shippingyard: 
		r3dGameLevel::SetHomeDir("wo_shippingyard"); 
		break;
  }

  r3dResetFrameTime();
  
  GameWorld_Create();

  u_srand(timeGetTime());
  GameWorld().Init(OBJECTMANAGER_MAXOBJECTS, OBJECTMANAGER_MAXSTATICOBJECTS);
  ServerDummyWorld.Init(OBJECTMANAGER_MAXOBJECTS, OBJECTMANAGER_MAXSTATICOBJECTS);
  
  g_pPhysicsWorld = new PhysXWorld;
  g_pPhysicsWorld->Init();

  r3dTerrain::SetNeedShaders( false );
  LoadLevel_Objects( 1.f );

  gCollectionsManager.Init( 0, 1 );

  r3dOutToLog( "NavMesh.Load...\n" );
  gAutodeskNavMesh.Init();

  r3dResetFrameTime();
  GameWorld().Update();
  ServerDummyWorld.Update();

  r3dOutToLog("Spawning Vehicles... Count:%d\n",GameWorld().spawncar);
  gServerLogic.SpawnNewCar();

  r3dGameLevel::SetStartGameTime(r3dGetTime());
  
  r3dOutToLog("server main loop started\n");
  r3dResetFrameTime();
  gServerLogic.OnGameStart();
  
  gKeepAliveReporter.SetStarted(true);
  
  while(1) 
  {
    ::Sleep(20);		// limit to 100 FPS
    
    r3dEndFrame();
    r3dStartFrame();
    
    //if(GetAsyncKeyState(VK_F1)&0x8000) r3dError("r3dError test");
    //if(GetAsyncKeyState(VK_F2)&0x8000) r3d_assert(false && "r3d_Assert test");
    gKeepAliveReporter.Tick(gServerLogic.curPlayers_);

    gServerLogic.Tick();
    gMasterServerLogic.Tick();
    
//.........這裏部分代碼省略.........
開發者ID:Mateuus,項目名稱:devsrc,代碼行數:101,代碼來源:ServerGame.cpp

示例2: PlayGameServer

/*static unsigned int WINAPI NetworkThread( void * param )
{
	while(1)
	{
	::Sleep(1);
	gServerLogic.net_->Update();
	}
}*/
void PlayGameServer()
{
  r3d_assert(gServerLogic.ginfo_.IsValid());
  switch(gServerLogic.ginfo_.mapId) 
  {
    default: 
      r3dError("invalid map id\n");
      break;
    case GBGameInfo::MAPID_Editor_Particles: 
      r3dGameLevel::SetHomeDir("WorkInProgress\\Editor_Particles"); 
      break;
    case GBGameInfo::MAPID_ServerTest:
      r3dGameLevel::SetHomeDir("WorkInProgress\\ServerTest");
      break;
    case GBGameInfo::MAPID_WZ_Colorado:
      r3dGameLevel::SetHomeDir("WZ_Colorado");
      break;
	case GBGameInfo::MAPID_UB_Cliffside:
      r3dGameLevel::SetHomeDir("WZ_Cliffside");
      break;
    case GBGameInfo::MAPID_UB_CaliWood:
      r3dGameLevel::SetHomeDir("CaliWood");
      break;
    case GBGameInfo::MAPID_UB_Valley:
      r3dGameLevel::SetHomeDir("UB_Valley");
      break;
    case GBGameInfo::MAPID_UB_Area51:
      r3dGameLevel::SetHomeDir("UB_Deserto");
      break;
	case GBGameInfo::MAPID_UB_CryZ:
      r3dGameLevel::SetHomeDir("UB_CryZ");
      break;
  	case GBGameInfo::MAPID_UB_Terra:
      r3dGameLevel::SetHomeDir("UB_Terra");
      break;
  	case GBGameInfo::MAPID_UB_Mega:
      r3dGameLevel::SetHomeDir("UB_Mega");
      break;
  }

  r3dResetFrameTime();
  
  GameWorld_Create();

  u_srand(timeGetTime());
  GameWorld().Init(OBJECTMANAGER_MAXOBJECTS, OBJECTMANAGER_MAXSTATICOBJECTS);
  ServerDummyWorld.Init(OBJECTMANAGER_MAXOBJECTS, OBJECTMANAGER_MAXSTATICOBJECTS);
  
  g_pPhysicsWorld = new PhysXWorld;
  g_pPhysicsWorld->Init();

  r3dTerrain::SetNeedShaders( false );
  LoadLevel_Objects( 1.f );

  gCollectionsManager.Init( 0, 1 );

  r3dOutToLog( "NavMesh.Load...\n" );
  gAutodeskNavMesh.Init();

  r3dResetFrameTime();
  GameWorld().Update();
  ServerDummyWorld.Update();

  r3dGameLevel::SetStartGameTime(r3dGetTime());
  
  r3dOutToLog("server main loop started\n");
  r3dResetFrameTime();
  gServerLogic.OnGameStart();
  
  gKeepAliveReporter.SetStarted(true);
  
 // _beginthreadex ( NULL, 0, NetworkThread, NULL, 0, NULL );
  while(1) 
  {
    ::Sleep(20);		// limit to 100 FPS

	char text[64] ={0};
	sprintf(text,"WarZ Game Server [Running..] id:%d curPeer:%d players:%d/%d",gServerLogic.ginfo_.gameServerId,gServerLogic.curPeersConnected,gServerLogic.curPlayers_,gServerLogic.ginfo_.maxPlayers);
	SetConsoleTitle(text);

	gServerLogic.net_->Update();

    r3dEndFrame();
    r3dStartFrame();
    
    //if(GetAsyncKeyState(VK_F1)&0x8000) r3dError("r3dError test");
    //if(GetAsyncKeyState(VK_F2)&0x8000) r3d_assert(false && "r3d_Assert test");
    gKeepAliveReporter.Tick(gServerLogic.curPlayers_);

    gServerLogic.Tick();
	gServerLogic.UpdateNetId();
    gMasterServerLogic.Tick();
//.........這裏部分代碼省略.........
開發者ID:hotza0012345,項目名稱:devwarzth,代碼行數:101,代碼來源:ServerGame.cpp


注:本文中的ObjectManager::Init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。