Game Development Reference
In-Depth Information
// spawn all local players (should only be one, though we might
// support more in the future)
GCC_ASSERT(m_ExpectedPlayers == 1);
for (int i = 0; i < m_ExpectedPlayers; ++i)
{
shared_ptr<IGameView> playersView(
GCC_NEW TeapotWarsHumanView(g_pApp->m_Renderer));
VAddView(playersView);
if (m_bProxy)
{
// if we are a remote player, all we have to do is spawn
// our view - the server will do the rest.
return;
}
}
// spawn all remote players' views on the game
for (int i = 0; i < m_ExpectedRemotePlayers; ++i)
{
shared_ptr<IGameView> remoteGameView(GCC_NEW NetworkGameView);
VAddView(remoteGameView);
}
// spawn all AI's views on the game
for (int i = 0; i < m_ExpectedAI; ++i)
{
shared_ptr<IGameView> aiView(
GCC_NEW AITeapotView(m_pPathingGraph));
VAddView(aiView);
}
break;
}
case BGS_SpawningPlayersActors:
{
if (m_bProxy)
{
// only the server needs to do this.
return;
}
for (auto it = m_gameViews.begin(); it != m_gameViews.end(); ++it)
{
Search WWH ::




Custom Search