Configuring Additional Parameters Using AMPTemplates

I’m hoping someone who understands a bit (read: a lot, as I’m very new to this) more about the interaction between the config JSON files and the files on a given instance can help me understand if there’s a method to accomplish the following:

Create a “Server Configuration” page parameter which affects or modifies an INI file located in the server installation directory.

Here’s an example of a config object which doesn’t modify the INI:

{
“DisplayName”:“Galaxy Seed”,
“Category”:“Server Settings”,
“Description”:“Sets the seed to generate the galaxy. Alphanumeric characters only. Default is 0. Changing this after the server has been running and players logged in can lead to broken saves”,
“Keywords”:“galaxy,seed”,
“FieldName”:“Seed”,
“InputType”:“text”,
“IsFlagArgument”:false,
“ParamFieldName”:“seed”,
“IncludeInCommandLine”:true,
“SkipIfEmpty”:true,
“DefaultValue”:“0”,
“EnumValues”: {}
}

This appears to append a parameter to the server start, i.e., it modifies the command from “server.exe” to “server.exe -seed numberValue”. That indirectly ends up modifying the server.ini file value seed=numberValue in this instance, but if there’s no parameter available for the “server.exe” which matches, then this won’t work.

What I’m looking to do using the config JSON, or find another method to do, is modify the value of a given parameter inside the INI file instead, but I can’t find any examples of that anywhere, so I’m not sure if it’s reasonable or possible.

And please, if there’s info on why this isn’t possible, or a guide on how to do this already, then I definitely missed it in searching, so feel free to link it to me so I can go digging on how to do this myself.

Thanks!

Heaps of templates do this.

You need a metaconfig to tell AMP what file to write and in what format, you need ParamFieldName in the config manifest to point to the setting, and IncludeInCommandLine should be false

Thanks! Since your reply I’ve been looking around into figuring out how it works in other profiles, and will plan some test pushes on the fork I made to see if I can get my own copied configs working. I think the bit I was missing to understanding it was the metaconfig.

If I manage to get some stuff built out and working for some of the servers, and you’re interested, I can link it if it’s useful to merge up to the main template repo.

Create a PR if you get it into a working state. What server are you talking about?

I’m mainly looking at Avorion at the moment. I’ll probably check a couple others including Conan Exiles and Open World - Rimworld. If I find something I can add to those I may look into adding to those too.

A decision was made previously with Conan not to add everything to the AMP UI given it has a detailed in game admin panel.

Re Open World, the devs have recently stopped development and open sourced it. May not be worth spending time on it.

Bear in mind that the config file either has to be downloaded with the server files or the template has to supply it.

Thanks for the heads up. I’ll pass on the Conan and Open World mod then, unless something changes with the development status on Open World.

Are there any similar concerns with adding some more settings in for Avorion? I’m mostly doing it just to learn, since it’s easier to make my (mostly) one-off changes using the ini file, but figured it’s worth making my learning useful if I can.

Dunno, been a while since I looked at that server? Is the config there from download? Is it only created on first server start? Does it have to be manually added?

Looks like you made this as the metaconfig a couple years back:

[
    {
        "ConfigFile":"galaxies/{{GalaxyName}}/server.ini",
        "AutoMap":true,
        "ConfigType":"ini",
        "ConfigFormatRegex":"^(?<key>.+?)=(?<value>.*?)$"
    }
]

If I’m following along, that means this should map from the instance to the server.ini file in key/value pairs, so I’d just need to make the key/value pairs in the config JSON that match the parameters I wanted to set in server.ini?

Indeed. What’s the ini content look like?

Here’s a copy of a (mostly) default one, looks pretty standard I think:

[Game]
Scenario=1
Seed=0
Difficulty=2
HardcoreEnabled=true
InfiniteResources=false
PlayTutorial=false
CollisionDamage=1
SafePlayerInput=false
PlayerToPlayerDamage=true
LogoutInvincibility=true
LogoutInvincibilityDelay=30
ShipyardBoundBuilding=true
FullBuildingUnlocked=false
RepairingAlwaysAllowed=false
BlockOverlapExploit=false
PermaDestruction=true
DockingRestrictions=true
Barrier=true
Storyline=true
BehemothEvents=false
UnlimitedProcessingPower=false
UnlimitedShipSize=false
RelationLossFactor=1
RelationGainFactor=1
StartingResources=2
DamageMultiplier=1.20000005
InitialRelations=2
MapFactions=350
Rifts=200
ResourceAsteroidFactor=1
ResourceWreckageFactor=1
EventsFactor=1
PreciseAIAim=true
BlockDestructionThreshold=1.10000002
DevMode=false
ExplicitCallables=true
RiftMassFactor=1
RiftDamageFactor=1
BigWreckageDespawnTime=1800
SmallWreckageDespawnTime=900
MaximumFightersPerSectorAndPlayer=-1
MaximumStationsPerSector=-1
MaximumBlocksPerCraft=-1
MaximumVolumePerShip=-1
MaximumVolumePerStation=-1
MaximumPlayerShips=-1
MaximumPlayerStations=-1
MaximumAllianceShips=-1
MaximumAllianceStations=-1
MaximumAllianceShipsPerMember=-1
MaximumAllianceStationsPerMember=-1
MaximumBlocksPerTurret=250
BoardingAllowed=true
MinimumCraftSize=0
MaxShipVelocity=0
PlayerInventorySlots=1000
AllianceInventorySlots=1000
Version=2.4.3
sameStartSector=true
xsotanInvasionSectors=5
startUpScript=data/scripts/server/server.lua
startSectorScript=startsector
motd=
[System]
MaxTimeStep=1
saveInterval=300
sectorUpdateTimeLimit=300
emptySectorUpdateInterval=0.5
workerThreads=4
generatorThreads=2
scriptBackgroundThreads=2
aliveSectorsPerPlayer=5
weakUpdate=true
profiling=false
sendCrashReports=true
hangDetection=true
backups=true
backupsPath=
statsLogging=true
simulateHighLoadServer=false
commandsFile=
sendSectorDelay=2
placeInShipOnDeathDelay=7
respawnAloneDelay=12
respawnMultiplayerDelay=92
autoSavePerformanceData=false
performanceDataAutoSaveFiles=10
timeBetweenPerformanceDataAutoSaves=30
fileClustering=false
clusterFileSize=200000000
clusteringThreads=8
[Networking]
port=27003
broadcastInterval=5
isMultiplayer=true
isListed=true
vacSecure=true
sendStatsToAdmins=true
useSteam=true
forceSteam=false
rconIp=
rconPassword=46b856eea95645498f298e75b230562a
rconPort=27007
maxReceivableMessageSize=52428800
networkingThreads=2
safeBytesPerClientPerTick=1048576
suspiciousTickHistorySize=50
maxSuspiciousTicks=30
[Administration]
maxPlayers=10
name=
description=
password=
pausable=false
accessListMode=Blacklist
steamIdOverride=0
[Meta]
branch=

OK, so ParamFieldNames will be like:

Game.Scenario

or

System.MaxTimeStep

Testing so far looks successful, thanks a ton for the helping me sort everything out!

It seems to work fine even if the changes are made prior to the download of the server bits through SteamCMD. It simply applies the changes once the server.ini is created in the expected directory. I’ll do a quick test actually in game when I have some free time.

I’m going to finish up trying to get the most common settings I’ve seen changed for Avorion servers at least configured, then once I have those and an in game test, I can work out how to request a PR.

Thanks again!

If the file is not created until the server is started, the template should really supply a default file. Otherwise users will be wondering why their settings configured in the UI are not applied on the first start.

I do see a couple parameters that were already in the template which require galaxy generation first (Administration.password and Administration.description). That seems like it would be the same case with any additional settings which are modifying the INI as well.

Two settings I noticed don’t actually work. Game.MapFactions and Game.Rifts both don’t seem to be sticking no matter which way I try (before galaxy generation, after generation while server is on, after generation while server is off). I suspect it’s like you say and there needs to be an INI template supplied prior to galaxy generation, though that’s beyond my skill level at the moment.

The other settings I’m testing do seem to work, even prior to galaxy generation, but for consistency I think the galaxy should ideally already be generated, and then the server needs to be off, otherwise things get messy fast. If the server was powered on, the values in the INI change initially but are reset to their current running state by the server itself, which leads to desync between the console and the INI even in already generated galaxies.

I’m guessing these kinds of complications are part of the reason behind the config template for Avorion being somewhat sparse. If an INI template would solve that, and there’s a way for me to learn how to do that I’m willing to try.

In any case, thanks again for all the help with this. I’ve learned quite a bit and now have a template that’s working well for my purposes even if it may not be in a state for public consumption due to the desync problem and missing INI template.

There are plenty of other template examples which have a default config on GitHub that is downloaded when the server is updated