stackotter / delta-client

An open source Minecraft Java Edition client built for speed.
https://deltaclient.app
GNU General Public License v3.0
322 stars 33 forks source link

Make lighting updates block for less time #125

Open stackotter opened 1 year ago

stackotter commented 1 year ago

At the moment when joining Hypixel there is a period of time when hardly any chunks render and then they super quickly render all at once. It's not a rendering issue because the fps stays at a healthy 60 while this is happening. After profiling I found that it was all the lighting updates happening from block updates. They were triggered before any chunks were queued to render so the renderer has to wait for them to complete.

One improvement would be to group the lighting updates from multi-block changes. Grouped lighting updates is already implemented but just isn't used, so that optimisation shouldn't be too difficult. Doing that alone probably won't be enough of an improvement.

The other improvement I have thought of would be having the lighting engine take a copy of lighting data before it starts and then operating on the copy without any blocking required. It can then replace the old lighting with updated lighting. Lighting updates should probably also be handled on a background thread so that they don't block packet handling (like they currently do). Although that should only be done if it measurably reduces lag because otherwise it is unnecessarily complicating the World system.