Merge branch 'LYN-7655_MultiplayerEditorToEditorServerConnectionReverse' into LYN-6770_AutomatedTestNetInputs

monroegm-disable-blank-issue-2
Gene Walters 4 years ago
commit 03e90e7df5

@ -18,7 +18,6 @@
#include <AzCore/Utils/Utils.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/Utils.h>
#include <AzFramework/Spawnable/Spawnable.h>
#include <AzNetworking/ConnectionLayer/IConnection.h>
#include <AzNetworking/Framework/INetworking.h>
@ -47,7 +46,7 @@ namespace Multiplayer
ConnectionId editorServerToEditorConnectionId = m_networkEditorInterface->Connect(IpAddress(LocalHost.data(), editorsv_port, ProtocolType::Tcp));
// If there wasn't an Editor waiting for this server to start, then assume this is an editor-server launched by hand... listen and wait for the editor to request a connection
if (editorServerToEditorConnectionId == AzNetworking::InvalidConnectionId)
if (editorServerToEditorConnectionId == InvalidConnectionId)
{
m_networkEditorInterface->Listen(editorsv_port);
}
@ -154,21 +153,18 @@ namespace Multiplayer
[[maybe_unused]] MultiplayerEditorPackets::EditorServerReady& packet
)
{
if (connection->GetConnectionRole() == ConnectionRole::Connector)
{
// Receiving this packet means Editor sync is done, disconnect
connection->Disconnect(AzNetworking::DisconnectReason::TerminatedByClient, AzNetworking::TerminationEndpoint::Local);
// Receiving this packet means Editor sync is done, disconnect
connection->Disconnect(AzNetworking::DisconnectReason::TerminatedByClient, AzNetworking::TerminationEndpoint::Local);
if (auto console = AZ::Interface<AZ::IConsole>::Get(); console)
if (const auto console = AZ::Interface<AZ::IConsole>::Get())
{
AZ::CVarFixedString remoteAddress;
uint16_t remotePort;
if (console->GetCvarValue("editorsv_serveraddr", remoteAddress) != AZ::GetValueResult::ConsoleVarNotFound &&
console->GetCvarValue("sv_port", remotePort) != AZ::GetValueResult::ConsoleVarNotFound)
{
AZ::CVarFixedString remoteAddress;
uint16_t remotePort;
if (console->GetCvarValue("editorsv_serveraddr", remoteAddress) != AZ::GetValueResult::ConsoleVarNotFound &&
console->GetCvarValue("sv_port", remotePort) != AZ::GetValueResult::ConsoleVarNotFound)
{
// Connect the Editor to the editor server for Multiplayer simulation
AZ::Interface<IMultiplayer>::Get()->Connect(remoteAddress.c_str(), remotePort);
}
// Connect the Editor to the editor server for Multiplayer simulation
AZ::Interface<IMultiplayer>::Get()->Connect(remoteAddress.c_str(), remotePort);
}
}
return true;

@ -266,13 +266,14 @@ namespace Multiplayer
{
AZ_Warning(
"MultiplayerEditor", false,
"Launching EditorServer skipped because incompatible cvars. editorsv_launch=true, meaning you want to launch an editor-server on this machine, but the editorsv_serveraddr is %s instead of the local address (127.0.0.1)."
"Launching EditorServer skipped because incompatible cvars. editorsv_launch=true, meaning you want to launch an editor-server on this machine, but the editorsv_serveraddr is %s instead of the local address (127.0.0.1). "
"Please either set editorsv_launch=false and keep the remote editor-server, or set editorsv_launch=true and editorsv_serveraddr=127.0.0.1.",
remoteAddress.c_str())
return;
}
// Begin listening so we know when the editor-server being ready for us
// Begin listening for MPEditor packets before we launch the editor-server.
// The editor-server will send us (the editor) an "EditorServerReadyForInit" packet to let us know it's ready to receive data.
INetworkInterface* editorNetworkInterface =
AZ::Interface<INetworking>::Get()->RetrieveNetworkInterface(AZ::Name(MpEditorInterfaceName));
AZ_Assert(editorNetworkInterface, "MP Editor Network Interface was unregistered before Editor could connect.");
@ -294,7 +295,7 @@ namespace Multiplayer
{
AZ_Warning(
"MultiplayerEditor", false,
"Editor game-mode multiplayer failed! Could not connect to an editor-server. editorsv_launch is false so we're assuming you're running your own editor-server at editorsv_serveraddr(%s) on editorsv_port(%i)."
"Editor multiplayer game-mode failed! Could not connect to an editor-server. editorsv_launch is false so we're assuming you're running your own editor-server at editorsv_serveraddr(%s) on editorsv_port(%i)."
"Either set editorsv_launch=true so the editor launches an editor-server for you, or launch your own editor-server by hand before entering game-mode. Remember editor-servers must use editorsv_isDedicated=true.",
remoteAddress.c_str(),
static_cast < uint16_t>(editorsv_port))

Loading…
Cancel
Save