Multiplayer Server Management

Discussion in 'Developer Portal' started by oniatus, Aug 10, 2016.

  1. oniatus

    oniatus Member

    Hi all,

    I am currently trying to set up a small testserver with some friends. There are some points where I am stumbling at the moment and a helping hand would be awesome :)

    1. How to configure the modules? Let's say I have two different Modules which offer a gameplay and some others which should be tuned by some kind of "server configuration". What I would like to do is just to add some kind of file (e.g. a config.yml?) where i can put everything together (including sections to tune the modules) or a comparable alternative.
    2. I have seen issue and but not used the Facade yet. Before I saw the module, I thought about implementing the server as dropwizard application plus one shared module which allows other modules to add their own extensions to the REST-API. Maybe something similar exists already for a global configuration?
  2. Cervator

    Cervator Project Lead and Community Wizard Staff Member

    So the current way I currently configure a server is somewhat brute force.
    1. Copy in the game zip and extract somewhere, like to /opt/terasology on a Linux host
    2. Run the server with something like "java -Xms256m -Xmx4096m -jar libs/Terasology.jar -homedir=server -headless" from /opt/terasology - this validates that all is well and creates a default config.cfg in the server subdir
    3. Run the game locally with the module config and world gen I want - generates a local config.cfg with the right config for modules and world
    4. Copy paste in the "defaultModSelection" and "worldGeneration" blocks from my local config.cfg into the server's copy.
    5. Stop the server, delete /opt/terasology/server/saves to reset the world, and restart it - now it runs with my desired config
    Should I later want to reset with new module versions I just update the modules in question - yay auto-download! Although boo on in some cases having to restart the game after having modules downloaded due to a different known issue :)

    There are shortcuts of course, could prepare a config.cfg ahead of time, but I find that if I let it generate it keeps a valid permission key I can later consume to gain admin powers. Easy that way, but a little brute force as mentioned. We can do better!

    As for REST API and server facade that would be a great area to put more work into, but I am unsure the current facade has more than a minimal web container setup in it? There might be more to it still hiding in a local workspace somewhere on @msteiger's machine.
  3. oniatus

    oniatus Member

    Thanks for the help :thumbsup:

    I made a small change to the PC facade (Available on my fork, do you think it is worth a PR?) which adds an option to override the default config from a file.
    In my case the file would look something like:
      "defaultModSelection": {
        "modules": [
        "defaultGameplayModuleName": "MyModule"
      "worldGeneration": {
        "worldTitle": "World Title",
        "defaultSeed": "custom seed for the server",
        "defaultGenerator": "MyModule:MyWorldgen"
      "moduleConfigs": {},
      "network": {
        "servers": [
            "name": "localhost",
            "address": "localhost",
            "port": 25777,
            "active": true
        "upstreamBandwidth": 1024,
        "serverPort": 25777,
        "masterServer": ""
    On startup. the engine/default.cfg will be loaded then all possible fields will be overriden by my config file and then all possible fields will be overriden by the local config.cfg (in case of further reloads).
    This way, I can edit some settings without starting the game and still get a fresh admin token or security stuff generated.

    Next thing i want to try is to configure my modules with the configuration file.
    The 'moduleConfigs' property seems like a good place to start but I think it is used mainly by the world generator.
    Also writing stuff like
    on every place where i need a configurable property looks very verbose to me :laugh:
    Any Ideas?
  4. Cervator

    Cervator Project Lead and Community Wizard Staff Member

    Absolutely worth it! Please PR. May want to Checkstyle it real quick, I see a couple potential style violations :)

    Module configuration is done at world creation time then isn't regularly editable after that point (it may be possible to go in and hack at the world save somehow..). We need to make it so you can enable/disable at least some modules for an existing world, such as texture packs.

    Does that help? I'm not sure exactly what you're trying to do in the second half of your post. Configuration of individual modules, like what hot key a particular action is bound to? Might be a similar situation where we need to enhance things a bit and improve game setup and maintenance. Old PR #2074 was an attempted step into that direction, but needs resurrection.
  5. oniatus

    oniatus Member

    Started PR 2437 with the changes.
    Maybe the Eclipse Formatter needs an update too :whistle:

    My use case for the module config:
    Imagine stuff like crafting timers (not for prefabs but general), plant growth time, health regeneration, starving speed, monster spawn rate etc.
    I would like to tune this parameters in the configuration without rebuilding the prefabs. Just edit one file, restart the server and be fine :)
    Similar for the world generator settings ->experimenting at this place right now :geek:.
  6. Cervator

    Cervator Project Lead and Community Wizard Staff Member

    Checked out the PR with some testing and comments :)

    Eclipse hasn't gotten a lot of attention lately or really at all. Feel free to fix things!

    In-game config for timers and such makes sense. We have the world config for facets at game creation time, maybe we could have a similar one for in-game? You could probably take a look at the world gen config one and use a similar format. You could even show both world and in-game content config on the create game screen but only the in-game content config while you're in a world (and have authority / cheat permissions?)

    Might be a bit of work, especially since you'd need a per-world place to store the config. Check out @Rostyslav Zatserkovnyi's new UI editor if needed! :D

Share This Page