It's called a"packet" and it's preset in the client. You won't be able to understand it unless you knew simple shit about Java, btw, you don't.
|
Alright guys, quick question, how do you know on a code like this:
public void sendItemArray(int frameId, int itemId, int slot, int itemAmount) {
c.outStream.createFrameVarSizeWord(34);
c.outStream.writeWord(frameId);
c.outStream.writeByte(slot);
c.outStream.writeWord(itemId+1);
c.outStream.writeByte(255);
c.outStream.writeDWord(itemAmount);
c.outStream.endFrameVarSizeWord();
}
when is something a byte, when is something a word, a Dword, etc.. and why is it 34 on createframevarsizeword. I would love to be able to understand all of this. thanks.
It's part of the protocol. The byte is a byte, the word is a short, the dword (double word) is an integer, it isn't used here but qword (quadruple word) is a long.
A byte is 1 byte (8 bits) long, a short is 2 bytes (16 bits) long, an integer (double word -> double the size of a word) is 4 bytes (32 bits) long, a long (quadruple word -> quadruple the size of a word) is 8 bytes (64 bits) long.
34 is the packetId and strangely enough, createFrameVarSizeWord would mean the packetSize isn't fixed, which actualy does seem to be the case.
Just as "i r magot" said, the value will never reach the max value of a byte and a byte is smaller than a short.
With internet, you actually pay per byte sent over the internet (never wondered why most internet providers have download limits?).
Therefor, a gaming company would do great to use small primitives instead of bigger ones if they can manage with the small ones. It saves them bandwidth.
For the same reason, they sometimes manipulate bits on their own.
Technically, writing or reading a byte is faster than writing or reading a short. Another advantage there.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |