Ancient Warfare 2

Ancient Warfare 2

6M Downloads

Rendering windmills is very laggy

Da-Technomancer opened this issue ยท 5 comments

commented

When the windmills are being rendered, there is a lot of lag server side (from 12 windmills, it's a difference of 40ms on tick time, while when not rendering them on my server, tick time is about 5ms). They are far laggier to render than similar things from other mods (like immersive engineering windmills for example). Perhaps they could be rendered more efficiently to reduce lag?

commented

Those models are precompiled with GL display list. As far as i know, it is the most efficient way for the version of GL that Minecraft is shipped with.
Plus models don't exist for the server. If you have server lag, then the logic is the issue. Like the energy calculations and stuff.
Please try not to confuse client and server process.

commented

I don't know whether they are coded the most efficient way possible when rendering is concerned, but I'm inclined to trust your judgement. However, the lag only occurs while rendering. If it is chunkloaded, but no players are close enough to force it to render, it doesn't server lag. From what I know, that means it isn't so much a logic issue as a rendering issue, or something else about the windmills that relies on player proximity. My server mates and I did a lot of testing, and the moment it gets rendered, it lags, as soon as the player is far enough away to stop rendering, the server stops lagging. That is simply the data we have collected.

commented

Please report if latest version fixed it.

commented

That did fix it up completely, and there is no real noticeable increase in tick time from rendering about 15 windmills at once. Well Done! May I ask what caused it?

commented

Well i improved rendering speed by not pushing as many matrices, and cutting down useless rotations.
I improved windmill construction iteration speed with a better hashing.
Also made render bounding box calculation faster by a simple short-circuit.
None of those fixes had much effect individually. But i guess they could accumulate.