Mod Lag, what causes it?

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord
Status
Not open for further replies.

Lonewolf187

New Member
Jul 29, 2019
110
0
0
I was wondering what is some of the causes of lag from Mods? Is it inefficient code? Animations? Gremlins?

I know that lag is of the main problems that plague mods but I'm trying to understand the root cause. For example: Atomic Science causes lag on servers, however I'm wondering is the lag coming from the various block animations like the turbines and the centrifuge or is it the code for the mod while its crunching the numbers?
How do mods like Forestry not cause lag from the bee animations, and the numerous calculations from Ethanol production and bee/tree breeding since there is a randomness factor involved with the calculations? (The Ethanol production is just an example considering there are factors like sappiness from saplings, using water vs fruit juice and the steps involved from tree farm, to fermenter, to still)
 

Pokefenn

New Member
Jul 29, 2019
976
0
0
Well, it very much depends on the code style of the author.
Its very hard to explain on a basic level...
There is "client" lag which usually is frames per second, this can be caused by particles, models, effects and other laggy things.
Then there is "server" lag which is usually things taking a long to to work or break, this can be caused by mods sending packets incorrectly (too many, too little or in a weird way), tile entities that update too much and do specific things.

Its really a hard thing to explain ._.
And even harder if the mods are closed source =3
 

Larmonade

New Member
Jul 29, 2019
146
0
0
I don't know how on-topic this is, exactly, but:
I like using NEI's magnet mode, but I've found that once in a while, a dropped apple or sapling from my tree farms outside will drop, fly towards me, and then ram repeatedly into my front door, trying to reach me, and being blocked by the door will cause a very noticeable lag spike.
I've also noticed that for whatever reason, certain biomes cause noticeable lag, and the tree leaves decay, as though the trunks had been removed. I once just camped in a jungle biome for a few hours while I was out running errands, and can back to basically a bald forest of just tree trunks. It was weird, and I can only replicate it sporadically.
I also noticed, in my early FTB days, that specifically the Extra Bees and Magic bees mods caused some pretty crazy lag for me, but I've since not noticed it as much in my more recent worlds. No idea why, but for my first few worlds, I had to have those mods uninstalled in order for anything to run at a reasonable framerate.
 

WTFFFS

New Member
Jul 29, 2019
768
0
0
Generally lag is caused by tile entities (anything you can interact with or anything that updates it's status in some way) and\or rendering\sound lag (one of the worst causes of lag for me was the sound of rain and it's particle effects up until I built my new comp\Minecraft updated to a new LWJGL).

The base causes of lag are myriad however, generally if a mod is in active development it will become less laggy over it's lifecycle apart from new toys within the mod (new stuff can be horrendous until the lag is polished out). Which is why Forestry's bees are low impact and the extra bees\magic bees were not so good, early on in FTB time EB\MB were both new and under development, whereas Forestry was an old mod which has been polished until it is shiny and pretty. Some old mods are lag monsters in some areas due to legacy code that is still in place (IC2 is an example of this certain parts of the mod are almost as old as MC modding itself and have been in maintenance mode since then, IC2 however is getting a nice freshen up atm) usually the old code is laggy as hell due to that just being the way it was done, early on a modpack with 100-150 mods was unheard of now that is pretty much standard and the way things are done has been vastly improved. Some mods come out the gate with a minimal resources footprint, King Lemming and the CoFH team have that as their design brief, Thermal Expansion is designed from the ground up to be server friendly.

From an end user point of view though the only way to avoid excessive lag is to watch for actions\machines\items that cause excessive lag and avoid them, a new mod that has just become available for SMP and SSP is Opis by ProfMobius which can show you in realtime where your tile entity lag is coming from.
 
Last edited:

twisto51

New Member
Jul 29, 2019
1,443
0
0
It doesn't have to be a poorly coded mod when you have people who will decide that the answer to the problem is 1024 of a given machine. :p I had ~124 36HP boilers and it brought my PC to its knees.
 

rhn

Too Much Free Time
Nov 11, 2013
5,706
4,420
333
I don't know what it is, but every time I build a new base I always end up on 14-15 FPS in the heart of it. Tried disabling/changing every setting. With or without texture pack. With and without Optifine. Always the same 14-15 fps. If I move to the outer areas of my base it goes to 20ish FPS, and if I go to further away, but still in loading distance, it goes up to 40-60 fps.
This has happened over several modpacks and MC versions now. When on server or playing single player doesn't change a thing. It always settle on the same FPS and adding more stuff to the base after that doesn't seem to change a thing.
 

WTFFFS

New Member
Jul 29, 2019
768
0
0
It doesn't have to be a poorly coded mod when you have people who will decide that the answer to the problem is 1024 of a given machine. :p I had ~124 36HP boilers and it brought my PC to its knees.
Excessive builds do tend to be a bit of a lagfest, on my old computer I had a couple of chucks of my base I couldn't enter once I'd turned it on... love me some wireless redstone lol
Still not sure what was in there that caused the lag I had power\processing\manufacturing for a set and forget solar panel factory in those chunks, machines from Railcraft\TE\Factorisation\Gregtech\IC2\RP2 (1.4.7). Didn't cause "excessive" lag (but it did cause a bit) anywhere else in the world just in those chunks so it was likely the worst offender was rendering\sound lag.
One of the worst lag inducers I ever had was a Soul Shards Blaze Spawner with Cogs of the Machine saws doing the killing it could if I ran it unattended (so the XP orbs built up) lag my world to a standstill in ~3 minutes.
 

rhn

Too Much Free Time
Nov 11, 2013
5,706
4,420
333
Oh another thing you should always keep an eye on, is confinement of mobs. If there's too many mobs in one area and they start glitching each other through the walls it will cause loads of lag. Be specially aware of mobs that can breed, like villagers and animals. Have seen it bring servers to its knees and players FPS to very low single digits when getting close.
 

Omicron

New Member
Jul 29, 2019
2,974
0
0
95% of the time, when people say "lag" they mean "performance issues". "Lag" or "latency" per se is a network issue.

The client can have performance issues: low FPS and/or screen stutter due to weak CPU, weak GPU, lack of memory, background processes or badly coded / incompatible software
The client can have lag: inability to sync with the server due to congested or faulty connection

The server can have performance issues: low tickrate due to weak CPU, lack of memory, background processes or badly coded / incompatible software
The server can have lag: inability to distribute data to clients due to congested or faulty connection

The network can introduce lag: dropping packets en route, traffic passing through congested nodes or intercontinental links etc.

On the client, mods tend to stress the GPU more than vanilla does, and require a far larger amount of memory. On the server, mods tend to stuff a lot more work to do into the single-threaded main Minecraft process that ticks the world, therefore quickly hitting a CPU bottleneck; also, a lot of complex goings-on require a lot of data to be synced to the client very frequently, which can congest the network connection and waste time with protocol overhead.

Especially the use of tile entities (i.e. blocks that are more complex than a square object that does a certain something when clicked) contributes to this. They're super convenient because you can do pretty much anything you want with them, which is the reason why they're everywhere in mods. Unfortunately, being able to do anything you want also includes doing things which are really really performance hungry - either because it's cool and the author wants it, or because the algorithm implemented scales really badly (a super easy to make mistake in programming). Nothing stops a modder from doing this - though some, like King Lemming, go out of their way to avoid it.
 

Saice

New Member
Jul 29, 2019
4,020
0
1
as Omicron pointed out the better term and most likely the cause of most 'lag' you see in modded MC is tick delay. When all the things in the world that have some sort of action/reaction in the world the game server has to process that. When the number of things that have to be done take more time then a normal tick would (1/20th of a second) the game still will start to have a delay. This is what you get when you have issues like you break a block and it hangs there a second before you can pick it up or the such. That is why you will see some people go on and on about how this or that effects the TPS (ticks per second).

I'm sure someone more in the know on the coding side of things can explain it better than me.
 

TheAbstractHippo

New Member
Jul 29, 2019
174
0
0
Well, TheAbstractHippo, I can see now why you chose your moniker. =)

The lag goblin is indeed a healthy abstraction for all of the complex issues discussed above.
I actually chose it because there's no way it's ever taken on any websites I use on a regular basis.
 

un worry

New Member
Jul 29, 2019
384
0
1
Oh another thing you should always keep an eye on, is confinement of mobs. If there's too many mobs in one area and they start glitching each other through the walls it will cause loads of lag. Be specially aware of mobs that can breed, like villagers and animals. Have seen it bring servers to its knees and players FPS to very low single digits when getting close.

Ah, yes ... them villagers.

I used to have a village just out of range of my base in MIndcrack. As I built up my machines, I experienced the usual degradation in performance/FPS.

Then I moved onto the outside for a few weeks, basically building with assorted bricks ... and over that time the FPS kept dropping. And dropping. Turning off machines made no difference.

Then I happened to wander close to the village and OMG - the whole place had turned into an infinite villager breeder. Couldnt get within 30 blocks of it before hitting 0 FPS.

Time for a cunning plan. Sent a turtle forward to "excavate 64", in the hope that destroying the buildings would release the villagers, expose them to the evening zombie hoarde and see them burn up at dawn.

You can guess how this ended. Turtle took out one house that was packed solid with Vs and bam! Villager explosion, game crashed and could never log back in.

Unleashed came out the next week. C'est la vie :)
 

rhn

Too Much Free Time
Nov 11, 2013
5,706
4,420
333
Ah, yes ... them villagers.

I used to have a village just out of range of my base in MIndcrack. As I built up my machines, I experienced the usual degradation in performance/FPS.

Then I moved onto the outside for a few weeks, basically building with assorted bricks ... and over that time the FPS kept dropping. And dropping. Turning off machines made no difference.

Then I happened to wander close to the village and OMG - the whole place had turned into an infinite villager breeder. Couldnt get within 30 blocks of it before hitting 0 FPS.

Time for a cunning plan. Sent a turtle forward to "excavate 64", in the hope that destroying the buildings would release the villagers, expose them to the evening zombie hoarde and see them burn up at dawn.

You can guess how this ended. Turtle took out one house that was packed solid with Vs and bam! Villager explosion, game crashed and could never log back in.

Unleashed came out the next week. C'est la vie :)
Hehe yeah saw the same thing happen on a server I played on. Managed to navigate to the house with 1 FPS. It was one of those houses with the fenced garden. The main door was blocked so they couldn't go anywhere and just kept breeding exponentially. I tried to kill them with my perfectly enchanted sword of the zephyr. One hit and it broke... DOH! Tried exploding them with the mining laser on explosive, got bad lag and found myself dead(I was wearing full quantum, so no idea how). Villagers then got out and a friend came by to help kill them. But was taking forever. Ended up using a portal gun to port them off a large drop :p
 

hiroshi42

New Member
Jul 29, 2019
538
0
0
From personal experience nothing can kill performance worse than sounds. Even with the volume turned off something is still running in the audio department. Thankfully some mods offer a config setting to disable their sounds. One of the first things I do when I start a new instance or install a new mod is look in the config files for sound settings.
 

Hambeau

Over-Achiever
Jul 24, 2013
2,598
1,531
213
Well, TheAbstractHippo, I can see now why you chose your moniker. =)

The lag goblin is indeed a healthy abstraction for all of the complex issues discussed above.

Is the Lag Goblin in any way related to Maxwell's Demon?
 
Status
Not open for further replies.