Implementing Steamworks.NET with dedicated server

Hello!

I’m currently working on my game’s multiplayer player experience. I’ve used multiple references and documentations but am still uncertain with the proper execution.

My goal is to set up a dedicated server that is registered with Steam as a server for people to join.

Here is my code to start the server:

        //Get references
        ServerConfiguration settings = ServerManager.GetConfig();
        CraftingDeadManager craftingDead = CraftingDeadManager.singleton;

        //Convert string address to uint for steam
        uint add1 = System.BitConverter.ToUInt32(System.Net.IPAddress.Parse(settings.address).GetAddressBytes(), 0);

        //Init steam connection. Not really sure if this works or etc. Still reading API doc
        bool initalized = GameServer.Init(add1, (ushort) settings.portSteam, (ushort) settings.port, (ushort) settings.portQuery, EServerMode.eServerModeAuthentication, craftingDead.buildVersion);

        if(initalized == false) {
            ServerManager.Log("Game Server FAILED to Initialize");
            return;
        }

        SteamGameServer.SetProduct("CraftingDead");
        SteamGameServer.SetGameDescription("Crafting Dead");

        SteamGameServer.SetDedicatedServer(true);
        SteamGameServer.SetServerName(settings.name);
        SteamGameServer.SetMaxPlayerCount(settings.slots);
        SteamGameServer.LogOnAnonymous();
        SteamGameServer.EnableHeartbeats(true);

        //Start the server with Unity
        StartServer();

My question is:
Is this the proper way to start it or am I missing specific details?

Currently it isn’t initializing.

I suggest switching to Facepunch’s Steamworks lib. Better support. Better maintained and easier to use.

However, since you are trying to login without a steam account. You need SteamCMD. Make sure that is installed properly.