Apotheosis

Apotheosis

78M Downloads

Temptation enchant is causing a server tick issue

kezmodius opened this issue ยท 11 comments

commented

Hi. My modpack server is struggling with TPS and MSPT. I ran a Spark profiler : https://spark.lucko.me/B6mQOvWexL
I asked some people for help to read it and one of them said that the Apotheosis Temptation enchant is causing an issue and that I should report it to you. He said that: "they're firing off an event and recalculating a whole bunch of stuff per animal per tick instead of caching it." Hopefully you can read the profiler link and determine the cause?

commented

I agree with that, when there are large amount of entities, I encounter the same problem in multiplayer. It looks like, monsters move and stop and move, but I can attack them with no lag, and the time flows very slow.

commented

Random info request - are you just sitting near a huge amount of farm animals while holding an affix item?

commented

I was the only player on the server at the time that had a hoe with the enchant. I never held it, it was in my inventory only.
I may have gone by my farm at some point but I cannot remember.

commented

That doesn't really answer the question

The perf issue here is from rapid deserialization of affixes, which is due to every farm animal checking for the temptation enchant, which triggers an affix lookup because affixes can modify enchantments.

Caching the affixes is an extremely nontrivial problem (it requires implementation of synchronized forge capabilities or equivalent).

The only short term solution is to not hold heavily affixed items around hordes of farm animals.

commented

I answered the question as I understood it: I never held the hoe - which was the only item enchanted with the Temptation enchant - it was only in my inventory. I don't really understand what you are saying about the affixes. My armour has affixes, some of my tools and weapons have affixes. Are you saying that if any affix item (whether it has anything to do with the Temptation enchant) goes near farm animals then there will be a performance issue because the animals start looking for an enchanted item that I may or may not have?
If so, that seems like a problem.

commented

The temptation enchantment isn't the issue. The issue is the following call chain:

Tempt Goal -> Temptation Enchant Check -> Affix Deserialization. The last step is expensive.

Are you saying that if any affix item (whether it has anything to do with the Temptation enchant) goes near farm animals then there will be a performance issue

Yes, if you stand near a ton of them and are holding an affix item that is very complicated (epic+ with socketed gems).

It isn't really that big of an issue, and it will be addressed (6% overall tick time is not extremely substantial), but the solution is (as mentioned) nontrivial. There's no cut-and-dry "cache it" solution as whoever sent you here described.

commented

Like I said, I don't understand what you are saying because I don't understand what affix deserialization means. I am only repeating what was said to me, to help you fix an issue that came up. I don't understand why you would want any affix to be within the call chain of the Temptation enchant, as from what I know of it, there are no gems or affixes that seem to affect it.

If I cannot walk by my farm without the server screeching to a halt because I'm covered in affixed gear (because nearly every piece of armour, tools and weapons has them) then Apotheosis and my server are not compatible. My client was dropping to 2fps near the farm in a different session. But now I know what the issue is and I will experiment and proceed as I require.

commented

@kezmodius

See this, there are gems can modify enchantments, so before the enchantment works, it need to have a check.

The perf issue here is from rapid deserialization of affixes, which is due to every farm animal checking for the temptation
enchant, which triggers an affix lookup because affixes can modify enchantments.

Before you read below, I must mention that I am not professional at coding, but if I can't understand "deserializtion", I will search on the internet.
referring to: https://stackoverflow.com/questions/3316762/what-is-deserialize-and-serialize-in-json
Simplely speaking, it's a work that make what you see(tooltips) transform into a code.
And if there can't be an easy "cache" you'd better be flexible, and try not walking through your farm with complicated affixed item and Temptation enchantment.

commented

@rtxyd

Well, I appreciate your google-fu but I don't need to understand what deserialization is to log a bug report. It is also not my responsibility to determine what will fix the issue. I only commented further to clarify that it is the affixes that are causing the problem. From what Shadows-of-Fire said above I don't even need to have an enchanted item to make the animals look for it, only the affixes on anything, which includes armour, weapons and tools. Nearly every item in the game has affixes. My loadout is full of gemmed-up affix items.

We are running a Minecolonies server, with Apotheosis as a bonus extra, not the other way around. I'm not childishly refusing to do the simple fix of not walking around the farm with my enchanted hoe out. Apparently the issue is I (and our multiple other players) can't walk past farm animals without triggering these checks due to every item we have. That may be game/server breaking for us and I will need to experiment further to see if it is.

commented

which includes armour, weapons and tools. Nearly every item in the game has affixes. My loadout is full of gemmed-up affix items.

Temptation only checks held (in-hand) items.

commented

That is not what you said above and I already told you I had a hoe with the enchantment and it was in my inventory only. I never held it.