Merge branch 'LYN-7080_FixEditorServerConnectionRaceCondition' into LYN-6770_AutomatedTestNetInputs
This commit is contained in:
@@ -146,7 +146,6 @@ namespace Multiplayer
|
||||
{
|
||||
// Connect the Editor to the editor server for Multiplayer simulation
|
||||
AZ::Interface<IMultiplayer>::Get()->Connect(remoteAddress.c_str(), remotePort);
|
||||
AZ::Interface<IMultiplayer>::Get()->SendReadyForEntityUpdates(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,8 +142,14 @@ namespace Multiplayer
|
||||
}
|
||||
|
||||
// Start the configured server if it's available
|
||||
AZStd::string projectPath(AZ::Utils::GetProjectPath().c_str());
|
||||
AZStd::replace(projectPath.begin(), projectPath.end(), AZ::IO::WindowsPathSeparator, AZ::IO::PosixPathSeparator);
|
||||
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
|
||||
processLaunchInfo.m_commandlineParameters = AZStd::string::format("\"%s\" --editorsv_isDedicated true", serverPath.c_str());
|
||||
processLaunchInfo.m_commandlineParameters = AZStd::string::format(
|
||||
R"("%s" --project-path "%s" --editorsv_isDedicated true --sv_defaultPlayerSpawnAsset "%s")",
|
||||
serverPath.c_str(),
|
||||
projectPath.c_str(),
|
||||
static_cast<AZ::CVarFixedString>(sv_defaultPlayerSpawnAsset).c_str());
|
||||
processLaunchInfo.m_showWindow = true;
|
||||
processLaunchInfo.m_processPriority = AzFramework::ProcessPriority::PROCESSPRIORITY_NORMAL;
|
||||
|
||||
|
||||
@@ -489,11 +489,23 @@ namespace Multiplayer
|
||||
{
|
||||
m_didHandshake = true;
|
||||
|
||||
AZ::CVarFixedString commandString = "sv_map " + packet.GetMap();
|
||||
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(commandString.c_str());
|
||||
// If this is an Editor then we're now accepting the connection to the EditorServer.
|
||||
// In normal game clients SendReadyForEntityUpdates will be enabled once the appropriate level's root spawnable is loaded,
|
||||
// but since we're in Editor, we're already in the level.
|
||||
AZ::ApplicationTypeQuery applicationType;
|
||||
AZ::ComponentApplicationBus::Broadcast(&AZ::ComponentApplicationRequests::QueryApplicationType, applicationType);
|
||||
if (applicationType.IsEditor())
|
||||
{
|
||||
SendReadyForEntityUpdates(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ::CVarFixedString commandString = "sv_map " + packet.GetMap();
|
||||
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(commandString.c_str());
|
||||
|
||||
AZ::CVarFixedString loadLevelString = "LoadLevel " + packet.GetMap();
|
||||
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(loadLevelString.c_str());
|
||||
AZ::CVarFixedString loadLevelString = "LoadLevel " + packet.GetMap();
|
||||
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(loadLevelString.c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -981,7 +993,7 @@ namespace Multiplayer
|
||||
INetworkEntityManager::EntityList entityList = m_networkEntityManager.CreateEntitiesImmediate(playerPrefabEntityId, NetEntityRole::Authority, AZ::Transform::CreateIdentity(), Multiplayer::AutoActivate::DoNotActivate);
|
||||
|
||||
NetworkEntityHandle controlledEntity;
|
||||
if (entityList.size() > 0)
|
||||
if (!entityList.empty())
|
||||
{
|
||||
controlledEntity = entityList[0];
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace AzNetworking
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
AZ_CVAR_EXTERNED(AZ::CVarFixedString, sv_defaultPlayerSpawnAsset);
|
||||
|
||||
//! Multiplayer system component wraps the bridging logic between the game and transport layer.
|
||||
class MultiplayerSystemComponent final
|
||||
: public AZ::Component
|
||||
|
||||
Reference in New Issue
Block a user