[Small Tutorial] Packets in Conquer Online

01/08/2012 19:23 Spirited#1
Replaced with [Only registered and activated users can see links. Click Here To Register...]
01/08/2012 20:19 |xabi|#2
Great Mr.Fang
01/09/2012 00:35 Arco.#3
Quote:
Originally Posted by Y u k i View Post
A ushort is equal to two bytes. It holds a value between 0 and 65,535 (65536 in total)
Actually he phrased that wrong. It holds a value between -1 and 65536.
Saying it holds a value between 0 and 65,535 is saying that it can be valued as 1-65534.
01/09/2012 01:04 Spirited#4
Quote:
Originally Posted by Arco. View Post
Actually he phrased that wrong. It holds a value between -1 and 65536.
Saying it holds a value between 0 and 65,535 is saying that it can be valued as 1-65534.
Depends on the context. You wouldn't say "pick a number between 1 and 10" to mean 2-9.
In addition to that, I stated the total amount of values (which eliminates that confusion) so there's nothing wrong about the context that I'm using it in.
01/09/2012 02:47 Lateralus#5
In the context of this post, saying "between" implies non-inclusivity.
01/09/2012 03:55 Arco.#6
Quote:
Originally Posted by Fаng View Post
Depends on the context. You wouldn't say "pick a number between 1 and 10" to mean 2-9.
In addition to that, I stated the total amount of values (which eliminates that confusion) so there's nothing wrong about the context that I'm using it in.
Yes, I would. That's grammar at its finest. And that doesn't eliminate any confusion, it's wrong based on your previous statement, because there would be 65533 in total.
01/09/2012 04:05 Lateralus#7
Quote:
Originally Posted by Fаng View Post
You wouldn't say "pick a number between 1 and 10" to mean 2-9.
@Arco - I would as well.

@Fang - You're supposed to say "pick a number from 1 to 10", not between, because that'd mean from 2 to 9. Who says between?
01/09/2012 05:11 Arco.#8
Quote:
Originally Posted by Fаng View Post
A byte holds an integer between 0 and 255 (256 total). In C++, it's called an Int8.
No. After discussing this with Evan, we both agree you are wrong. A byte in C++ is a uchar. And another part where you're wrong, UInt8 would be the correct typecast for it.
01/09/2012 06:04 CptSky#9
Quote:
Originally Posted by Arco. View Post
No. After discussing this with Evan, we both agree you are wrong. A byte in C++ is a uchar. And another part where you're wrong, UInt8 would be the correct typecast for it.
True. The 'Byte' in C# is the equivalent of the 'unsigned char' if we consider that a char is implemented as a 8 bits integer.

Anyway, a byte is an integer of any size. Some implementations say that a byte is an integer of 9 bits, some others say that it's 7 bits. To avoid confusion, the C99/POSIX standard implemented the (u)intN_t definitions where it's an (un)signed N bits integer. It's not true to say that a byte is a UInt8. As we shouldn't say that an ushort is a UInt16 as a short is suppose to be at least 16 bits. When defining structure, you should use type name based on the number of bits. And you shouldn't say the number of bytes of a file, but the number of octets as an octets is defined as an 8 bits integer. You should avoid using keywords as short/int/word/byte/etc because they are all dependent of the implementation. They aren't fixed-size integer as the C99/POSIX standard.

So, to be compliant to any language, any implementation.
(U)IntN is the solution ;)

Oh, and to give a good definition for the range of a N bits integer.
Signed: [-2^(N-1), 2^(N-1) - 1]
Unsigned: [0, 2^N - 1]
01/09/2012 06:20 Spirited#10
I guess it would be unprofessional to say "shut the fuck up everyone", but nobody here has a valid point that adds to this thread (except for CptSky, thank you so much for that input - it's exactly the kind of criticism that I need). Arco, you need to cut this out dude. It's not appropriate and this "competition" that you feel between us needs to stop. There is no competition between us. I wrote this thread to get proper, professional criticism, not for some 15 year old kid to grammar correct me.

I will make changes to the thread above.
Good day everyone.
01/09/2012 06:59 Lateralus#11
Quote:
Originally Posted by Fаng View Post
I guess it would be unprofessional to say "shut the fuck up everyone", but nobody here has a valid point that adds to this thread (except for CptSky, thank you so much for that input - it's exactly the kind of criticism that I need). Arco, you need to cut this out dude. It's not appropriate and this "competition" that you feel between us needs to stop. There is no competition between us. I wrote this thread to get proper, professional criticism, not for some 15 year old kid to grammar correct me.

I will make changes to the thread above.
Good day everyone.
We all had valid points that added to this thread, as evidenced by the changes to the original post. Anyway, continue on.
01/09/2012 07:24 I don't have a username#12
Quote:
Originally Posted by Korvacs
If you don't know what your talking about, then stop talking.
.
01/09/2012 07:37 Spirited#13
Quote:
Originally Posted by I don't have a username View Post
.
Sorry, but if you have a better explanation then by all means go for it.
01/09/2012 07:57 Arco.#14
Quote:
Originally Posted by Fаng View Post
Sorry, but if you have a better explanation then by all means go for it.
He's referring to you trying to reference C++.
01/09/2012 08:33 I don't have a username#15
Quote:
Originally Posted by Arco. View Post
He's referring to you trying to reference C++.
That ^

Obviously it wouldn't be Int8 as you can't send signed integers in a packet. Well not true there is a way you can, you could do something like:
Code:
bool negative
signed integer
However it's not a real way to do it, but it's equal to the way negative values are stored in your machine.