|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
base95 Numbering System
You might have already noticed that Furcadia doesn't use a decimal numbering system to specify coordinates
and just about anything else. In order to reduce bandwidth usage in favor of those who don't own a fast
connection to the server, the system uses base95 numbers instead of base10.
Conversion Between BasesObviously, since we all are used to good old decimal numbers of the base10 system, we will most definitely want to convert these scary leters into something we understand more. Here is a little equation you have to do in order to convert a base95 number into a decimal one (assuming that the number is valid and that the number consists of 2 bytes!): n = ((byte[0] - 32) * 95) + (byte[1] - 32) Note that we are dealing with unsigned numbers - there should be no negative values in Furcadia's data! From this point you can probably go as far as 3-byte numbers and further, but in our case it's not really necessary, since probably the maximal number you will see in Furcadia won't go over two bytes. Here is a pair of equations that would convert a decimal number between 0 and 9024 into a base95 number:
byte[0] = (n / 95) + 32 The numbers in byte[0] and byte[1] are leters in the second area of the ASCII table (32 - 127). We use that particular area because it's the most "sane" one in the entire table and you won't face any troubles typing these numbers on your keyboard... Well, that's about it. Now you know how to get sane numbers out of what you can see, passing through to your Furcadia client. This is the main part of understanding the protocol because most of it consists of these very numbers. After this point, the protocol shouldn't be looking as strange as it used to in the very beginning. C/C++ Conversion Functions
/*** String to Integer ***/
/*** Integer to String ***/ Digit Table
If you can't be bothered doing it on your own, here is a table of digits for the base95 system, it's decimal
value nearby.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright © 2004-2005 by IceDragon - All rights reserved |