Config Injector

Discussion in 'Monday Night Combat PC Dedicated Server Discussion' started by Joh, February 11, 2011.

  1. Joh

    Joh New Member

    Messages:
    10
    Likes Received:
    0
    Seeing as config file loading is so extensively asked for, I thought I'd release the tiny app I wrote to load a config for me, and start mncds with the right commandline. It requires .NET Framework 4.0 (or mono I suppose), and needs to be executed from the binary\win32 directory, though it does not necessarily have to reside there itself.

    All command line options are optional, but they are:

    -config={path}: What config file to load. Default is Options.xml.
    -log={path}: What file to log to, default is whatever is in the XML-file, or DedicatedServer.log (actually it depends on the command line in the config file if this is actually used, more on that below)
    -ServerInstance={serverinstance}: Same as the log option, but for server instance. Default if no command line setting and no value in the XML is 0.

    When executing it the first time, it will generate the default config file (which is the same as the recommended command line) after starting the server. The config file itself is in XML-format and the filename if none is given is Options.xml, in the same directory as the program is executed from. It looks like the code below. The {Arguments} part of the command line will be replaced with the merged options, {ServerInstance} and {LogFile} will be replaced with whatever values you've given them. Thus, if you remove any of them, they will not be part of the command line either.

    Note: Seeing as I only intended to use this for my own purposes, it fails silently if the XML file is not well-formed and just launches with the default values. And it crashes if it can't find mncds.exe.

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <MNCInject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Arguments>
        <game>HostileGame.HGameInfo_PreGameLobby</game>
        <ServerDescription>MNCDS - Standard</ServerDescription>
        <bAllowJuicePurch>true</bAllowJuicePurch>
        <bAllowBotPurch>true</bAllowBotPurch>
        <bAllowHazards>true</bAllowHazards>
        <bAllowMascot>true</bAllowMascot>
        <bAllowCustomClass>true</bAllowCustomClass>
        <bAllowChangeClass>true</bAllowChangeClass>
        <bForceRndClass>false</bForceRndClass>
        <bIsLanMatch>false</bIsLanMatch>
        <bIsDedicated>true</bIsDedicated>
        <bAllowTeamSelect>true</bAllowTeamSelect>
        <bAutoBalance>true</bAutoBalance>
        <MatchDuration>2</MatchDuration>
        <OTDuration>2</OTDuration>
        <ClassLimitAssault>6</ClassLimitAssault>
        <ClassLimitTank>6</ClassLimitTank>
        <ClassLimitSupport>6</ClassLimitSupport>
        <ClassLimitAssassin>6</ClassLimitAssassin>
        <ClassLimitGunner>6</ClassLimitGunner>
        <ClassLimitSniper>6</ClassLimitSniper>
        <MinNumToStart>6</MinNumToStart>
      </Arguments>
      <CommandLine>server HostileLobby{Arguments} -ServerInstance={ServerInstance} -log={LogFile} -STEAM_DEDSERVER -seekfreeloadingserver -nohomedir</CommandLine>
      <LogFile>DedicatedServer.log</LogFile>
      <ServerInstance>0</ServerInstance>
    </MNCInject>

    Attached Files:

Share This Page