palworld-server-docker icon indicating copy to clipboard operation
palworld-server-docker copied to clipboard

Game settings via command-line arguments

Open Twinki14 opened this issue 1 year ago • 7 comments

This came up in https://github.com/thijsvanloef/palworld-server-docker/issues/40#issuecomment-1902791711

Since Palworld uses UE, instead of modifying the PalWorldSettings.ini directly, we should be able to pass in arguments in the start script

This would offer a FAR better alternative than modifying PalWorldSettings.ini directly, and would only really require a new environment variable and documentation, such as INI_ARGS or ARGS

chrome_DIrmpoSWKK

Twinki14 avatar Jan 22 '24 20:01 Twinki14

Trying that now!

thijsvanloef avatar Jan 22 '24 20:01 thijsvanloef

Trying that now!

Any update on if this works?

xHyperElectric avatar Jan 23 '24 19:01 xHyperElectric

@xHyperElectric Have not been able to get it working sadly, but I haven't had the time to work on it much.

thijsvanloef avatar Jan 23 '24 19:01 thijsvanloef

Hey @thijsvanloef @Twinki14,

I've now been trying all kinds of different versions of the argument for around 2.5hours.

I cannot get it to work. :(

Some of the arguments ive tried:

STARTCOMMAND="${STARTCOMMAND} -ini:Pal:[/Script/Pal.PalGameWorldSettings]:RCONEnabled=True"
STARTCOMMAND="${STARTCOMMAND} -ini:PalWorldSettings:[/Script/Pal.PalGameWorldSettings]:RCONEnabled=True"
STARTCOMMAND="${STARTCOMMAND} -ini:PalGameWorldSettings:[/Script/Pal.PalGameWorldSettings]:RCONEnabled=True"
STARTCOMMAND="${STARTCOMMAND} -ini:Pal.PalGameWorldSettings:[/Script/Pal.PalGameWorldSettings]:RCONEnabled=True"
STARTCOMMAND="${STARTCOMMAND} -ini:PalWorldSettings:RCONEnabled=True"
STARTCOMMAND="${STARTCOMMAND} -ini:PalGameWorldSettings:RCONEnabled=True"
STARTCOMMAND="${STARTCOMMAND} -ini:/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini:RCONEnabled=True"
STARTCOMMAND="${STARTCOMMAND} -ini:/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings:RCONEnabled=True"

STARTCOMMAND="${STARTCOMMAND} -ini:Pal:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:Game:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:Engine:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:GameUserSettings:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:RuntimeOptions:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:GameplayTags:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:palworld:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini://Pal/Saved/Config/LinuxServer/PalWorldSettings.ini:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini://PalWorldSettings:[/Script/Pal.PalGameWorldSettings]:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini:ServerName=TEST_TEST"
STARTCOMMAND="${STARTCOMMAND} -ini:/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings:ServerName=TEST_TEST"

MSpreckels avatar Jan 25 '24 14:01 MSpreckels

Hey @thijsvanloef @Twinki14,

I've now been trying all kinds of different versions of the argument for around 2.5hours.

I cannot get it to work. :(

Since the OptionSettings is a full object, try this

-ini:PalGameWorldSettings:[/Script/Pal.PalGameWorldSettings]:OptionSettings=(Difficulty=None,DayTimeSpeedRate=2.0,NightTimeSpeedRate=1.5,ExpRate=0.5,PalCaptureRate=1.2,PalSpawnNumRate=0.8,...)

Twinki14 avatar Jan 25 '24 19:01 Twinki14

Right..that would make sense. :D

I'll have a look again tomorrow after work

MSpreckels avatar Jan 25 '24 21:01 MSpreckels

Hey, IT WORKS....kind of..

I can get it to work with one parameter but as soon as a add a second one or ALL (which made sense to me because thats basically the file via CLI) it will not work anymore.

Currently I've only tried using the RCONEnabled parameter. Next I wanna try to connect to my local server to see if other params are even set.

Here are some things i tried:

# using the default palworldsettings file
# does not work??
#PARAMS='Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="Default Palworld Server",ServerDescription="",AdminPassword="",ServerPassword="",PublicPort=8211,PublicIP="",RCONEnabled=True,RCONPort=25575,Region="",bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt"'

# works, i can run rcon-cli info
#PARAMS='RCONEnabled=True'

# works
#PARAMS='ServerPlayerMaxNum=1'

# rcon-cli info does not work anymore
#PARAMS='ServerName=Hello World,RCONEnabled=True'

# rcon-cli info does not work anymore
#PARAMS='ServerName="Hello World",RCONEnabled=True'

# rcon-cli info does not work anymore
#PARAMS='ServerName=\"Hello World\",RCONEnabled=True'

# thought it might be the ServerName but doesnt work either
#PARAMS='ServerPlayerMaxNum=1,RCONEnabled=True'

# this works but the ServerName is still "Default Palworld Server"
#STARTCOMMAND="${STARTCOMMAND} -ini:PalWorldSettings:[/Script/Pal.PalGameWorldSettings]:OptionSettings='(ServerName=\"Hello World\")'"
#STARTCOMMAND="${STARTCOMMAND} -ini:PalWorldSettings:[/Script/Pal.PalGameWorldSettings]:OptionSettings='(RCONEnabled=True)'"

edit: ive set ServerPlayerMaxNum=1 and its being applied. It seems that only one param can be set. Now that we have a discord maybe we can have a chat/call later on :)

MSpreckels avatar Jan 26 '24 16:01 MSpreckels

Hey, IT WORKS....kind of..

Might be a limitation with UE, interesting 🤔

I think for now the best thing to do would be to only support ini file editing & the few things we can pass via args, I thought perhaps this would offer us something solid and easy

OR we look into tools such as https://github.com/bitnami/ini-file / https://github.com/dbohdan/initool, feeding & reading environment variables into such a tool would be fairly simple, but providing default values would be harder (Assuming that if we set ANYTHING in the ini file, all defaults get overriden)

Twinki14 avatar Jan 28 '24 01:01 Twinki14

Another option would be to prefill the ini file with environment variable placeholders and use envsubst to set those.

You could set a default there.

-ini:PalGameWorldSettings:[/Script/Pal.PalGameWorldSettings]:OptionSettings=(Difficulty=${DIFFICULTY:-None},....

Link: https://stackoverflow.com/a/2013589

MSpreckels avatar Jan 28 '24 08:01 MSpreckels