Cuberite Forum
Joining the packet sources - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Joining the packet sources (/thread-524.html)

Pages: 1 2 3 4 5 6 7


RE: Joining the packet sources - NiLSPACE - 08-18-2012

how many phases are there? you now have phase 2 partial.


RE: Joining the packet sources - xoft - 08-18-2012

I expect three or four phases. But the current one is too long and it actually makes sense to commit it in partial increments, because things still do work in each such increment. I don't want to work on this for a week and then find out someone has been fiddling with the code in the same place and we have code conflicts that I need to resolve first, before committing. It also gives others a chance to comment on the new style.


RE: Joining the packet sources - FakeTruth - 08-18-2012

(08-18-2012, 06:54 PM)xoft Wrote: Another side-effect detected:
Some cPacket descendants were exported to Lua and plugins were using them, both to send packets and to handle hooks (BlockDig, BlockPlace). These will be removed, so Lua hooks' signatures will change and the plugins will not be able to invoke default behavior with a modified input data. I don't think this matters much, since it was a very under-documented feature anyway and I don't think anyone would be using that in a plugin anyway.
The interface change, though, is not so great. We'll have a new round of plugin incompatibility Sad

I saw that. Unfortunately this breaks even more than just Lua functions, this breaks functionality.

Before your change you could alter the packets in Lua before sending it back to MCServer. I'm not sure why anyone would do this, but it was possible!

How about wrapping such hooks in a struct? Like before, but this time for ONLY storing the data and not for parsing etc. This should also make it easier to make protocol changes, because you can simply edit the struct and you don't have to change function signatures.


RE: Joining the packet sources - xoft - 08-18-2012

I don't think it's worth the trouble. If a plugin wants to perform a default handling on modified data, it can call the cClientHandle handler with the modified data. The handlers will be Lua-exposed, in the end.


RE: Joining the packet sources - FakeTruth - 08-18-2012

Okay

It would by like the OnTakeDamage callback though http://mc-server.org/wiki/doku.php?id=api:plugin:ontakedamage that function uses a "TakeDamageInfo" objectTongue


RE: Joining the packet sources - xoft - 08-18-2012

I don't think Lua minds if you call its function with more parameters than it actually declares. So for added fields, we can simply add them and plugins will continue working. For fields that are removed, we can simply pass in a default value. And worst case scenario, changed fields, can be expressed as a combination of add + remove.

We'll see how it works, if it's not good enough, we can pack it in structures later on.


RE: Joining the packet sources - NiLSPACE - 08-24-2012

in what phase are you now?


RE: Joining the packet sources - FakeTruth - 08-24-2012

I believe it's phase 3.7delta-Pineapple


RE: Joining the packet sources - xoft - 08-25-2012

Something like that. I'm still removing cPackets from all over the place. so to recap:
Done:
- utility classes - cByteBuffer
- packet handling doesn't take cPackets, but their raw data (cClientHandle::HandleXYZ)
Doing:
- sending packets from various classes doesn't use cPackets, but their raw data (cClientHandle::SendXYZ, cWorld::BroadcastXYZ et al)
To do:
- move packet handling and packet sending from cClientHandle to a separate cProtocol class
- remove cPacket classes altogether, pasting their code directly into cProtocol
- add a cProtocolDetector that can detect 1.2.5 or 1.3.1 protocols
- add a cProtocol descendant for 1.3.1


RE: Joining the packet sources - xoft - 08-26-2012

I'm contemplating the actual need to implement MapChunk packet serializing once for multiple players. With how things work now, the only way for this to be actually used is when two players wander off the known world into the same place at the very same moment. With the chunk generator generating in excess of 50 chunks per second, this is almost never gonna actually happen on a real server.