[2.0.15] MP performance issue : Poor cnx quality (wifi) + turret AI

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Malak044
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Nov 16, 2024 10:49 am
Contact:

[2.0.15] MP performance issue : Poor cnx quality (wifi) + turret AI

Post by Malak044 »

Hi all,

So yesterday, our savefile tiped us over the sweet 60 FPS performance. We struggled to figure out & pinpoint the culprit.
Overview of the setup :
Server running in linux headless (docker) on a dedicated server baremetal (not some paid/month subscription at a datacenter). The server specs are just a beast. The factorio running was never using more than 100% CPU (so 1 core), barely going over the 100% from times to times (depending on the "action" on the map).

2 players with similar setups :
  1. AMD Ryzen 7 5800X 4GHZ (pretty good CPU)
  2. RTX 4070 12GB
  3. 32 GB RAM DDR5
  4. 1 player is playing from "localhost" (still had a to do a loopback from public IP)
    • godly ISP cnx (2.5 Gbit/s UP/DOWN).
  5. 1 player is playing from 400Km apart
    • problematic ISP cnx (1GBit/s WAN, but LAN setup with CPL only reaching max 30MBit/s, with potential packet loss).
Context :
Running Factorio Space Age default mapgen, went a bit deep in our remodeling of the Nauvis base (went 30ish kms east, up to when ore patches hit approx 150M/patch). The full east path is a turret heavy border guarded dual train lane (approx 12k laser turrets). With limited bug control (only so that they dont aggro non stop the border, but no artillery).

Problem :
For the problematic player, the save is running smooth 60FPS (with update tick approx 15) on singleplayer, but running with 4fps most of the time in MP.

After a talk with some community member (https://discord.com/channels/1396775903 ... 4958526534 <- discord topic). We decided to start fixing main potential problems :
  • Fulgora sorting station was full, approx 2k bots in the air with items they cannot drop (have to wait a backed up inserter logisitic "junk chest").
  • Bugs might be too close to some turrets, even tho they arent aggressive and not engaged in combat (turret in idle state, apparently the AI behind the turrets still target calc bugs up to some default legendary range). We decided to slowly add artillery around our borders.
The main issue pinpoined was the "turret time" being over 4 out of the 16-17 time per tick (which might be scewed, since apparently the target acquisition might not be represented in that number).

Solution :
  • First fixed the fulgora sorting station, gained approx 1fps out the 60, basically doing nothing
  • Then added artillery around the "main base" (nothing around the 30km trench going East), tipped us back on track.
This basically removed nests around pollution area & cleared our border mainly composed of flamethrower & small amount of laser. The trench still has 12k laser turrets (will continue clearing up, but takes time).

We believe there is something in the Flamethrower (or any turret) AI that makes it particulary bad in calc (over MP ?)


LogFile :
factorio-previous.log
log file
(64.96 KiB) Downloaded 4 times
Mods : vanilla spaceage, default mapgen
Screenshots :
Debug options
11 fps
11 fps
turret-ai-fps-1.png (6.72 MiB) Viewed 167 times
Partial Layout of nauvis (cannot fit in one screenshot)
the trench.png
the trench.png (326.05 KiB) Viewed 167 times
Active Chunks around trench (sadly no screenshot around the flamethrowers)
active chunks.png
active chunks.png (209.14 KiB) Viewed 167 times
Frames back to 60FPS
frames-back.png
frames-back.png (1.23 MiB) Viewed 167 times
Layout of the mainbase defense border
layout-defense.png
layout-defense.png (1.8 MiB) Viewed 167 times
Save files : (approx 100MB)
- With 5FPS : https://drive.google.com/file/d/1oqPAPY ... drive_link
- With partial fix solution (gave us FPS back) : https://drive.google.com/file/d/1oKAYMn ... drive_link
Attachments
factorio-previous.log
(64.96 KiB) Downloaded 2 times
turret-ai-fps-1.png
turret-ai-fps-1.png (6.72 MiB) Viewed 167 times
the trench.png
the trench.png (326.05 KiB) Viewed 167 times
active chunks.png
active chunks.png (209.14 KiB) Viewed 167 times
Malak044
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Nov 16, 2024 10:49 am
Contact:

Re: [2.0.15] MP performance issue : Poor cnx quality (wifi) + turret AI

Post by Malak044 »

After clearing up everything, we ended up with turret being 0.005/tick
fixed.png
fixed.png (1.1 MiB) Viewed 109 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 14244
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.15] MP performance issue : Poor cnx quality (wifi) + turret AI

Post by Rseding91 »

Thanks for the report however I don't see any bug here. Turrets use the exact same code in single player and multiplayer (in fact, all entities do). They have always been a higher tick-time using entity because they have to scan for things to shoot when there are things nearby to shoot.
If you want to get ahold of me I'm almost always on Discord.
Malak044
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sat Nov 16, 2024 10:49 am
Contact:

Re: [2.0.15] MP performance issue : Poor cnx quality (wifi) + turret AI

Post by Malak044 »

Well the problem was that on version 1.X, I really didnt struggle. I can understand that the code behind turret didnt change. But maybe the update 2.X highlighted something since now the range for calculation is higher than the actual range of the turret (maybe this is wrong, this is some assumption).

In the end, a playstyle that was working fine in MP in 1.X is now struggling in 2.X (about turrets whereabouts not being cleared by artillery).

The most "disturbing part" is the fact that for the save in 2.X, I can play fine in Solo, but in MP, I'm "gated" by the cnx or something like that. I see the MP buffer spiking some of the time. Mostly unplayable.

Finally, I've personnally learnt how to avoid the situation. After 20+h of artillery placement, we went back to 0ms/tick on turret. So We gained back those 8ms/tick. And I know that this is an area to watch about. Maybe there is nothing wrong like you said, you definitely are more an expert than me. I was thinking maybe there are alot of unecessary packets for turret synchronisation in MP that "clutter" the cnx.

Anyway, thx for the update, it's amazing so far <3 ( expect this "issue" that required us to do a big workaround :D )
Post Reply

Return to “Gameplay Help”