Create

Create

86M Downloads

Some trains cause huge lag spikes on both the server and the client

carbonatek opened this issue ยท 9 comments

commented

Describe the Bug

If a player is near a station onto which a train arrives, both their and the servers' CPU usage spikes to 100%. Followed by a drastic spike in MSPT and a slight drop in TPS. Possible bug with Framed Blocks? Unsure, since I have a different train using those and it doesn't do that.

Reproduction Steps

  1. Make a train of a larger size (full-fledged carriages)
  2. Give it a schedule
  3. Go to a station on which it'll arrive

Expected Result

CPU doesn't spike, the game doesn't get a lagspike and the server doesn't die from the train arriving.

Screenshots and Videos

hrupak.mp4

Crash Report or Log

No response

Operating System

Gentoo Linux, Windows 11, Windows 10 21H2, Windows 10 21H1

Mod Version

0.5.1c

Minecraft Version

1.19.2

Forge Version

43.3.0

Other Mods

Didn't crash, but I'm listing the mods which are, or can be, somewhat related to the issue.
Create Steam n' Rails 1.5.1
FramedBlocks 6.8.6

Additional Context

Server is running with -Xmx8G and G1GC. Has a 12-thread Xeon E-2136.
Client on the video has got 6144M allocated, ModernFix low memory optimizations and has a 16-thread Ryzen 7 5700X.

commented

Just wanted to chime in and say I am having the same issue with 1.20.1. Has anyone found a solution?

commented

Kinda same issue here on 1.19.2. A simple train with a couple block a seat and controls and the cpu spikes up to 70 to 80% when driving the train. No framed blocks at all.

commented

Same issue on my 1.20.1 Neoforge server. We also have framed blocks and trains using lots of ramps get extremely laggy when changing speed - especially when parking at a station or departing.
But trains using simple geometry blocks (framed blocks, copycat blocks and others) move absolutely fine.
I can provide my modlist or other info if needed

commented

Had the same issue. What helped for me was to install a mod called Create Interactive; valkyrien skies but for trains. It doesn't have that regenerating of the collision mesh, so the lag spikes should resolve completely.

commented

Hi there. Sorry ( to staff from create ) for responding if this is not allowed, but i noticed you are using Framed Blocks 6.8.6.
The version they have now is 9.1.6 for 1.20.1. Unsure if this might have any effects?

commented

I forgot to change the version of Minecraft. The version of Minecraft is 1.19.2, didn't notice, thank you :-)

commented

https://spark.lucko.me/NVTPmqnJcz
For some reason, placing the front carriage from the train in the video and then a long wagon behind it with framed blocks and about 30 andesite doors (just about realistic, since there are 4 on each side per carriage, then 2 inside of it as well, totaling 10/carriage, which is about the amount that is on the entire unit) sends the CPU absolutely nuclear. (95% usage)
Note: this is from my 1.18.2 test server and it occurs there as well.
Basically:

  • A lot of doors and a lot of framed blocks: near 100% CPU usage
  • No doors and a lot of framed blocks (a lot = around 250): about 70% CPU usage
  • No framed blocks and 32 doors: no cpu spike, goes up max like 2%
commented

Looks like the framed block slopes just have a very complex block shape (for collision, not the model itself)
Create computes a combined shape for its moving structures when they load in. I'm guessing its not equipped for merging large amounts of these highly detailed shapes. It's run off-thread though, so I do wonder why its holding up everything else.
The shape recalculates when doors open. This is why those are factoring in as well.

commented

I can attest to that, as I've got three trains containing framed blocks, and the one in the video, which so happens to have the most of them (and uses the most slopes) consumes the biggest amount of CPU.
One train just uses vertical slabs to allow for some interesting designs on the sides, and has like 10 slopes in total. When it stops, it does little to no lag.
The second one has more slopes, as it's a two-floor carriage with a round roof. It spikes the CPU quite a bit, but it's not unbearable.
The problem comes with the train in the video. Whenever it stops when it's loaded in, I hear a very distinguishable noise of CPU load (the server I'm hosting it on is 20cm from my head, and the fan spools up quite a bit, sweet dear 1U servers)
So basically, if I understand correctly, the impact should vary by type of framed blocks used, yes? If I just use vertical slabs it shouldn't impact the collision calculation as much as complex shapes like slopes and prisms do.
Edit: maybe true, removed all slopes, prisms, and divided slope slabs and whatevers, tl;dr the entire roof, the interior roofing and the fronts on both ends and just kept vertical slabs and floors and stopping the train makes Minecraft use 9 less threads. (7)