emk / FactorioNuclearVehicles

An idea for a Factorio mod. This was fun to write!
1 stars 1 forks source link

Massive UPS/slowdown #1

Open minyan opened 7 years ago

minyan commented 7 years ago

Barely install, didn't even build one nor do research. Yet this mod causing massive slowdown.
I have decent PC, , capable of handling megabase at 60 fps, yet this mod causing noticable drop. The script update ranging from 0.7 to 1.5 from this mod alone.

emk commented 7 years ago

Thank you for the bug report!

I'm still seeing 59.9 UPS on my test map, which is about all I ever see on my laptop.

The only thing that I do that might cause UPS slowdown is a once-a-second poll for tanks using the standard APIs:

script.on_event({defines.events.on_tick},
   function (e)
      -- Check once per second.
      if e.tick % 60 == 0 then
         tanks = game.surfaces[1].find_entities_filtered{type = "car", name = "nuclear-vehicle-tank"}
         for index,tank in pairs(tanks) do
            update_steam_turbines(tank)
         end
      end
   end
)

If this is causing massive UPS drop with no tanks built, then I have no idea what the problem could be. Maybe on_tick is completely useless under all circumstances? Maybe find_entities_filtered is so expensive I can't even call it once per second?

Except plenty of other mods do stuff like this. I mean, I would be disappointed if this cost a few UPS on a truly huge map with a zillion entities, but I wouldn't be totally surprised. But I just can't see how this could cause "massive slowdown" with no tanks built. I'm really not doing anything too special or unusual that I'm aware of.

Do you have any other mods loaded that do funky things with vehicles?

minyan commented 7 years ago

Sorry for the late response, there's no notification on my inbox at all, have to manually check github

This is the vehicle related mod that i use "Stop That, Silly Robot!" https://mods.factorio.com/mods/folk/folk-stopthat

"Honk" https://mods.factorio.com/mods/GotLag/Honk

"FARL" https://mods.factorio.com/mods/Choumiko/FARL

"Shuttle Train Lite" https://mods.factorio.com/mods/folk/folk-shuttle

"Vehicles Equipement Grid" https://mods.factorio.com/mods/Thaui/vehicles-equipement-grid

"Vehicle turrets" https://mods.factorio.com/mods/Astrinaar/Vehicle-turrets

emk commented 7 years ago

Thank you! There's a chance that this is some sort of interaction between the various vehicle-related modules. I'd be most suspicious of turret and grid-related modules, but it could be one of the others.

Like I said, on a smaller map with just Creative Mode and Nuclear Vehicles installed, I get 59.9 UPS on my laptop, even when I'm driving around in a tank. I haven't tested it on a huge map with a massive factory yet, however.