public void LogOn() { SteamGameServer.SetModDir("PlanetExplorers"); SteamGameServer.SetProduct("PlanetExplorers"); SteamGameServer.SetGameDescription("Planet Explorers"); SteamGameServer.LogOnAnonymous(); }
public Tetrominous_Server() { if (!SteamGameServer.InitGameServer(0, TETROMINOUS_SERVER_PORT, TETROMINOUS_MASTER_SERVER_UPDATER_PORT, 0, Game1.APPID, TETROMINOUS_SERVER_VERSION)) { Console.WriteLine("Failed to Initiate Game Server."); } // Set the "game dir". // This is currently required for all games. However, soon we will be // using the AppID for most purposes, and this string will only be needed // for mods. it may not be changed after the server has logged on SteamGameServer.SetModDir(GAMEDIR); // These fields are currently required, but will go away soon. // See their documentation for more info SteamGameServer.SetProduct("Tetronimous"); SteamGameServer.SetGameDescription("Tetris minigames"); // Initiate Anonymous login SteamGameServer.LogOnAnonymous(); // We want to actively update the master server with our presence so players can // find us via the steam matchmaking/server browser interfaces SteamGameServer.EnableHeartbeats(true); }
public override void Open(string bindip, ushort port, bool lan) { if (bindip == "*") { bindip = "0.0.0.0"; } if (IsHosting) { return; } var ip = SteamworksCommon.GetUInt32FromIp(bindip); EServerMode mode = EServerMode.eServerModeAuthenticationAndSecure; //if(lan) mode = EServerMode.eServerModeNoAuthentication; if (!GameServer.Init(ip, (ushort)(port + 2), port, (ushort)(port + 1), mode, GameInfo.VERSION)) { throw new ServerInitializationFailedException("Couldn't start server (Steamworks API initialization failed)"); } SteamGameServer.SetDedicatedServer(!lan); SteamGameServer.SetGameDescription(GameInfo.NAME); SteamGameServer.SetProduct(GameInfo.NAME); SteamGameServer.SetModDir(GameInfo.NAME); SteamGameServer.SetServerName(Description); SteamGameServer.LogOnAnonymous(); SteamGameServer.SetPasswordProtected(false); //Todo SteamGameServer.EnableHeartbeats(true); Application.targetFrameRate = 60; IsHosting = true; }
public void CreateServer() { gs_Initialized = GameServer.Init(0, 8766, 27015, 27016, EServerMode.eServerModeNoAuthentication, "1.0"); if (!gs_Initialized) { Debug.Log("SteamGameServer_Init call failed"); return; } SteamGameServer.SetModDir("SPACEWARS"); SteamGameServer.LogOnAnonymous(); }
// Use this for initialization void Start() { SteamServersConnected = Callback <SteamServersConnected_t> .CreateGameServer(OnSteamServersConnected); #if DISABLED SteamServersConnectedFailure = Callback <SteamServerConnectFailure_t> .CreateGameServer(OnSteamServersConnectFailure); SteamServerDisconnected = Callback <SteamServersDisconnected_t> .CreateGameServer(OnSteamServersDisconnected); CallbackPolicyResponse = Callback <GSPolicyResponse_t> .CreateGameServer(OnPolicyResponse); CallbackGSAuthTicketResponse = Callback <ValidateAuthTicketResponse_t> .CreateGameServer(OnValidateAuthTicketResponse); CallbackP2PSessionRequest = Callback <P2PSessionRequest_t> .CreateGameServer(OnP2PSessionRequest); CallbackP2PSessionConnectFail = Callback <P2PSessionConnectFail_t> .CreateGameServer(OnP2PSessionConnectFail); #endif Initialized = false; _connectedToSteam = false; #if USE_GS_AUTH_API EServerMode eMode = EServerMode.eServerModeAuthenticationAndSecure; #endif uint unFlags = 27016; AppId_t nGameAppId = new AppId_t(); Initialized = SteamGameServer.InitGameServer(0, AUTHENTICATION_PORT, SERVER_PORT, unFlags, nGameAppId, SNAKES_SERVER_VERSION); if (Initialized == false) { return; } SteamGameServer.SetModDir("snakes"); SteamGameServer.SetProduct("Steamworks Example"); SteamGameServer.SetGameDescription("Steamworks Example"); SteamGameServer.LogOnAnonymous(); SteamGameServer.EnableHeartbeats(true); print("Started"); //SteamNetworking // Pause everything until all clients are initialized Time.timeScale = 0; NetworkManager.Instance.serverMessageEvents[NetworkMessageType.NetworkBehaviour] += OnMessageNetworkBehaviour; NetworkManager.Instance.serverMessageEvents[NetworkMessageType.NetworkBehaviourInitialized] += OnMessageNetworkBehaviourInitialized; NetworkManager.Instance.serverMessageEvents[NetworkMessageType.Initialization] += OnMessageInitialization; NetworkManager.Instance.serverMessageEvents[NetworkMessageType.PingPong] += OnMessagePingPong; }
private void Start() { if (!SteamDSConfig.isDedicatedServer && !SteamManager.Initialized) { SteamManager.Reset(); } SteamDSConfig.MapName = GameSetup.Difficulty.ToString(); SteamDSConfig.manager.SetStart(this.loadAsync); bool flag = GameServer.Init(0u, SteamDSConfig.ServerSteamPort, SteamDSConfig.ServerGamePort, SteamDSConfig.ServerQueryPort, SteamDSConfig.ServerAuthMode, SteamDSConfig.ServerVersion); if (flag) { Debug.Log("GameServer init success. Port: " + SteamDSConfig.ServerGamePort); if (CoopDedicatedServerStarter.< > f__mg$cache0 == null) { CoopDedicatedServerStarter.< > f__mg$cache0 = new SteamAPIWarningMessageHook_t(CoopDedicatedServerStarter.SteamAPIDebugTextHook); } SteamGameServerUtils.SetWarningMessageHook(CoopDedicatedServerStarter.< > f__mg$cache0); SteamGameServer.SetModDir("theforestDS"); SteamGameServer.SetProduct(SteamDSConfig.ProductName); SteamGameServer.SetGameDescription(SteamDSConfig.ProductDescription); SteamGameServer.SetServerName(SteamDSConfig.ServerName); SteamGameServer.SetDedicatedServer(true); if (string.IsNullOrEmpty(SteamDSConfig.ServerSteamAccount)) { Debug.Log("Set a LogOnAnonymous"); SteamGameServer.LogOnAnonymous(); } else { Debug.Log("Set a Logon"); SteamGameServer.LogOn(SteamDSConfig.ServerSteamAccount); } SteamGameServer.EnableHeartbeats(true); SteamDSConfig.initialized = true; } else { Debug.LogError("GameServer.InitSafe failed"); CoopDedicatedServerStarter.ShutDown(); } }
// Token: 0x06001834 RID: 6196 RVA: 0x00088FEC File Offset: 0x000873EC public void open(uint ip, ushort port, ESecurityMode security) { if (this.isHosting) { return; } EServerMode eServerMode = EServerMode.eServerModeInvalid; if (security != ESecurityMode.LAN) { if (security != ESecurityMode.SECURE) { if (security == ESecurityMode.INSECURE) { eServerMode = EServerMode.eServerModeAuthentication; } } else { eServerMode = EServerMode.eServerModeAuthenticationAndSecure; } } else { eServerMode = EServerMode.eServerModeNoAuthentication; } if (!GameServer.Init(ip, port + 2, port, port + 1, eServerMode, "1.0.0.0")) { throw new Exception("GameServer API initialization failed!"); } SteamGameServer.SetDedicatedServer(this.appInfo.isDedicated); SteamGameServer.SetGameDescription(this.appInfo.name); SteamGameServer.SetProduct(this.appInfo.name); SteamGameServer.SetModDir(this.appInfo.name); SteamGameServer.LogOnAnonymous(); SteamGameServer.EnableHeartbeats(true); this.isHosting = true; }
// Use this for initialization void Start() { SteamServersConnected = Callback <SteamServersConnected_t> .CreateGameServer(OnSteamServersConnected); #if DISABLED SteamServersConnectedFailure = Callback <SteamServerConnectFailure_t> .CreateGameServer(OnSteamServersConnectFailure); SteamServerDisconnected = Callback <SteamServersDisconnected_t> .CreateGameServer(OnSteamServersDisconnected); CallbackPolicyResponse = Callback <GSPolicyResponse_t> .CreateGameServer(OnPolicyResponse); CallbackGSAuthTicketResponse = Callback <ValidateAuthTicketResponse_t> .CreateGameServer(OnValidateAuthTicketResponse); CallbackP2PSessionRequest = Callback <P2PSessionRequest_t> .CreateGameServer(OnP2PSessionRequest); CallbackP2PSessionConnectFail = Callback <P2PSessionConnectFail_t> .CreateGameServer(OnP2PSessionConnectFail); #endif Initialized = false; _connectedToSteam = false; #if USE_GS_AUTH_API EServerMode eMode = EServerMode.eServerModeAuthenticationAndSecure; #endif uint unFlags = 27016; AppId_t nGameAppId = new AppId_t(); Initialized = SteamGameServer.InitGameServer(0, AUTHENTICATION_PORT, SERVER_PORT, unFlags, nGameAppId, SNAKES_SERVER_VERSION); if (Initialized == false) { return; } SteamGameServer.SetModDir("snakes"); SteamGameServer.SetProduct("Steamworks Example"); SteamGameServer.SetGameDescription("Steamworks Example"); SteamGameServer.LogOnAnonymous(); SteamGameServer.EnableHeartbeats(true); print("Started"); }
private void OnEnable() { m_CallbackSteamServersConnected = Callback <SteamServersConnected_t> .CreateGameServer(OnSteamServersConnected); #if DISABLED m_CallbackSteamServersConnectFailure = Callback <SteamServerConnectFailure_t> .CreateGameServer(OnSteamServersConnectFailure); m_CallbackSteamServersDisconnected = Callback <SteamServersDisconnected_t> .CreateGameServer(OnSteamServersDisconnected); m_CallbackPolicyResponse = Callback <GSPolicyResponse_t> .CreateGameServer(OnPolicyResponse); m_CallbackGSAuthTicketResponse = Callback <ValidateAuthTicketResponse_t> .CreateGameServer(OnValidateAuthTicketResponse); m_CallbackP2PSessionRequest = Callback <P2PSessionRequest_t> .CreateGameServer(OnP2PSessionRequest); m_CallbackP2PSessionConnectFail = Callback <P2PSessionConnectFail_t> .CreateGameServer(OnP2PSessionConnectFail); #endif m_bInitialized = false; m_bConnectedToSteam = false; #if USE_GS_AUTH_API EServerMode eMode = EServerMode.eServerModeAuthenticationAndSecure; #else // Don't let Steam do authentication EServerMode eMode = EServerMode.eServerModeNoAuthentication; #endif // Initialize the SteamGameServer interface, we tell it some info about us, and we request support // for both Authentication (making sure users own games) and secure mode, VAC running in our game // and kicking users who are VAC banned m_bInitialized = GameServer.Init(0, SPACEWAR_AUTHENTICATION_PORT, SPACEWAR_SERVER_PORT, SPACEWAR_MASTER_SERVER_UPDATER_PORT, eMode, SPACEWAR_SERVER_VERSION); if (!m_bInitialized) { Debug.Log("SteamGameServer_Init call failed"); return; } print("Initialized"); // Set the "game dir". // This is currently required for all games. However, soon we will be // using the AppID for most purposes, and this string will only be needed // for mods. it may not be changed after the server has logged on SteamGameServer.SetModDir("spacewar"); // These fields are currently required, but will go away soon. // See their documentation for more info SteamGameServer.SetProduct("SteamworksExample"); SteamGameServer.SetGameDescription("Steamworks Example"); // We don't support specators in our game. // .... but if we did: //SteamGameServer.SetSpectatorPort( ... ); //SteamGameServer.SetSpectatorServerName( ... ); // Initiate Anonymous logon. // Coming soon: Logging into authenticated, persistent game server account SteamGameServer.LogOnAnonymous(); // We want to actively update the master server with our presence so players can // find us via the steam matchmaking/server browser interfaces #if USE_GS_AUTH_API SteamGameServer.EnableHeartbeats(true); #endif Debug.Log("Started."); }
private void Start() { if (!Packsize.Test()) { Debug.LogError("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", this); } if (!DllCheck.Test()) { Debug.LogError("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.", this); } try { if (SteamAPI.RestartAppIfNecessary(SteamDSConfig.AppIdDS)) { Application.Quit(); return; } } catch (DllNotFoundException arg) { Debug.LogError("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + arg, this); Application.Quit(); return; } this.m_bInitialized = SteamAPI.Init(); if (!this.m_bInitialized) { Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this); return; } SteamConfig.BuildId = SteamApps.GetAppBuildId(); string betaName; if (SteamApps.GetCurrentBetaName(out betaName, 50)) { SteamConfig.BetaName = betaName; } Debug.Log("Steam Started"); this.m_CallbackSteamServersConnected = Callback <SteamServersConnected_t> .CreateGameServer(new Callback <SteamServersConnected_t> .DispatchDelegate(this.OnSteamServersConnected)); this.m_CallbackSteamServersConnectFailure = Callback <SteamServerConnectFailure_t> .CreateGameServer(new Callback <SteamServerConnectFailure_t> .DispatchDelegate(this.OnSteamServersConnectFailure)); this.m_CallbackSteamServersDisconnected = Callback <SteamServersDisconnected_t> .CreateGameServer(new Callback <SteamServersDisconnected_t> .DispatchDelegate(this.OnSteamServersDisconnected)); this.m_CallbackPolicyResponse = Callback <GSPolicyResponse_t> .CreateGameServer(new Callback <GSPolicyResponse_t> .DispatchDelegate(this.OnPolicyResponse)); this.m_CallbackGSAuthTicketResponse = Callback <ValidateAuthTicketResponse_t> .CreateGameServer(new Callback <ValidateAuthTicketResponse_t> .DispatchDelegate(this.OnValidateAuthTicketResponse)); this.m_CallbackP2PSessionRequest = Callback <P2PSessionRequest_t> .CreateGameServer(new Callback <P2PSessionRequest_t> .DispatchDelegate(this.OnP2PSessionRequest)); this.m_CallbackP2PSessionConnectFail = Callback <P2PSessionConnectFail_t> .CreateGameServer(new Callback <P2PSessionConnectFail_t> .DispatchDelegate(this.OnP2PSessionConnectFail)); this.m_bInitialized = false; this.m_bConnectedToSteam = false; EServerMode eServerMode = EServerMode.eServerModeAuthenticationAndSecure; this.m_bInitialized = GameServer.Init(0u, SteamDSConfig.ServerSteamPort, SteamDSConfig.ServerGamePort, SteamDSConfig.ServerQueryPort, eServerMode, SteamDSConfig.ServerVersion); if (!this.m_bInitialized) { Debug.Log("SteamGameServer_Init call failed"); return; } SteamGameServer.SetModDir("theforestDS"); SteamGameServer.SetProduct("The Forest"); SteamGameServer.SetGameDescription("The Forest Game Description"); SteamGameServer.LogOnAnonymous(); SteamGameServer.EnableHeartbeats(true); Debug.Log("Started."); }