Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New launch parameters #44

Open
Micke90s opened this issue Aug 26, 2024 · 8 comments
Open

New launch parameters #44

Micke90s opened this issue Aug 26, 2024 · 8 comments

Comments

@Micke90s
Copy link
Contributor

Micke90s commented Aug 26, 2024

Version 1.0 will add a few new options (see https://store.steampowered.com/news/app/1621690/view/4247544173385794673) which should be available as new launch parameters. These parameters should be set via the environment variables.
Unfortunately, the README of the dedicated server was not updated yet. I took a short view into the source using dnSpy. (File Pug.Base.dll)

[Flags]
public enum WorldMode
{
    Undefined = -1,
    Normal = 0,
    Hard = 1,
    Creative = 2,
    Casual = 4,
    Classic = 5
}
public enum WorldGenerationSettingType
{
    Chaos,
    OreDensity,
    Tunnels,
    Chambers,
    Rivers,
    Lakes,
    Pits,
    CeilingHoles
}
public enum WorldGenerationSettingLevel
{
    Off,
    Low,
    Normal,
    High,
    Extreme
}

I will try to figure out how the parameters are supplied to the dedicated server and add this to a pull request.
May we have luck, and the README will be updated tomorrow with the full 1.0 release. Otherwise, I will dig around.

@Micke90s
Copy link
Contributor Author

Micke90s commented Aug 27, 2024

Short update:
Source Pug.Other.dll class CommandLineArgs

  public const string kPressDemo = "-pdemo";
  public const string kConsumerDemo = "-cdemo";
  public const string kMarketingBuild = "-marketing";
  public const string kCsBackend = "-csbackend";
  public const string kSteamPlaytest = "-playtest";
  public const string kSteamDemo = "-steamdemo";
  public const string kAllowNoSteam = "-allownosteam";
  public const string kNonPlayable = "-nonplayable";
  public const string kNoRgb = "-norgb";
  public const string kExtraChecks = "-extrachecks";
  public const string kWindowScale = "-windowscale";
  public const string kSeason = "-season";
  public const string kDisableAutosave = "-disableautosave";
  public const string kVersionSuffix = "-versionsuffix";
  public const string kServerConfig = "-serverconfig";
  public const string kServerWorldId = "-world";
  public const string kServerWorldName = "-worldname";
  public const string kServerWorldSeed = "-worldseed";
  public const string kServerGameId = "-gameid";
  public const string kServerDataPath = "-datapath";
  public const string kServerMaxPlayers = "-maxplayers";
  public const string kServerWorldMode = "-worldmode";
  public const string kServerSeason = "-season";
  public const string kServerIp = "-ip";
  public const string kServerPort = "-port";
  public const string kExtraLog = "-extralog";
  public const string kNoNetwork = "-nonetwork";
  public const string kSafeMode = "-safemode";
  public const string kConfDir = "-confdir";
  public const string kWaitFor = "-waitfor";
  public const string kScriptsOnly = "-scriptsonly";
  public const string kkScriptDebugging = "-scriptdebugging";
  public const string kPSRegion = "-psregion";
  public const string kPlayFabCustomId = "-playfabcustomid";
  public const string kPlayFabPartyId = "-playfabpartyid";
  public const string kBenchmark = "-benchmark";
  public const string kQuitAfterBenchmark = "-benchmark-quit";
  public const string kBenchmarkOutputBasePath = "-benchmark-output-base-path";
  public const string kForceBenchmarkOptionEnabled = "-forceBenchmarkOptionEnabled";
  public const string kEnableSwitchLinkTimeOptimization = "-enableSwitchLinkTimeOptimization";
  public const string kEnableSwitchRomCompression = "-enableSwitchRomCompression";
  public const string kUseIngameInviteMenu = "-useIngameInviteMenu";
  public const string kDisableSentry = "-disableSentry";
  public const string kDisableBurst = "-disableBurst";
  public const string kNetworkDebug = "-networkDebug";
  public const string kOnScreenDebug = "-onScreenDebug";
  public const string kCreatePatch = "-createPatch";
  public const string kPatchReferencePath1 = "-patchReferencePath1";
  public const string kPatchReferencePath2 = "-patchReferencePath2"

At the moment there seems not to be a new parameter for WorldGenerationSettingType or WorldGenerationSettingLevel

See also source Pug.Other.dll class PrefsManager method ReloadAllSettings.
This method only checks -world, -worldname, -worldseed, -gameid, -maxplayers, -worldmode, -season

@Micke90s
Copy link
Contributor Author

Micke90s commented Aug 28, 2024

Currently there are no launch parameters available. The only way to use the parameters is to generate a new world on the Core Keeper client and transfer the world file to the dedicated server.

I opened a request Dedicated Server - Launch parameter for WorldGenerationSettingType on the official Core Keeper Discord server.

I will keep you updated.

@Micke90s
Copy link
Contributor Author

Micke90s commented Sep 7, 2024

Update 1.0.0.6 added new launch parameters 😁

  • Updated dedicated server README with instructions for creating a world with custom world generation parameters.

https://store.steampowered.com/news/app/1621690/view/4580811814109976003?l=english

@arguser
Copy link
Collaborator

arguser commented Sep 7, 2024

Just downloaded the Dedicated Server and this is what I see on the README.txt

# Core Keeper Dedicated Server

This is the Windows dedicated server for Core Keeper.

## Limitations

The dedicated server is currently only available via Steam, and only allows Steam users to connect to it. This is because the dedicated server does not use a Steam user id, but the networking backend used to connect with non-Steam users needs a user ID for authentication. 

## How to run

You can start the server via the Steam, but the server can also be started without the Steam client.

You can use SteamCMD to download the server files without requiring a login:
steamcmd.exe +login anonymous +app_update 1963720 +quit

The Launch.ps1 file can be used to start the server, or you can start the CoreKeeperServer.exe application directly. Note that apart from the parameters listed in the Configuration section, you need the -batchmode parameter (NOT -nographics since part of the procedural generation is done on the GPU).

A GameID.txt file will be created next to the executable containing the Game ID. If it doesn't appear you can check the log in the same location named CoreKeeperServerLog.txt for errors.

## Configuration

These are the arguments you can use to customize server behaviour with default values. They can also be found and changed in the ServerConfig.json file together with the other save files.

-world 0                                Which world index to use.
-worldname "Core Keeper Server"         The name to use for the server.
-worldseed 0                            The seed to use for a new world. Omit to generate a random seed.
-gameid ""                              Game ID to use for the server. Needs to be at least 28 characters and alphanumeric, excluding Y,y,x,0,O. Empty or not valid means a new ID will be generated at start.
-datapath ""                            Save file location. If not set it defaults to a subfolder named "DedicatedServer" at the default Core Keeper save location.
-maxplayers 100                         Maximum number of players that will be allowed to connect to server.
-worldmode 0                            Sets the world mode for the world. Can be Normal (0), Hard (1), Creative (2), Casual (4). NOTE: Changing between Creative and non-Creative worlds not currently supported.
-port <unset>                           What port to bind to. If not set, then the server will use the Steam relay network. If set the clients will connect to the server directly and the port needs to be open. Use -port 27015 to connect to a server on the same LAN.
-ip 0.0.0.0                             Only used if port is set. Sets the address that the server will bind to.
-season -1                              Overrides current season by setting to any of None (0), Easter (1), Halloween (2), Christmas (3), Valentine (4), Anniversary (5), CherryBlossom (6), LunarNewYear (7). -1 is default setting where it is set depending on system date. You can use either the season name or the corresponding number.

The dedicated server does not have a world parameters UI. Use the following steps to override the default world generation parameters with your own:

1. Create a world using the normal Core Keeper Steam app with the world generation parameters you want.
2. In your save game folder, you will find a "worldgenparams" directory. Copy the file corresponding to the world you just created to the "worldgenparams" directory in the dedicated server folder. If there is no such directory, create it first.
3. Rename the worldgenparams file to match the world index you want to use.
4. Start a new dedicated server world using this world index. It will use the parameters from the file you copied. If you want the exact same world as the one you created in the Steam app, you also need to set the same seed. Otherwise you will get a different world with the same generation parameters.

@Micke90s
Copy link
Contributor Author

Micke90s commented Sep 7, 2024

@arguser Thank you for the information
This is not what I expected 🙁
I will take a look later. May this ist only a JSON file which can be generated with little effort

@Micke90s
Copy link
Contributor Author

Micke90s commented Sep 7, 2024

Just created a worldgenparams file. It is a JSON file but pretty complex.

{
    "globalSeed": 1734723088,
    "worldScale": 1.0,
    "biomeChaos": 0.0,
    "ring1Size": 150.0,
    "ring2Size": 400.0,
    "ring3Size": 1170.0,
    "ring4Size": 1350.0,
    "ring1Chaos": 0.0,
    "ring2Chaos": 0.0,
    "ring3Chaos": 0.0,
    "ring4Chaos": 0.0,
    "dirt": {
        "ResourceCount": 2,
        "resourceDistribution": {
            "x": 0.899999976158142,
            "y": 0.1440060287714,
            "z": 0.185059577226639,
            "w": 0.149000003933907
        },
        "resourceThreshold": 0.300000011920929,
        "riverSize": 0.128000006079674,
        "riverAmount": 1.0,
        "lakeThreshold": 0.0,
        "chamberThreshold": 0.421499997377396,
        "scatteredWallThreshold": 0.13400000333786,
        "ceilingHoleThreshold": 0.0,
        "tunnelThreshold": 0.135000005364418,
        "tunnelAmount": 0.374000012874603,
        "sandThreshold": 0.0410000011324883,
        "sandAmount": 0.610000014305115,
        "pitThreshold": {
            "x": 0.0,
            "y": 0.0
        },
        "biomeEdgePitSize": 15.0,
        "biomeEdgePitLedgeSize": 4.0,
        "biomeSubTileTreshold": 0.305000007152557,
        "explosiveWallAmount": 0.270000010728836
    },
    "clay": {
        "ResourceCount": 4,
        "resourceDistribution": {
            "x": 0.656912505626678,
            "y": 0.142766773700714,
            "z": 0.101939350366592,
            "w": 0.200000002980232
        },
        "resourceThreshold": 0.300000011920929,
        "riverSize": 0.100000001490116,
        "riverAmount": 1.0,
        "lakeThreshold": 0.0,
        "chamberThreshold": 0.375,
        "scatteredWallThreshold": 0.133000001311302,
        "ceilingHoleThreshold": 0.0,
        "tunnelThreshold": 0.125,
        "tunnelAmount": 0.5,
        "sandThreshold": 0.0299999993294477,
        "sandAmount": 0.75,
        "pitThreshold": {
            "x": 0.0,
            "y": 0.0
        },
        "biomeEdgePitSize": 10.0,
        "biomeEdgePitLedgeSize": 4.0,
        "biomeSubTileTreshold": 0.0,
        "explosiveWallAmount": 0.259999990463257
    },
    "stone": {
        "ResourceCount": 4,
        "resourceDistribution": {
            "x": 0.649988532066345,
            "y": 0.156208842992783,
            "z": 0.0920978188514709,
            "w": 0.200000002980232
        },
        "resourceThreshold": 0.300000011920929,
        "riverSize": 0.0939999967813492,
        "riverAmount": 1.0,
        "lakeThreshold": 0.0,
        "chamberThreshold": 0.326999992132187,
        "scatteredWallThreshold": 0.156000003218651,
        "ceilingHoleThreshold": 0.0,
        "tunnelThreshold": 0.101999998092651,
        "tunnelAmount": 0.400000005960464,
        "sandThreshold": 0.122000001370907,
        "sandAmount": 0.282000005245209,
        "pitThreshold": {
            "x": 0.0,
            "y": 0.0
        },
        "biomeEdgePitSize": 10.0,
        "biomeEdgePitLedgeSize": 4.0,
        "biomeSubTileTreshold": 0.0,
        "explosiveWallAmount": 0.25
    },
    "forest": {
        "ResourceCount": 3,
        "resourceDistribution": {
            "x": 0.796570718288422,
            "y": 0.100720882415771,
            "z": 0.200000002980232,
            "w": 0.200000002980232
        },
        "resourceThreshold": 0.300000011920929,
        "riverSize": 0.150000005960464,
        "riverAmount": 1.0,
        "lakeThreshold": 0.0,
        "chamberThreshold": 0.524999976158142,
        "scatteredWallThreshold": 0.0900000035762787,
        "ceilingHoleThreshold": 0.0,
        "tunnelThreshold": 0.0869999974966049,
        "tunnelAmount": 0.5,
        "sandThreshold": 0.0299999993294477,
        "sandAmount": 0.0,
        "pitThreshold": {
            "x": 0.0,
            "y": 0.0
        },
        "biomeEdgePitSize": 10.0,
        "biomeEdgePitLedgeSize": 4.0,
        "biomeSubTileTreshold": 0.280000001192093,
        "explosiveWallAmount": 0.0
    },
    "desert": {
        "ResourceCount": 3,
        "resourceDistribution": {
            "x": 0.791023194789886,
            "y": 0.102215066552162,
            "z": 0.200000002980232,
            "w": 0.200000002980232
        },
        "resourceThreshold": 0.300000011920929,
        "riverSize": 0.0610000006854534,
        "riverAmount": 0.5,
        "lakeThreshold": 0.0,
        "chamberThreshold": 0.75,
        "scatteredWallThreshold": 0.0,
        "ceilingHoleThreshold": 0.0,
        "tunnelThreshold": 0.32600000500679,
        "tunnelAmount": 0.788999974727631,
        "sandThreshold": 0.0399999991059303,
        "sandAmount": 0.0,
        "pitThreshold": {
            "x": 0.0,
            "y": 0.0
        },
        "biomeEdgePitSize": 10.0,
        "biomeEdgePitLedgeSize": 4.0,
        "biomeSubTileTreshold": 0.0,
        "explosiveWallAmount": 0.0
    },
    "sea": {
        "ResourceCount": 3,
        "resourceDistribution": {
            "x": 0.790434718132019,
            "y": 0.102803319692612,
            "z": 0.200000002980232,
            "w": 0.200000002980232
        },
        "resourceThreshold": 0.300000011920929,
        "riverSize": 0.400000005960464,
        "riverAmount": 1.0,
        "lakeThreshold": 0.0,
        "chamberThreshold": 0.463499993085861,
        "scatteredWallThreshold": 0.263000011444092,
        "ceilingHoleThreshold": 0.0,
        "tunnelThreshold": 0.100000001490116,
        "tunnelAmount": 0.5,
        "sandThreshold": 0.0299999993294477,
        "sandAmount": 0.0,
        "pitThreshold": {
            "x": 0.0,
            "y": 0.0
        },
        "biomeEdgePitSize": 15.0,
        "biomeEdgePitLedgeSize": 10.0,
        "biomeSubTileTreshold": 0.0,
        "explosiveWallAmount": 0.0
    },
    "crystal": {
        "ResourceCount": 1,
        "resourceDistribution": {
            "x": 0.200000002980232,
            "y": 0.200000002980232,
            "z": 0.200000002980232,
            "w": 0.200000002980232
        },
        "resourceThreshold": 0.469999998807907,
        "riverSize": 0.150000005960464,
        "riverAmount": 1.0,
        "lakeThreshold": 0.0,
        "chamberThreshold": 0.375,
        "scatteredWallThreshold": 0.0750000029802322,
        "ceilingHoleThreshold": 0.0,
        "tunnelThreshold": 0.0799999982118607,
        "tunnelAmount": 0.5,
        "sandThreshold": 0.5,
        "sandAmount": 0.0,
        "pitThreshold": {
            "x": 0.0,
            "y": 0.0
        },
        "biomeEdgePitSize": 10.0,
        "biomeEdgePitLedgeSize": 4.0,
        "biomeSubTileTreshold": 0.0,
        "explosiveWallAmount": 0.0
    },
    "passage": {
        "ResourceCount": 0,
        "resourceDistribution": {
            "x": 0.200000002980232,
            "y": 0.200000002980232,
            "z": 0.200000002980232,
            "w": 0.200000002980232
        },
        "resourceThreshold": 0.0,
        "riverSize": 0.136000007390976,
        "riverAmount": 1.0,
        "lakeThreshold": 0.0,
        "chamberThreshold": 0.190500006079674,
        "scatteredWallThreshold": 0.0299999993294477,
        "ceilingHoleThreshold": 0.0,
        "tunnelThreshold": 0.207000002264977,
        "tunnelAmount": 0.400000005960464,
        "sandThreshold": 0.0,
        "sandAmount": 0.0,
        "pitThreshold": {
            "x": 0.0311711970716715,
            "y": 0.0
        },
        "biomeEdgePitSize": 7.78000020980835,
        "biomeEdgePitLedgeSize": 0.0,
        "biomeSubTileTreshold": 0.0,
        "explosiveWallAmount": 0.0
    }
}

@Micke90s
Copy link
Contributor Author

Micke90s commented Sep 8, 2024

The values of the JSON file are defined in the WorldGen.Runtime.dll. Based on the WorldGenerationSettingLevel the values are set by predefined float values.

It would be possible to create a script which sets the same values, but maintaining this is hard work as Pugstorm can change this on every update. Another option would be to use WorldGen.Runtime.dll in a self-written program or script. (I know that PowerShell can include .Net libraries native, but I have not seen this on Linux yet 🤔 )

I don’t want to increase the Dockerfile to an extreme size only for this feature.

I will play around here a bit to check the possibilities.

@arguser
Copy link
Collaborator

arguser commented Sep 9, 2024

Looks like a pretty advanced feature which not many would play with... Could be good to be able to inject the configuration for those who like to experiment but not much else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@arguser @Micke90s and others