Decouple markDirty and markBlockForUpdate in AgriCraft TileEntities
szuend opened this issue ยท 9 comments
As we have reduced the amount of calls to markDirty for improved rendering. (Really we decreased the amount of calls to makrBlockForUpdate), Waila wont show correct (actual) fluid levels anymore.
For 1.3 we should decouple re-rendering of Blocks and updating of TileEntities for the Client.
But resynchronising water levels 4 times per second is quite a lot of packets if you take into account how many channels could be placed in world for mid/large farm systems.
You might be right. Just checked the packet code. A packet will have ~16 byte of payload. Assuming 500 loaded channels where each updates 4 times per sec (really the worst case), we end up with a (net payload) of around 32 kbyte / second. As I'm fairly new to modding I have no idea how this compares to other mods but it sounds like a lot.
@Imasius one solution would be to simulate water drain on client and occasionally resynchronise it with server.
@Kubuxu That is a neat idea but I don't think it is needed. IMHO it should be enough to synchronize water levels 1-4 times per second (if they change) and seperatly, cause render updates 1-4 times per second if the discrete (0-16) water level changes.
Although I might fall back to your approach once I have taken a closer look at the code and tried it out.
It is quite a lot. In fully running base (it is big) I am getting 15 kbyte/s down. And you must remember that 16bytes of your payload is equal +50 because of protocol overheads.
Hmm I knew it was bad, but I had no idea it was that bad, I'll look what I can do if I have time
Thanks for that, but I will still have to look at my tile entities because when I wrote them I just carelessly threw markBlockForUpdate in markDirty() without really thinking it over. So yeah :s
But it'll definatly help with the tanks
If Waila is the only issue, it has built-in support for syncing NBT data from the server to the client.
For Waila >= 1.5.6: http://www.mobiusstrip.eu/2014/12/14/waila-1-5-6-for-mc-1-7-10/
For Waila < 1.5.6: https://github.com/squeek502/VeganOption/blob/master/java/squeek/veganoption/integration/waila/WailaRegistrar.java#L16-L24