feat(rw): migrate rising world to unity engine (#4261)

* refactor: update default executable name for Rising World server

The default executable name for the Rising World server has been updated from "server.jar" to "RisingWorldServer.x64". This change ensures that the correct executable is used when launching the game server.

* refactor(rw): no longer java

The code in `info_messages.sh` has been refactored to simplify the port command for multiple game servers. This change improves readability and maintainability.

* refactor: simplify info_game_rw function

The info_game_rw function has been refactored to remove redundant code and improve readability. The configuration values are now retrieved using the fn_info_game_keyvalue_pairs function, which reduces duplication and improves maintainability. Additionally, the default values for configip, gamemode, maxplayers, port, queryport, rconport, seed, servername, and worldname have been set to appropriate fallback values if they are not found in the server configuration file.

* refactor: remove unnecessary game ports and query HTTP port

The code changes in this commit refactor the `info_messages.sh` file by removing unnecessary game ports and the query HTTP port. This simplifies the code and improves readability.

* refactor: update queryport calculation in info_game.sh

The code change updates the calculation of the queryport variable in the info_game.sh script. Instead of assigning it the same value as port, it now subtracts 1 from the port value. This ensures that queryport is set correctly for further use in the script.

* feat: add branch configuration option for rwserver

This commit adds a new configuration option `branch` to the `_default.cfg` file in the `rwserver` directory. The default value is set to "unity". This allows users to specify a specific branch for SteamCMD when installing or updating the server.

* refactor: update default game server configuration

The default game server configuration file has been updated to reflect the following changes:
- Removed the predefined parameter `javaram`
- Updated the value of `consoleinteract` to "yes"
- Updated the values of `engine` and `glibc`

These changes ensure that the default configuration is more up-to-date and aligned with the desired behavior for a Rising World game server.

* refactor: remove unnecessary code for game+1, game+2, and game+3

The code changes in this commit involve removing unnecessary code related to the variables port2, port3, and port4. These variables were used to display information about additional games (game+1, game+2, and game+3) in the output. However, since these variables are not being used elsewhere in the script, they have been removed along with the corresponding echo statements. This refactor simplifies the code by eliminating redundant logic.
This commit is contained in:
Daniel Gibbs 2023-07-11 17:27:34 +01:00 committed by GitHub
parent c13a7d003f
commit ce9f864f24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 81 deletions

View File

@ -8,9 +8,6 @@
#### Game Server Settings ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
javaram="2048" # -Xmx$2048M
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
startparameters=""
@ -115,7 +112,7 @@ sleeptime="0.5"
appid="339010"
steamcmdforcewindows="no"
# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
branch=""
branch="unity"
betapassword=""
# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server
steammaster="false"
@ -145,13 +142,13 @@ querytype="protocol-valve"
## Console type
consoleverbose="yes"
consoleinteract="no"
consoleinteract="yes"
## Game Server Details
# Do not edit
gamename="Rising World"
engine="risingworld"
glibc="null"
engine="unity3d"
glibc="2.17"
#### Directories ####
# Edit with care
@ -159,8 +156,7 @@ glibc="null"
## Game Server Directories
systemdir="${serverfiles}"
executabledir="${serverfiles}"
preexecutable="java -Xmx${javaram}M -jar"
executable="./server.jar"
executable="./RisingWorldServer.x64"
servercfgdir="${systemdir}"
servercfg="server.properties"
servercfgdefault="server.properties"

View File

@ -32,25 +32,6 @@ echo -e "=================================================================="
else
echo -e "Game:"
fi
if [ "${shortname}" == "rw" ]; then
if [ -v port2 ]; then
echo -e "Game+1: \t${port2} \t$(ss -tupl | grep -c "${port}") \t$(ss -tupl | grep "${port2}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${port2}" | grep udp | awk '{ print $2 }')"
else
echo -e "Game+1:"
fi
if [ -v port3 ]; then
echo -e "Game+2: \t${port3} \t$(ss -tupl | grep -c "${port}") \t$(ss -tupl | grep "${port3}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${port3}" | grep udp | awk '{ print $2 }')"
else
echo -e "Game+2:"
fi
if [ -v port4 ]; then
echo -e "Game+3: \t${port4} \t$(ss -tupl | grep -c "${port}") \t$(ss -tupl | grep "${port4}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${port4}" | grep udp | awk '{ print $2 }')"
else
echo -e "Game+3:"
fi
fi
if [ "${shortname}" == "pvr" ]; then
if [ -v port401 ]; then
echo -e "Game+400: \t${port401} \t$(ss -tupl | grep -c "${port401}") \t$(ss -tupl | grep "${port401}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${port401}" | grep udp | awk '{ print $2 }')"

View File

@ -1744,52 +1744,26 @@ fn_info_game_rust() {
}
fn_info_game_rw() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
serverpassword="${unavailable}"
rconpassword="${unavailable}"
rconport="${zero}"
maxplayers="${zero}"
port="${zero}"
port2="${zero}"
port3="${zero}"
port4="${zero}"
queryport="${zero}"
gamemode="${unavailable}"
worldname="${unavailable}"
else
servername=$(grep "server_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
serverpassword=$(grep "server_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/rcon_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
rconport=$(grep "rcon_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
maxplayers=$(grep "settings_max_players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
port=$(grep "server_port" "${servercfgfullpath}" | grep -v "database_mysql_server_port" | grep -v "#" | tr -cd '[:digit:]')
port2=$((port + 1))
port3=$((port + 2))
port4=$((port + 3))
queryport="${port}"
httpqueryport=$((port - 1))
gamemode=$(grep "settings_default_gamemode=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/settings_default_gamemode//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
worldname=$(grep "server_world_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_world_name//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
configip=$(grep "server_ip" "${servercfgfullpath}" | grep -v "database_mysql_server_ip" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/server_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
# Not set
servername="${servername:-"NOT SET"}"
serverpassword="${serverpassword:-"NOT SET"}"
rconpassword="${rconpassword:-"NOT SET"}"
rconport="${rconport:-"0"}"
maxplayers="${maxplayers:-"0"}"
port="${port:-"0"}"
port2="${port2:-"0"}"
port3="${port3:-"0"}"
port4="${port4:-"0"}"
queryport="${queryport:-"0"}"
httpqueryport="${httpport:-"0"}"
gamemode="${gamemode:-"NOT SET"}"
worldname="${worldname:-"NOT SET"}"
configip="${configip:-"0.0.0.0"}"
if [ -f "${servercfgfullpath}" ]; then
fn_info_game_keyvalue_pairs "configip" "Server_IP"
fn_info_game_keyvalue_pairs "gamemode" "World_GameMode"
fn_info_game_keyvalue_pairs "maxplayers" "Server_MaxPlayers"
fn_info_game_keyvalue_pairs "port" "Server_Port"
fn_info_game_keyvalue_pairs "rconport" "RCON_Port"
fn_info_game_keyvalue_pairs "seed" "World_Seed"
fn_info_game_keyvalue_pairs "servername" "Server_Name"
fn_info_game_keyvalue_pairs "worldname" "World_Name"
fi
configip="${configip:-"0.0.0.0"}"
gamemode="${gamemode:-"NOT SET"}"
maxplayers="${maxplayers:-"0"}"
port="${port:-"0"}"
queryport="$((port - 1))"
rconport="${rconport:-"0"}"
seed="${seed:-"0"}"
servername="${servername:-"NOT SET"}"
worldname="${worldname:-"NOT SET"}"
}
# Config Type: custom

View File

@ -698,7 +698,7 @@ fn_info_message_ports() {
portcommand="ss -tuplwn | grep AvorionServer"
elif [ "${shortname}" == "bf1942" ]; then
portcommand="ss -tuplwn | grep bf1942_lnxded"
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "nec" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "rw" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "nec" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then
portcommand="ss -tuplwn | grep java"
elif [ "${shortname}" == "terraria" ]; then
portcommand="ss -tuplwn | grep Main"
@ -1352,14 +1352,7 @@ fn_info_message_rw() {
{
fn_port "header"
fn_port "Game" port udp
fn_port "Game+1" port2 udp
fn_port "Game+2" port3 udp
fn_port "Game+3" port4 udp
fn_port "Game+1" port2 tcp
fn_port "Game+2" port3 tcp
fn_port "Game+3" port4 tcp
fn_port "Query" queryport tcp
fn_port "Query HTTP" httpqueryport tcp
fn_port "RCON" rconport tcp
} | column -s $'\t' -t
}