Sign in to follow this  
Ricoom

Creating more than 2 worlds (shards/servers) from Client

Recommended Posts

Ricoom    15

 I understand why

os.execute

function has been taken out of lua. What I do not understand is why is 

TheSystemService:StartDedicatedServers

hardcoded to work with only 2 servers (1 master and 1 shard). As a fellow developer I have gone trough fair length to try to get info on the function in question and finally decided to decompile your exe ( do not ban me ;P) To find out the server config generation has been hardcoded. Has anybody else tried to figure out or hack around the limitation?   As far as I have gathered when creating a world it creates folders and ini files to save folder and although we can't

os.execute

we can create files, but everything i have tried will still result only 2 servers being launched. What I am trying to achieve is to launch third world (or any number really above that) besides the two that allready exist. 

well there is way to do this with dedicated server launch commands but as os.execute is nowhere to be found can't emulate that either. 

dontstarve_dedicated_server_nullrenderer -console -cluster MyClusterName -shard Master
dontstarve_dedicated_server_nullrenderer -console -cluster MyClusterName -shard Caves

 

Edited by Ricoom

Share this post


Link to post
Share on other sites
Ricoom    15
scripts/screens/redux/servercreationscreen.lua

line 464

it is part of custom class that calls direct system function in executable. that can be found when decompiling exe. its bigger mess as decompiling is not exact but gives out enough info to make out what it is capable 

@ThemInspectors

 

Most likeley it is made because lua files can't actually start the servers without os.execute so they delegate it to c++, but as a modder we can't do the same. And I would like to be able to add to the ability to create overworld and caves. But sadly hardcoding is denying this ability on Klei side. I prolly could generate the extra shard configs in lua but with no way to run the server from game its bit pointless.

Edited by Ricoom

Share this post


Link to post
Share on other sites
ThemInspectors    250
7 minutes ago, Ricoom said:

scripts/screens/redux/servercreationscreen.lua

line 464

it is part of custom class that calls direct system function in executable. that can be found when decompiling exe. its bigger mess as decompiling is not exact but gives out enough info to make out what it is capable 

@ThemInspectors

 

Wow! Thanks, that's interesting. It's sort of the TheNet in a way, You think that the DST Binary would be obfuscated? I would try to decompile it but I don't have a decompiler handy.

Share this post


Link to post
Share on other sites
Ricoom    15

Well I got enough info out of it. with IDA Pro Free. not a pro at binarys and assembler but I know my way around code. I mean I wrote about this to @Bigfoot and @Ipsquiggle as well as to Klei Support but devs didn't answer at all and support was very unhelpful. I know this is very internal piece of code that 99% of people won't ever need, but in my opinion it closese off entire section for modding possibilities and it needs to be addressed.

Share this post


Link to post
Share on other sites
Ricoom    15
2 hours ago, UrmaneHendrake said:

Regardless of why, see

http://steamcommunity.com/sharedfiles/filedetails/?id=595764362

for a way to address what appears to be your overall issue (starting more than 2 shards).  I currently run a dedicated server with three forests and one cave, all interconnected via sinkholes.

Yeah thats not the issue here.. you can easily set it up with no worries but you are not launching them from client are you now. the idea of this thread is to figure out a way or to point out the need for launching 3+ servers from CLIENT. Point is that most players are not gonna setup a dedicated server to play multi world mod. 

Share this post


Link to post
Share on other sites
Ricoom    15

current modmain - 

--local require = GLOBAL.require
--GLOBAL.test = {}
--GLOBAL.test.AddRecipe = AddRecipe
--require "prefab"
--require "assets"
--require "recipies"
--require "strings"
--PrefabFiles = GLOBAL.test.PrefabFiles
--Assets = GLOBAL.test.Assets



--AddMinimapAtlas("images/minimap/minimap_data.xml")
local EmptyFunction = function()end

local require = GLOBAL.require
local os = require "os"
local _G = GLOBAL
local ImageButton = require "widgets/imagebutton"
local Image = require "widgets/image"
local LaunchingServerPopup = require "screens/launchingserverpopup"

local function FileExists(filename)
	filename = 'scripts/' .. filename .. '.lua'
	local f = _G.io.open(filename, "r")
	if f then
		f:close()
		return true
	end
end

local seen={}


local MAIN_SCREEN_PLAY = "screens/redux/mainscreen"
if FileExists(MAIN_SCREEN_PLAY) then
	local main = require(MAIN_SCREEN_PLAY) 
	local old_DoInit = main.DoInit
	if old_DoInit then
		function main:DoInit(...)
            old_DoInit(self,...)
            self.play2_button = self:AddChild(ImageButton("images/frontscreen.xml", "play_highlight.tex", nil, nil, nil, nil, {1,1}, {0,0}))--"highlight.tex", "highlight_hover.tex"))
            self.play2_button:SetPosition(1800, 500)
            self.play2_button:SetTextColour(1, 1, 1, 1)
            self.play2_button:SetTextFocusColour(1, 1, 1, 1)
            self.play2_button:SetTextDisabledColour({1,1,1,1})
            self.play2_button:SetNormalScale(.65, .5)
            self.play2_button:SetFocusScale(.7, .55)
            self.play2_button:SetTextSize(55)
            self.play2_button:SetFont("opensans")
            self.play2_button:SetDisabledFont("opensans")
            self.play2_button:SetText("reset", true, {2,-3})
            self.play2_button:SetOnClick(function()
                    TheSim:Reset()
            end)
                        self.play3_button = self:AddChild(ImageButton("images/frontscreen.xml", "play_highlight.tex", nil, nil, nil, nil, {1,1}, {0,0}))--"highlight.tex", "highlight_hover.tex"))
            self.play3_button:SetPosition(1800, 700)
            self.play3_button:SetTextColour(1, 1, 1, 1)
            self.play3_button:SetTextFocusColour(1, 1, 1, 1)
            self.play3_button:SetTextDisabledColour({1,1,1,1})
            self.play3_button:SetNormalScale(.65, .5)
            self.play3_button:SetFocusScale(.7, .55)
            self.play3_button:SetTextSize(55)
            self.play3_button:SetFont("opensans")
            self.play3_button:SetDisabledFont("opensans")
            self.play3_button:SetText("run", true, {2,-3})
            self.play3_button:SetOnClick(function()
                    
            local cluster_info = {
  friends_only=false,
  mods_config={  },
  settings={
    GAMEPLAY={ game_mode="survival", max_players="6", pvp="false" },
    NETWORK={
      cluster_description="",
      cluster_intention="cooperative",
      cluster_name="[TAW] Siruker's World",
      cluster_password="",
      config_dir="hello",
      lan_only_cluster="false",
      offline_cluster="false" 
    },
    config_dir="hello" 
  },
  world1gen={
  desc="The standard Don't Starve experience.",
  hideminimap=false,
  id="SURVIVAL_TOGETHER",
  location="forest",
  max_playlist_position=999,
  min_playlist_position=0,
  name="Default",
  numrandom_set_pieces=4,
  ordered_story_setpieces={ "Sculptures_1", "Maxwell5" },
  override_level_string=false,
  overrides={
    alternatehunt="default",
    angrybees="default",
    antliontribute="default",
    autumn="default",
    bearger="default",
    beefalo="default",
    beefaloheat="default",
    bees="default",
    berrybush="default",
    birds="default",
    boons="default",
    branching="default",
    butterfly="default",
    buzzard="default",
  },
  random_set_pieces={
    "Sculptures_2",
    "Sculptures_3",
    "Sculptures_4",
    "Sculptures_5",
  },
  required_prefabs={ "multiplayer_portal" },
  substitutes={  },
  version=3 
},
  world2gen= {
  background_node_range={ 0, 1 },
  desc="Delve into the caves... together!",
  hideminimap=false,
  id="DST_CAVE",
  location="cave",
  max_playlist_position=999,
  min_playlist_position=0,
  name="The Caves",
  numrandom_set_pieces=0,
  override_level_string=false,
                        }
                    }
                     local launchingServerPopup = nil
GLOBAL.TheSim:PauseFileExistsAsync(true)
                if true then
                    GLOBAL.ShowLoading()
                    launchingServerPopup = LaunchingServerPopup({}, 
                        function()
                            local start_worked = GLOBAL.TheNet:StartClient(DEFAULT_JOIN_IP, 10999, -1, serverdata.password)
                            if start_worked then
                                GLOBAL.DisableAllDLC()
                            end
                        end,
                        function()
                            GLOBAL.OnNetworkDisconnect("ID_DST_DEDICATED_SERVER_STARTUP_FAILED", false, false)
                            GLOBAL.TheSystemService:StopDedicatedServers()
                        end)

                    TheFrontEnd:PushScreen(launchingServerPopup)
                end

                -- Note: StartDedicatedServers launches both dedicated and non-dedicated servers... ~gjans
                if not GLOBAL.TheSystemService:StartDedicatedServers(4, true, {}, true) then
                    if launchingServerPopup ~= nil then
                        launchingServerPopup:SetErrorStartingServers()
                    end
                    self:Enable()
                end
          if true then
                local starts = GLOBAL.Profile:GetValue("starts") or 0
                GLOBAL.Profile:SetValue("starts", starts + 1)
                GLOBAL.Profile:Save(function() GLOBAL.SaveGameIndex:StartSurvivalMode(4, {cluster_info.world1gen, cluster_info.world2gen} , serverdata, onsaved) end)
            end
            end)
        end
    end
end

will cause game to crash with no client_log errror.. fun.

also have tried

- writing into Windows\System32\Tasks - running commands with sceduler  - but will fail as sysstem wont allow writing anywhere else but game folder

- io.popen - is removed from io table

- editing gamefiles to call TheSystemService:StartDedicatedServers twice with slightly different settings. Will not affect number of servers run even if different save slots are assigned. Would expect that it would run 4 but probably c++ function will check if servers allready running and ignore second call

 

PLEASE @Bigfoot  @Ipsquiggle  @V2C @Diabu @JanH @PeterA comment on this. HELP ME!!!

Edited by Ricoom

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this