GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.33k stars 821 forks source link

[Bug]: fn_info_game_con function not found #4246

Closed jiwertz closed 1 year ago

jiwertz commented 1 year ago

User story

As a server administrator, I want the server to retrieve configuration settings from the serversettings.con file

Game

Battlefield 1942

Linux distro

Ubuntu 22.04

Command

command: start, command: details

Further information

After updating to the latest linuxgsm version, when executing any of the bf1942server commands (e.g. start, stop, details, etc..), multiple fn_info_game_con: command not found errors are printed from the info_game.sh script.

It seems that this functionality was recently re-worked, and this function was either removed or not implemented. Battlefield 1942 servers are unable to be started without any manual modifications to the info_game.sh file to ensure that important configuration settings (like server ip, port number, and server password) can be set, and the server be available for users to connect to.

The server starts, but with default settings instead of the settings defined in the serversettings.con file.

Example: serversettings.con file contains the property game.serverPort 14567, but linuxgsm is staring the server on port 0 instead.

Relevant log output

bf1942server@linux-server:~$ ./bf1942server details
fetching GitHub command_details.sh...OK
/home/bf1942server/lgsm/modules/info_game.sh: line 895: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 896: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 897: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 898: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 899: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 895: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 896: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 897: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 898: fn_info_game_con: command not found
/home/bf1942server/lgsm/modules/info_game.sh: line 899: fn_info_game_con: command not found
fetching GitHub info_messages.sh...OK
fetching GitHub query_gamedig.sh...OK

Distro Details
===================================================================================================================
Date:      Fri Jun 16 07:47:50 PM CDT 2023
Distro:    Ubuntu 22.04.2 LTS
Arch:      x86_64
Kernel:    5.19.0-45-generic
Hostname:  linux-server
Uptime:    0d, 1h, 39m
tmux:      tmux 3.2a
glibc:     2.35

Server Resource
===================================================================================================================
CPU         
Model:      AMD Ryzen 7 1700X Eight-Core Processor
Cores:      16
Frequency:  1767.755MHz
Avg Load:   0.43, 0.76, 0.61

Memory                                  
Mem:       total  used   free   cached  available
Physical:  16GB   4.8GB  11GB   7.7GB   11GB
Swap:      2.0GB  0B     2.0GB          

Storage                 
Filesystem:  /dev/sda2  
Total:                  228G
Used:                   111G
Available:   106G       

Network       
IP:           0.0.0.0
Internet IP:  <REDACTED>

Game Server Resource Usage
===================================================================================================================
CPU Used:  16.2%  
Mem Used:  0.4%   76MB

Storage       
Total:        259M
Serverfiles:  157M

Battlefield: 1942 Server Details
===================================================================================================================
Server name:      BFServer
Server Version:   v1.612
Server IP:        0.0.0.0:0
Internet IP:      <REDACTED>:0
Display IP:       <REDACTED>:0
Server password:  NOT SET
Players:          0/32
Current map:      kbely airfield
Status:           STARTED

bf1942server Script Details
===================================================================================================================
Script name:            bf1942server
LinuxGSM version:       v23.3.4
glibc required:         2.0
Discord alert:          on
Email alert:            off
Gotify alert:           off
IFTTT alert:            off
Mailgun (email) alert:  off
Pushbullet alert:       off
Pushover alert:         off
Rocketchat alert:       off
Slack alert:            off
Telegram alert:         off
Update on start:        off
User:                   bf1942server
Location:               /home/bf1942server
Config file:            /home/bf1942server/serverfiles/mods/bf1942/settings/serversettings.con

Backups
===================================================================================================================
No Backups created

Command-line Parameters
===================================================================================================================
 ./start.sh +hostServer 1 +dedicated 1

Ports
===================================================================================================================
Change ports by editing the parameters in:
/home/bf1942server/serverfiles/mods/bf1942/settings/serversettings.con

Useful port diagnostic command:
ss -tuplwn | grep bf1942_lnxded

DESCRIPTION  PORT   PROTOCOL  LISTEN
Game         0      udp       45
Query        22000  udp       1

Status: STARTED

Steps to reproduce

No response

dgibbs64 commented 1 year ago

I belive this should have been resolved by now with PR https://github.com/GameServerManagers/LinuxGSM/pull/4257

jiwertz commented 1 year ago

@dgibbs64, I agree that the "fn_info_game_con: command not found" error is no longer occurring, however, when running the bf1942server details command, it still doesn't appear to be parsing the information from the configuration file correctly.

Battlefield: 1942 Server Details
================================================================================
Server name:      NOT SET
Server IP:        0.0.0.0:0
Internet IP:      <REDACTED>:0
Display IP:       <REDACTED>:0
Server password:  NOT SET
Maxplayers:       0

These properties above should have populated from the serversettings.con file.

After investigating further, I've narrowed down the problem to the fn_info_game_keyvalue_pairs() method. It would seem this method is expecting the second argument (the config file property) to be followed by an = sign, and then the property's value, but Battlefield 1942 doesn't use an equals sign in it's serversettings.con file, it is separated by spaces. Example:

game.serverMaxPlayers 32
game.serverPort 14567

So the fn_info_game_keyvalue_pairs() is unable to parse the properties because of this.

In addition, the fn_info_game_bf1942() method is looking for the wrong property for the server IP. It is looking for game.serverIp, but it should actually be game.serverIP (note the capital "P"). WIthout this change, it is unable to find the correct IP address from the serversettings.con file.

Hopefully this information helps!

dgibbs64 commented 1 year ago

Thanks for this. I will sort out a big fix

dgibbs64 commented 1 year ago

https://github.com/GameServerManagers/LinuxGSM/commit/82e5da4b1d59ac29d8e701846355e5977fbf3e12

jiwertz commented 1 year ago

Seems to be working, for the most part. Not sure it's a major issue, but the new logic for fn_info_game_keyvalue_pairs_space() only captures the last word after the last space for the configuration parameter. So if you have something like the following in the config file:

game.ServerName "My Awesome BFServer"

It comes out as the server name being just "BFServer"

dgibbs64 commented 1 year ago

Thanks. Getting the parsing correct for all configs is a work in progress 😅

github-actions[bot] commented 3 weeks ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.