From 9cb2f337fa7b99a5da86c005c2f98f1b3a0f5acd Mon Sep 17 00:00:00 2001 From: JezuzLizard Date: Sat, 11 Mar 2023 09:21:25 -0800 Subject: [PATCH 1/2] Added lua file to handle different lobby modes via dvar. Added campaign cfg and bat. --- BOIII_CP_Server.bat | 36 +++++++++ .../server_lobby_selector/__init__.lua | 49 ++++++++++++ zone/server.cfg | 1 + zone/server_cp.cfg | 77 +++++++++++++++++++ zone/server_zm.cfg | 4 +- 5 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 BOIII_CP_Server.bat create mode 100644 boiii/lobby_scripts/server_lobby_selector/__init__.lua create mode 100644 zone/server_cp.cfg diff --git a/BOIII_CP_Server.bat b/BOIII_CP_Server.bat new file mode 100644 index 0000000..0cf810f --- /dev/null +++ b/BOIII_CP_Server.bat @@ -0,0 +1,36 @@ +@echo off +:://///////////////////////////////////////////////////////////////////// +::/// BOIII Dedicated Server Configuration start-up file /// +:://///////////////////////////////////////////////////////////////////// +::// // +::// Your Game Server Port. // +::// Make sure you Port Forward both UDP & TCP // +:://///////////////////////////////////////////////////////////////////// + +set GamePort=28960 + +:://///////////////////////////////////////////////////////////////////// +::// Below edits are optional unless you run multiable servers or mods.// +:://///////////////////////////////////////////////////////////////////// +::// Load a mod on your server // +::// Example: ModfolderName=mods/bots // +::// // +::// UNLOAD a mod on your server // +::// Example: ModfolderName= // +:://///////////////////////////////////////////////////////////////////// + +set ModFolderName= + +:://///////////////////////////////////////////////////////////////////// +::// Your edited server.cfg in the "zone" folder goes here... // +::// This is were you edit your hostname, rcon, inactivity, etc // +::// (Optional) // +:://///////////////////////////////////////////////////////////////////// + +set ServerFilename=server_cp.cfg + +:://///////////////////////////////////////////////////////////////////// +:://DONE!! WARNING! Don't mess with anything below this line. SEROUSLY!// +:://///////////////////////////////////////////////////////////////////// + +start boiii.exe -dedicated +set fs_game "%ModFolderName%" +set net_port "%GamePort%" +exec %ServerFilename% \ No newline at end of file diff --git a/boiii/lobby_scripts/server_lobby_selector/__init__.lua b/boiii/lobby_scripts/server_lobby_selector/__init__.lua new file mode 100644 index 0000000..c9bd9d3 --- /dev/null +++ b/boiii/lobby_scripts/server_lobby_selector/__init__.lua @@ -0,0 +1,49 @@ +Lobby.Process.CreateDedicatedModsLobby = function (f8_arg0, f8_arg1) + local lobby_mode = Engine.DvarString( nil, "sv_lobby_mode" ) + if lobby_mode ~= "" then + if lobby_mode == "zm" then + f8_arg1 = LobbyData.UITargets.UI_ZMLOBBYONLINECUSTOMGAME + elseif lobby_mode == "cp" then + f8_arg1 = LobbyData.UITargets.UI_CPLOBBYONLINECUSTOMGAME + elseif lobby_mode == "cpzm" then + f8_arg1 = LobbyData.UITargets.UI_CP2LOBBYONLINECUSTOMGAME + elseif lobby_mode == "fr" then + f8_arg1 = LobbyData.UITargets.UI_FRLOBBYONLINEGAME + f8_arg1.maxClients = Engine.DvarInt( nil, "com_maxclients" ) + elseif lobby_mode == "doa" then + f8_arg1 = LobbyData.UITargets.UI_DOALOBBYONLINE + elseif lobby_mode == "mp" then + f8_arg1 = LobbyData.UITargets.UI_MPLOBBYONLINEMODGAME + elseif lobby_mode == "arena" then + f8_arg1 = LobbyData.UITargets.UI_MPLOBBYONLINEARENAGAME + end + end + local f8_local0 = Dvar.sv_playlist + Engine.SetPlaylistID(f8_local0:get()) + local f8_local1 = Lobby.Actions.ExecuteScript(function () + Lobby.ProcessNavigate.SetupLobbyMapAndGameType(f8_arg0, f8_arg1) + end) + local f8_local2 = Lobby.Actions.SetNetworkMode(f8_arg0, Enum.LobbyNetworkMode.LOBBY_NETWORKMODE_LIVE) + local f8_local3 = Lobby.Actions.LobbySettings(f8_arg0, f8_arg1) + local f8_local4 = Lobby.Actions.UpdateUI(f8_arg0, f8_arg1) + local f8_local5 = Lobby.Actions.LobbyHostStart(f8_arg0, f8_arg1.mainMode, f8_arg1.lobbyType, f8_arg1.lobbyMode, f8_arg1.maxClients) + local f8_local6 = Lobby.Actions.AdvertiseLobby(true) + local f8_local7 = Lobby.Actions.ExecuteScript(function () + Engine.QoSProbeListenerEnable(f8_arg1.lobbyType, true) + Engine.SetDvar("live_dedicatedReady", 1) + Engine.RunPlaylistRules(f8_arg0) + Engine.RunPlaylistSettings(f8_arg0) + Lobby.Timer.HostingLobby({controller = f8_arg0, lobbyType = f8_arg1.lobbyType, mainMode = f8_arg1.mainMode, lobbyTimerType = f8_arg1.lobbyTimerType}) + if Engine.DvarInt( nil, "sv_skip_lobby" ) == 1 then + Engine.Exec(0, "launchgame") + end + end) + Lobby.Process.AddActions(f8_local2, f8_local3) + Lobby.Process.AddActions(f8_local3, f8_local1) + Lobby.Process.AddActions(f8_local1, f8_local4) + Lobby.Process.AddActions(f8_local4, f8_local5) + Lobby.Process.AddActions(f8_local5, f8_local6) + Lobby.Process.AddActions(f8_local6, f8_local7) + Lobby.Process.AddActions(f8_local7, nil) + return {head = f8_local2, interrupt = Lobby.Interrupt.NONE, force = true, cancellable = true} +end \ No newline at end of file diff --git a/zone/server.cfg b/zone/server.cfg index fedaf03..d2b9b27 100644 --- a/zone/server.cfg +++ b/zone/server.cfg @@ -36,6 +36,7 @@ set sv_pure "0" // verifying cilent files set sv_floodProtect "1" // Chat Spam Protection set logfile "1" // Enable loging 1-2? enable. 0 disable. Leave it on if you plan on using B3 or IW4MAdmin. set g_log "logs/games_mp.log" // Gamelog filename. If you edit this, Make sure you change B3.xml if you have bigbrotherbot. IW4MAdmin auto-detects however. +set sv_lobby_mode "mp" // Sets the lobby type to multiplayer ////////////////////////////////////////////////// // BOT CONFIGURATION // diff --git a/zone/server_cp.cfg b/zone/server_cp.cfg new file mode 100644 index 0000000..abd6938 --- /dev/null +++ b/zone/server_cp.cfg @@ -0,0 +1,77 @@ +////////////////////////////////////////////////// +/// BOIII Server Configuration // +////////////////////////////////////////////////// + +////////////////////////////////////////////////// +// SERVER NAME & COLORS TIPS // +////////////////////////////////////////////////// +// // +// ^1 Red // +// ^2 Green // +// ^3 Yellow // +// ^4 Blue // +// ^5 Cyan // +// ^6 Pink // +// ^7 White // +// ^8 Depends on the team colors playing. // +// ^9 Orange // +// ^0 Black // +// // +////////////////////////////////////////////////// + +set live_steam_server_name "Default BOIII Campaign Server" // Sets the server hostname. +set live_steam_server_description "My longest YEA BOIII CAMPAIGN ever" // Sets a server description visible on the serverlist + +////////////////////////////////////////////////// +// NON-GAMEPLAY CONFIGURATION // +////////////////////////////////////////////////// + +set com_maxclients "4" // Max players in your server. +set rcon_password "" // Access to your server to change stuff remotely or ingame. (Empty = disabled) +set g_password "" // Password Protected Server. Leave blank if you want players to join or set password if you want to keep public out. +set sv_privateClients "0" // Maximum number of private clients allowed on the server (range 0-18 (clamped to sv_maxclients) ) +set sv_timeout "30" // Timeout time period. You will timeout after (30) seconds when attempting to connect or if you are getting connection interruptions +set sv_reconnectlimit "3" // How many times you can try to reconnect +set sv_pure "0" // verifying cilent files +set sv_floodProtect "1" // Chat Spam Protection +set logfile "1" // Enable loging 1-2? enable. 0 disable. Leave it on if you plan on using B3 or IW4MAdmin. +set g_log "logs/games_cp.log" // Gamelog filename. If you edit this, Make sure you change B3.xml if you have bigbrotherbot. IW4MAdmin auto-detects however. +set sv_lobby_mode "cp" // Sets the lobby type to camapaign + +////////////////////////////////////////////////// +// BASE GAME CONFIGURATION // +////////////////////////////////////////////////// + +exec "gamedata/gamesettings/cp/gamesettings_default.cfg" // Leave this as is +exec "gamedata/configs/common/default_xboxlive.cfg" // Leave this as is +exec "gamedata/gamesettings/cp/gamesettings_coop.cfg" // Leave this as is + +set cg_thirdPerson "0" // third-person mode + +////////////////////////////////////////////////////////////// +// MAP SHORT NAMES ROTATION LIST // +////////////////////////////////////////////////////////////// +// // +// Safehouses // +// Mobile - cp_sh_mobile // +// Singapore - cp_sh_singapore // +// Cairo - cp_sh_cairo // +// // +////////////////////////////////////////////////////////////// +// // +// Black Ops - cp_mi_eth_prologue // +// New World - cp_mi_zurich_newworld // +// In Darkness - cp_mi_sing_blackstation // +// Provocation - cp_mi_sing_biodomes // +// Hypocenter - cp_mi_sing_sgen // +// Vengeance - cp_mi_sing_vengeance // +// Rise & Fall - cp_mi_cairo_ramses // +// Demon Within - cp_mi_cairo_infection // +// Sand Castle - cp_mi_cairo_aquifer // +// Lotus Towers - cp_mi_cairo_lotus // +// Life - cp_mi_zurich_coalescence// +// // +////////////////////////////////////////////////////////////// + +set sv_maprotation "gametype coop map cp_mi_eth_prologue" +map_rotate \ No newline at end of file diff --git a/zone/server_zm.cfg b/zone/server_zm.cfg index 387d965..208558f 100644 --- a/zone/server_zm.cfg +++ b/zone/server_zm.cfg @@ -35,8 +35,8 @@ set sv_reconnectlimit "3" // How many times you can try to set sv_pure "0" // verifying cilent files set sv_floodProtect "1" // Chat Spam Protection set logfile "1" // Enable loging 1-2? enable. 0 disable. Leave it on if you plan on using B3 or IW4MAdmin. -set g_log "logs/games_mp.log" // Gamelog filename. If you edit this, Make sure you change B3.xml if you have bigbrotherbot. IW4MAdmin auto-detects however. - +set g_log "logs/games_zm.log" // Gamelog filename. If you edit this, Make sure you change B3.xml if you have bigbrotherbot. IW4MAdmin auto-detects however. +set sv_lobby_mode "zm" // Sets the lobby type to zombies ////////////////////////////////////////////////// // BASE GAME CONFIGURATION // From 0e45709565849f0d3778a83ce6ba268a57463810 Mon Sep 17 00:00:00 2001 From: JezuzLizard Date: Sat, 11 Mar 2023 14:23:36 -0800 Subject: [PATCH 2/2] Allow ignoring playlists for the first map. If sv_skip_lobby dvar is 1 set the lobby map and gametype to what the first gametype and map in the sv_maprotation dvar is set to, and then launch the game. sv_skip_lobby is enabled by default but setting it to 0 enables default behavior. --- .../server_lobby_selector/__init__.lua | 26 +++++++++++++++++-- zone/server.cfg | 6 ++--- zone/server_cp.cfg | 4 +-- zone/server_zm.cfg | 1 + 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/boiii/lobby_scripts/server_lobby_selector/__init__.lua b/boiii/lobby_scripts/server_lobby_selector/__init__.lua index c9bd9d3..cfcb4d4 100644 --- a/boiii/lobby_scripts/server_lobby_selector/__init__.lua +++ b/boiii/lobby_scripts/server_lobby_selector/__init__.lua @@ -34,7 +34,20 @@ Lobby.Process.CreateDedicatedModsLobby = function (f8_arg0, f8_arg1) Engine.RunPlaylistRules(f8_arg0) Engine.RunPlaylistSettings(f8_arg0) Lobby.Timer.HostingLobby({controller = f8_arg0, lobbyType = f8_arg1.lobbyType, mainMode = f8_arg1.mainMode, lobbyTimerType = f8_arg1.lobbyTimerType}) - if Engine.DvarInt( nil, "sv_skip_lobby" ) == 1 then + if Engine.DvarInt( nil, "sv_skip_lobby" ) == 1 then + -- Engine.ComError( Enum.errorCode.ERROR_SCRIPT, "Using sv_skip_lobby" ) + local map_rotation_string = Engine.DvarString( nil, "sv_maprotation" ) + if map_rotation_string ~= "" then + local map_rotation_tokens = split_string( map_rotation_string, " " ) + if map_rotation_tokens[ 1 ] == "gametype" then + Engine.Exec(0, "lobby_setgametype " .. map_rotation_tokens[ 2 ] ) + -- Engine.ComError( Enum.errorCode.ERROR_SCRIPT, "Set gametype to " .. map_rotation_tokens[ 2 ] .. " based on map rotation" ) + if map_rotation_tokens[ 3 ] == "map" then + Engine.Exec(0, "lobby_setmap " .. map_rotation_tokens[ 4 ] ) + -- Engine.ComError( Enum.errorCode.ERROR_SCRIPT, "Set map to " .. map_rotation_tokens[ 4 ] .. " based on map rotation" ) + end + end + end Engine.Exec(0, "launchgame") end end) @@ -46,4 +59,13 @@ Lobby.Process.CreateDedicatedModsLobby = function (f8_arg0, f8_arg1) Lobby.Process.AddActions(f8_local6, f8_local7) Lobby.Process.AddActions(f8_local7, nil) return {head = f8_local2, interrupt = Lobby.Interrupt.NONE, force = true, cancellable = true} -end \ No newline at end of file +end + +function split_string(str, delimiter) + local tokens = {} + local pattern = string.format("([^%s]+)", delimiter) + for token in string.gmatch(str, pattern) do + table.insert(tokens, token) + end + return tokens + end \ No newline at end of file diff --git a/zone/server.cfg b/zone/server.cfg index d2b9b27..86fedc8 100644 --- a/zone/server.cfg +++ b/zone/server.cfg @@ -36,7 +36,8 @@ set sv_pure "0" // verifying cilent files set sv_floodProtect "1" // Chat Spam Protection set logfile "1" // Enable loging 1-2? enable. 0 disable. Leave it on if you plan on using B3 or IW4MAdmin. set g_log "logs/games_mp.log" // Gamelog filename. If you edit this, Make sure you change B3.xml if you have bigbrotherbot. IW4MAdmin auto-detects however. -set sv_lobby_mode "mp" // Sets the lobby type to multiplayer +set sv_lobby_mode "mp" // Sets the lobby type to multiplayer. +set sv_skip_lobby "1" // Makes the server load the map immediately instead of waiting at the lobby. Turn this off if you want to use playlists instead(currently required for custom maps). ////////////////////////////////////////////////// // BOT CONFIGURATION // @@ -113,5 +114,4 @@ set cg_thirdPerson "0" // third-person mode // // ////////////////////////////////////////////////////////// -set sv_maprotation "gametype tdm map mp_biodome map mp_spire map mp_sector map mp_apartments map mp_chinatown map mp_veiled map mp_havoc map mp_ethiopia map mp_infection map mp_metro map mp_redwood map mp_stronghold map mp_nuketown_x map mp_shrine map mp_ruins map mp_cryogen map mp_rome map mp_crucible map mp_kung_fu map mp_miniature map mp_western map mp_conduit map mp_rise map mp_arena map mp_city map mp_skyjacked map mp_aerospace map mp_waterpark map mp_banzai map mp_veiled_heyday map mp_redwood_ice" -map_rotate +set sv_maprotation "gametype tdm map mp_biodome map mp_spire map mp_sector map mp_apartments map mp_chinatown map mp_veiled map mp_havoc map mp_ethiopia map mp_infection map mp_metro map mp_redwood map mp_stronghold map mp_nuketown_x map mp_shrine map mp_ruins map mp_cryogen map mp_rome map mp_crucible map mp_kung_fu map mp_miniature map mp_western map mp_conduit map mp_rise map mp_arena map mp_city map mp_skyjacked map mp_aerospace map mp_waterpark map mp_banzai map mp_veiled_heyday map mp_redwood_ice" \ No newline at end of file diff --git a/zone/server_cp.cfg b/zone/server_cp.cfg index abd6938..6335c8d 100644 --- a/zone/server_cp.cfg +++ b/zone/server_cp.cfg @@ -37,6 +37,7 @@ set sv_floodProtect "1" // Chat Spam Protection set logfile "1" // Enable loging 1-2? enable. 0 disable. Leave it on if you plan on using B3 or IW4MAdmin. set g_log "logs/games_cp.log" // Gamelog filename. If you edit this, Make sure you change B3.xml if you have bigbrotherbot. IW4MAdmin auto-detects however. set sv_lobby_mode "cp" // Sets the lobby type to camapaign +set sv_skip_lobby "1" // Makes the server load the map immediately instead of waiting at the lobby. Turn this off if you want to use playlists instead(currently required for custom maps). ////////////////////////////////////////////////// // BASE GAME CONFIGURATION // @@ -73,5 +74,4 @@ set cg_thirdPerson "0" // third-person mod // // ////////////////////////////////////////////////////////////// -set sv_maprotation "gametype coop map cp_mi_eth_prologue" -map_rotate \ No newline at end of file +set sv_maprotation "gametype coop map cp_mi_eth_prologue" \ No newline at end of file diff --git a/zone/server_zm.cfg b/zone/server_zm.cfg index 208558f..8345b25 100644 --- a/zone/server_zm.cfg +++ b/zone/server_zm.cfg @@ -37,6 +37,7 @@ set sv_floodProtect "1" // Chat Spam Protection set logfile "1" // Enable loging 1-2? enable. 0 disable. Leave it on if you plan on using B3 or IW4MAdmin. set g_log "logs/games_zm.log" // Gamelog filename. If you edit this, Make sure you change B3.xml if you have bigbrotherbot. IW4MAdmin auto-detects however. set sv_lobby_mode "zm" // Sets the lobby type to zombies +set sv_skip_lobby "1" // Makes the server load the map immediately instead of waiting at the lobby. Turn this off if you want to use playlists instead(currently required for custom maps). ////////////////////////////////////////////////// // BASE GAME CONFIGURATION //