Jump to content

Farms cause significant frame rate drops


Recommended Posts

I play on a laptop. It's one of those ASUS budget gaming machines, and although I can't push max settings on anything current it usually performs well. I'm noticing that in DST my frame rates are dropping and it seems to be caused largely by farms. In my latest world, I had 150+ grass tufts and around 200 saplings planted right next to each other and things were fine, but when I decided to start setting some farms down about a screen away, my frame rate started to stutter badly. You might say "well obviously you're pushing it," but the same thing happened to me before in far less crowded camp layouts; get a dozen or so farms laid down and everything goes to pot. It seems like there's something specific to the farms that is causing things to suddenly start choking. Any idea what's up or how it can be fixed? It's really aggravating. To get my FPS back I have to exit the game and start it back up, and then it's okay for an hour or so before being within a couple of screens of the farms starts making it choke again.

7 minutes ago, TheHalcyonOne said:

I play on a laptop. It's one of those ASUS budget gaming machines, and although I can't push max settings on anything current it usually performs well. I'm noticing that in DST my frame rates are dropping and it seems to be caused largely by farms. In my latest world, I had 150+ grass tufts and around 200 saplings planted right next to each other and things were fine, but when I decided to start setting some farms down about a screen away, my frame rate started to stutter badly. You might say "well obviously you're pushing it," but the same thing happened to me before in far less crowded camp layouts; get a dozen or so farms laid down and everything goes to pot. It seems like there's something specific to the farms that is causing things to suddenly start choking. Any idea what's up or how it can be fixed? It's really aggravating. To get my FPS back I have to exit the game and start it back up, and then it's okay for an hour or so before being within a couple of screens of the farms starts making it choke again.

I feel your pain... and because of this, most of my DST bases in dedicated servers don't have a single farm in them if I can help it... I just rely on Spider meat, a bird cage and hunting prey from rabbits, tallbirds, and Koalefants/Beefalo... (Bacon and eggs master race)

I think it's because farms have periodic calculations for growing crops and having multiple farms in one screen take up too much processing(?)

I think it's because, really unlike any other structure in-game, farms are actually made up of a bunch of prefabs-- each little rock and fencepost and so on is its own prefab for farms. Perhaps if their art was remade as a single entity, it would improve things. But that would be a lot of work...

I suffer exactly the same problem (in fact, in my current game, I was obligated to destroy all my farm to just continue to play. Going into my farm spot makes me have fps down under 10...).

That's why I created this bug (which is talking about this exact problem, see the second video...). 

And because I still have no answser from Klei, I also created this topic.

And I'm pretty sure, at a moment, I will be so boring that Klei will take this problem into account, just to shut up me ;-pp.

3 hours ago, rezecib said:

I think it's because, really unlike any other structure in-game, farms are actually made up of a bunch of prefabs-- each little rock and fencepost and so on is its own prefab for farms. Perhaps if their art was remade as a single entity, it would improve things. But that would be a lot of work...

Refine 5 grass tufts + 5 manure + 5 rocks into farm plot.

Doesn't give you extra grass, doesn't grow any quicker, but maybe only need to be fertilized once?

58 minutes ago, applebottom said:

Refine 5 grass tufts + 5 manure + 5 rocks into farm plot.

Doesn't give you extra grass, doesn't grow any quicker, but maybe only need to be fertilized once?

What does that have to do with anything? The point isn't that farms are bad (except for that one poster right before you thinking so), it's that they're laggy. I didn't know every single fencepost and rock was a prefab, that's pretty silly... I can imagine it's done so they rotate on the map the way they do, but it'd be so much better to just have a few pieces of art for different angles than go through all that lag on less powerful computers. That, or just make it so they don't generate lag even as separate prefabs in some manner.

I think farms are actually fairly useful, so. They're free food, several of the things you can grow restore significant chunks of HP by themselves, and I need vegetables to make easy 40hp heal pirogies.

1 hour ago, AnonymousKoala said:

I don't want to be that guy, but I have to.

Farms are pretty bad anyway, so even if they do cause significant fps drops, just don't make them. You're not losing much.

In fact, maybe you don't have understand the real problem.

The farms are not the cause of the lag, it just reveal the real problem.

It's like the mode Minimap HUD. On my game, if I stay on a non-build place, my fps is 60. If, from this place, I look the map, my fps fall to 30 (beacuse I have revealed all my map and I have begin to build a megabase). The Minimap HUD goal is just playing and looking the map at the same time, so the lag happens. But the fact my fps fall while looking the global map IS the problem, not the mod. You see ?

Here it is the same thing. A farm cause more lag probably because it is a object more complex than, for example, a sapling. Do not play with farm is not a solution, it's a bad workaround.

I'm a pretty good player, I can survive, if I want, 1000 days with a camp not bigger than a flingomatic area. With a little camp like this, I will not lag, but I don't play to survive, I play to create megabase.

I don't want a big zone with farm because it's efficient, but because it's cool,
 

7 minutes ago, applebottom said:

It's an easy to way to reduce the number of prefabs/lag instead of having to rewrite the code. 5 entities get reduced to one.

Oh, you mean you'd reduce 5 grass tufts into one thing? I guess that'd be neat, but grass isn't really the issue either. As people have said- they can stand in a mass field of grass and saplings they gathered with no lag. It's only farms.

13 minutes ago, Tumalu said:

Oh, you mean you'd reduce 5 grass tufts into one thing? I guess that'd be neat, but grass isn't really the issue either. As people have said- they can stand in a mass field of grass and saplings they gathered with no lag. It's only farms.

No, it's not only farms. Take a look here. A video is attached with the first post. You will see my fps, and at this time I do not have any farm...

A video is also attached to the second post, with farm. The problem is bigger, ok, but it's exactly the same problem.

10 hours ago, rezecib said:

I think it's because, really unlike any other structure in-game, farms are actually made up of a bunch of prefabs-- each little rock and fencepost and so on is its own prefab for farms. Perhaps if their art was remade as a single entity, it would improve things. But that would be a lot of work...

Lol, that's just silly.

10 hours ago, TheHalcyonOne said:

I play on a laptop. It's one of those ASUS budget gaming machines, and although I can't push max settings on anything current it usually performs well. I'm noticing that in DST my frame rates are dropping and it seems to be caused largely by farms. In my latest world, I had 150+ grass tufts and around 200 saplings planted right next to each other and things were fine, but when I decided to start setting some farms down about a screen away, my frame rate started to stutter badly. You might say "well obviously you're pushing it," but the same thing happened to me before in far less crowded camp layouts; get a dozen or so farms laid down and everything goes to pot. It seems like there's something specific to the farms that is causing things to suddenly start choking. Any idea what's up or how it can be fixed? It's really aggravating. To get my FPS back I have to exit the game and start it back up, and then it's okay for an hour or so before being within a couple of screens of the farms starts making it choke again.

Here, created a mod so you won't render the fluff for performance:

http://steamcommunity.com/sharedfiles/filedetails/?id=703702773

Hovering over the farm plot still states if it's a basic/improved, so you're not losing any information.

17 hours ago, rezecib said:

I think it's because, really unlike any other structure in-game, farms are actually made up of a bunch of prefabs-- each little rock and fencepost and so on is its own prefab for farms. Perhaps if their art was remade as a single entity, it would improve things. But that would be a lot of work...

That does seem rather silly. Is there some reason for this?

12 hours ago, Arlesienne said:

A different workaround: have you tried combining much RAM with maximised efficiency through your battery options? And playing while relying on your ethernet?

Not sure what you mean by "combining much RAM", but every battery-saving feature that can be disabled has been. Ethernet's not really an option and I don't think it would be a factor anyway.

6 hours ago, CarlZalph said:

Lol, that's just silly.

Here, created a mod so you won't render the fluff for performance:

http://steamcommunity.com/sharedfiles/filedetails/?id=703702773

Hovering over the farm plot still states if it's a basic/improved, so you're not losing any information.

Very noticeable improvement! Thank you very much!

So I took a look at the farms decor.

The issue isn't the decor on itself. In total, with a single improved farm, you get like 50 entities on screen.

The huge issue here is that farm decor has a network component.

AND that clients ALSO spawn the farm decor on their own when they load a farm on their screen.

And this is the issue.

Every time a client unloads (walks away) a farm, and loads it back (walks back to the farm), he spawns decor on top of the same decor.

And that decor that spawns on top of the decor every time? Since it is client side spawned, it won't unload no matter how far you go. It will be awake no matter where you go (unless you relog in the server or migrate to caves).

So every time you return to your base, you stack decor over decor, over decor, over decor, over decor.

And so on until you have like 10000 entities on screen.

And by 10000 entities, I mean you have 8000 entities loaded wherever you go, and 10000 when you walk back to your farms and load some more decor.

 

I had like 16 farms down, so every time, I gained like 400 entities.

If you do it enough times you are getting lag at some point.

Curious curious curious.... Does this happen with other entities or just the farms?  If this really an issue of objects duplicating themselves a fix could see some serious performance improvements.  Devs need to look at this.

25 minutes ago, calculuschild said:

Curious curious curious.... Does this happen with other entities or just the farms?  If this really an issue of objects duplicating themselves a fix could see some serious performance improvements.  Devs need to look at this.

I have a suspicion that farms aren't the only ones, though perhaps they're the most easily noticeable. In my nearby forest there's something causing a similar issue to the farms, but I haven't pinned down what for certain. The only thing I can guess is petrified trees, as the forest was fine at worldgen and only became a problem recently.

Actually, is it possible that this sort of thing is an issue in single player, and specifically Shipwrecked? It would make sense. The FPS drops people experience in it are often solved the same way: exiting the world and reentering it. Are there maybe a lot of entities not being unloaded like they should?

5 hours ago, DarkXero said:

So I took a look at the farms decor.

The issue isn't the decor on itself. In total, with a single improved farm, you get like 50 entities on screen.

The huge issue here is that farm decor has a network component.

AND that clients ALSO spawn the farm decor on their own when they load a farm on their screen.

And this is the issue.

Every time a client unloads (walks away) a farm, and loads it back (walks back to the farm), he spawns decor on top of the same decor.

Yes, it seems absolutely coherent with the fact that when you disconnect and reconnect, the lag, for few times, is less important.

 

3 hours ago, V2C said:

Thanks for the info! We'll have this fixed in our next patch.

Oh thanks, thanks, thanks !

Just be sure you have taken in account the fact that, where I spawn into a big farm field, even if I don't move at all, the fps is directly under 20, and the fact the farm is not the only object to fix. But if you have completely cut the decors from the network part, I'm pretty sure the lag problem will completely diseapear.

I can't wait to see the result !

 

7 hours ago, Arlesienne said:

I would like to raise awareness of possible lags in spider forests and bee fields along with goosemoose setpieces. Maybe it can be addressed too. I also want to try the farm disabler mod. Many thanks.

These lags, as far as I know, are server-side lags and would be pretty hard to improve. They lag because bee fields and spider forests have a lot of entities with brains, and brains are fairly CPU-intensive. There might be some ways to improve it... but they all seem pretty ambitious to me, probably outside of the scope of what the devs want to mess with at this point (examples: merged brains for groups of enemies, dynamically scaling brain update rates, caching entity checks between nearby brains-- not even sure that these last two would even be a net improvement)

I noticed that worldtiledefs.lua's GetTileInfo iterates the GROUND_PROPERTIES table using ipairs. Changing it to hashed access with something like this (as seen from modmain):

Spoiler

local TileInfoCache = nil
local function UpdateTileInfoCache()
	TileInfoCache = {}
	local tiledefs = require 'worldtiledefs'
	for i, data in ipairs(tiledefs.ground) do
		local tileid = data[1]
		if tileid == nil then
			local s = ""
			if type(data) == "table" then
				s = GLOBAL.tabletodictstring(data)
			end
			moderror(string.format("[UpdateTileInfoCache] worldtiledefs.ground[%d] has unsupported value %s %s", i, tostring(data), s))
		else
			TileInfoCache[tileid] = data
		end
	end
end

local function MyGetTileInfo(tile)
	if TileInfoCache == nil then
		UpdateTileInfoCache()
	end
	local res = TileInfoCache[tile]
	return res ~= nil and res[2] or nil
end

AddSimPostInit(function()
	GLOBAL.GetTileInfo = MyGetTileInfo
end)

 

did speed up the GetTileInfo calls somewhat.

While GetTileInfo is used in brains (via EntityScript:GetCurrentTileType and EntityScript:IsOnValidGround), I'm not sure if the overall effect would be noticeable.

Well, I want to say that I screwed my explanation during the hype I had when looking at that bombastic 20000 entities count.

What's really happening is not that entities stack on each other, but that client entities aren't getting properly removed.

Because if you hammer a farm, you won't see the decor anymore, but duplicated client side prefabs will still exist.

It seems that client entities that do inst.entity:SetParent(other) won't get properly removed if their parent is removed.

33 minutes ago, Muche said:

While GetTileInfo is used in brains (via EntityScript:GetCurrentTileType and EntityScript:IsOnValidGround), I'm not sure if the overall effect would be noticeable.

unpack is expensive, so you did good.

1 hour ago, rezecib said:

These lags, as far as I know, are server-side lags and would be pretty hard to improve. They lag because bee fields and spider forests have a lot of entities with brains, and brains are fairly CPU-intensive. There might be some ways to improve it... but they all seem pretty ambitious to me, probably outside of the scope of what the devs want to mess with at this point (examples: merged brains for groups of enemies, dynamically scaling brain update rates, caching entity checks between nearby brains-- not even sure that these last two would even be a net improvement)

What about localizing everything in the brain?

Localizing behaviours, and localizing all functions sent as parameters.

I am nobody to judge, but I would say the problems in forests are related to spiders, each having its own AI, what you describe as "brains". Each den spawns several spiders, and usually, they all get out at once... And here stuff happens.

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...