#Relay integration with entities netcode.

1 messages · Page 1 of 1 (latest)

stray mica
#

There's very little documentation with integrating relay with netcode. I took a look at the HelloNetcode sample for relay integration with entities and flew way over my head.

Can anyone please give me an explanation on how I would integrate relay into netcode? Perhaps there's a struct or method I should look into?

I got this going with my current netcode implementation (without relay) but from what I've seen from the sample, they have a completely different way of networking (Or at least different syntax).

private void StartServer()
{
    var serverWorld = ClientServerBootstrap.CreateServerWorld("Server World");

    var serverEndpoint = NetworkEndpoint.AnyIpv4.WithPort(Port);
    {
        using var networkDriverQuery = serverWorld.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
        networkDriverQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW.Listen(serverEndpoint);
    }
}

private void StartClient()
{
    var clientWorld = ClientServerBootstrap.CreateClientWorld("Client World");

    var connectionEndpoint = NetworkEndpoint.Parse(Address, Port);
    {
        using var networkDriverQuery = clientWorld.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
        networkDriverQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW.Connect(clientWorld.EntityManager, connectionEndpoint);
    }

    World.DefaultGameObjectInjectionWorld = clientWorld;

    Entity joinRequestEntity = clientWorld.EntityManager.CreateEntity();
    clientWorld.EntityManager.AddComponentData(joinRequestEntity, new ClientRequestEntryTag { });
}
cinder relic
#

megacity has relay integration i believe as well if you wanted another sample to look at

stray mica
cinder relic
#

oh bugger, thought it did

stray mica
#

uses stinky multiplay

stray mica
# cinder relic oh bugger, thought it did

Alr I got some progress going after trying to do some code surgery with the documentation and my current network transport implementation and I'm getting a warning that
Driver with ID 1 uses IPCNetworkInterface. The endpoint used for listening is using Port == 0. A random port will be assigned to this interface. In order to connect to this endpoint, you will need to retrieve the local address. You can use the NetworkStreamDriver.GetLocalEndPoint(1) to retrieve the assigned address.
and
Driver with ID 1 uses IPCNetworkInterface. It must listen to Any:XXX or Loopback:XXX but endpoint is invalid. Forcing listening to ANY:0

#

I've narrowed it down to here:

#

NetworkEndpoint.TryParse()