Page 1 of 1

Test tranlate request (disconnect in MP)

Posted: Wed Feb 19, 2020 2:14 am
by Helfima
I have do a test if a mod tranlate request for item and fluid in a one tick (Bob & Angel pack)
that can explain disconnect in MP? 9ms only for requests if we add UI and another runtime >16ms

log:

Code: Select all

 751.568 Script @__test__/control.lua:7: ------------------------
 751.568 Script @__test__/control.lua:8: Test translation request
 751.568 Script @__test__/control.lua:9: Elapsed: 0.043500ms
 751.568 Script @__test__/control.lua:12: Count items: 1514
 751.577 Script @__test__/control.lua:17: Count fluids: 171
 751.578 Script @__test__/control.lua:21: Elapsed: 9.998000ms
control.lua for the test:

Code: Select all

local test = {}

function test.run(event)
  local profiler = game.create_profiler()
  profiler.reset()
  log("------------------------")
  log("Test translation request")
  log(profiler)
  local player = game.players[event.player_index]
  local items = game.item_prototypes
  log("Count items: "..#items)
  for _,item in pairs(items) do
    player.request_translation(item.localised_name)
  end
  local fluids = game.fluid_prototypes
  log("Count fluids: "..#fluids)
  for _,fluid in pairs(fluids) do
    player.request_translation(fluid.localised_name)
  end
  log(profiler)
end
commands.add_command("test","request", test.run)

Re: Test tranlate request (disconnect in MP)

Posted: Wed Feb 19, 2020 10:23 am
by Klonan
The MP won't disconnect after only 16 ms of script update, the default timeout is 10 seconds, so 100,000 ms