R2Northstar / Northstar

Repo for packaged Northstar releases
https://northstar.tf/
MIT License
1.69k stars 129 forks source link

Allow specifying server settings outside of `autoexec_ns_server.cfg` #430

Open GeckoEidechse opened 1 year ago

GeckoEidechse commented 1 year ago

Instead of requiring server owners to modify R2Northstar/mods/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg, they should just be able to set these values using launch arguments or some other config file outside of the core Northstar mods folder.

The reason for this being that, by changing this approach we can treat all core Northstar mods folders as "owned by Northstar" meaning updaters can e.g. replace all core mods folders on an update without having to worry about destroying any information added by the user.

For example, we had talks before about how we want to change the master server API URL, yet we won't be able to do this until this issue is resolved as VTOL (and I think also Viper) save the contents of autoexec_ns_server.cfg and restore them after an updating, meaning that if we roll out a change to ns_masterserver_hostname a decent chunk of our playerbase will not receive the updated hostname.

uniboi commented 1 year ago

Instead of requiring server owners to modify R2Northstar/mods/Northstar.CustomServers/mod/cfg/autoexec_ns_server.cfg, they should just be able to set these values using launch arguments or some other config file outside of the core Northstar mods folder.

They should just make a mod that executes SendToConsole( "exec custom_exec.cfg" ) on startup

GeckoEidechse commented 1 year ago

They should just make a mod that executes SendToConsole( "exec custom_exec.cfg" ) on startup

Hmm, making a mod (i.e. specifying mod.json and everything) might be a bit too much overhead but could work. If custom_exec.cfg only contains some of the convars specified in autoexec_ns_server.cfg, it would only update those right?

uniboi commented 1 year ago

actually, exec needs a client (connected) so it won't work for dedicated servers :trollface:

uniboi commented 1 year ago

nah I was wrong, SendToConsole needs a client connected (duh) My method works fine with ServerCommand and yes, no info from the ns autoexec gets overwritten unless you explicitly tell it to

uniboi commented 1 year ago

Odd.CustomServerConfig.zip Made a quick example mod. The only downside is that the cfg gets applied every time the map changes

GeckoEidechse commented 1 year ago

Maybe example mod that changes servername would've been better given that's what we're trying to achieve here :P

That being said, using a mod "feels too complicated" for someone just starting out on setting up a server, so I don't think it would suffice as a "replacement" ^^

uniboi commented 1 year ago

A server config template could be uploaded to thunderstore so a server host would just need to download it and edit the config

pg9182 commented 1 year ago

I will be doing this as part of APIv1, which is also when we'll be changing the hostname.

GeckoEidechse commented 1 year ago

We will definitely need some non-breaking mechanism to handle clients that don't switch over then though. I know Viper has a mechanism to always finish its own update check before checking for Northstar update and so will always update itself before updating Northstar, so a patch for Viper and Northstar and be provided pretty much at the same time.

However I cannot say the same for VTOL, so there's a decent chance that a player won't have an updated version of VTOL and such will keep the old domain in their cfg and therefore we will have to take care of that scenario for at least some time period...

pg9182 commented 1 year ago

Might be best to use a new convar from the start, maybe called ns_atlas_url or smth.

GeckoEidechse commented 1 year ago

Might be best to use a new convar from the start, maybe called ns_atlas_url or smth.

If we set the new convar in the same cfg file, then there's no point in adding a new one though as Viper/VTOL don't do any "smart" merging of changes but simply restore the previous file.

Hence we should make sure to solve this issue first and then give enough time between updates so that Viper/VTOL can roll out patches...