#I'm missing something about clientserverbootstrap and deployed server builds

1 messages · Page 1 of 1 (latest)

gilded gust
#

Hey guys! I'm using netcode for entities 1.2.4. I've been using the basic clientserverbootstrap and autoconnect port from the networked cube example, but I wanted to deploy a dedicated server so I could playtest with my friend who wants to contribute to the project.

I did as such, and I'm able to connect to the server by supplying autoconnectaddress and autoconnect port in the play tools ui, and launching the scene in the editor. However, when I create a client build and launch that, it doesn't connect to the server.

[UnityEngine.Scripting.Preserve]
public class GameBootstrap : ClientServerBootstrap
{
public override bool Initialize(string defaultWorldName)
{
DefaultConnectAddress = NetworkEndpoint.Parse("<deployedserverip>", 7979);

    return base.Initialize(defaultWorldName); // Use the regular bootstrap
}

}

I understand that if I built the client and server from this same clientserverbootstrap that it wouldn't work, but the deployed one is successfully listening given that I can connect from the editor, and because when I built it this script just set autoconnectport = 7979 instead of trying to specify an IP.

The docs https://docs.unity3d.com/Packages/com.unity.netcode@1.2/manual/network-connection.html
suggest stuff related to networkstreamdriver, but I'm not quite understanding what I'm reading. it's not clear if that happens in the same clientserverbootstrap or a different system or somewhere else. I think there are multiple methods as well so I'm having trouble figuring it out when I just need somewhere to paste the ip address.

I'm still in the hello-world part of this project in terms of networking so I just want to connect right when the scene loads, no waiting for user input or lobby/mathcmaking required.

gilded gust
#

bump 🙂

gilded gust
#

in the time since my original post, I noticed that my client build also has a server world because I saw my server logs in the output. so some iterations of the build have connected to itself. I thought a client build would just only have a client world? maybe that's another aspect of the clientserverbootstrap that I don't understand. it also needs to instantiate the worlds, so I guess the overall question is what a clientserverbootstrap looks like that specifies to create a server world only and listen on a server and create a client world only on a client and connect on a a client.

thorny moss
#

calling base.Initialize of ClientServerBootstrap will create both server and client worlds
do it by yourself with CreateServerWorld and CreateClientWorld and simply return true
strip server creation from client build by defines or pass some arguments as you like