Understand the Numbers of WCIII

UNDERSTAND THE NUMBERS OF
WCIII
Hello!

This ‘tutorial’, thesis or whatever you could call it, lectures about a couple of
things:

Range,
Colour,
How to recalculate numbers in the editor.

Introduction:
Last night, I had a revelation! … Of sorts.

I lay thinking about the numbers of Warcraft III, which had puzzled me,
before I got to this stage in my education.

A long time ago, I tried to do a ‘reverse TD’ where, the towers moved
through the maze, and units shot at them. You know, upside down world.
But, I just couldn’t seem to get the distance the towers moved, right.
I tried measuring one grid square off the World editor, by holding the cursor
over the lines.
Of course it didn’t go. I got the distance to be ‘round 120. The TD failed utterly.

Some months later, I thought back on this project, and eager to know about
what I’d done wrong, I went about a cleverer way, to measure the distance.
Using the system below, I accurately measured distances and such:

attachment.php


If you set up a trigger as so:

  • Distance
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (String((Distance between (Center of Region 1 <gen>) and (Center of Region 2 <gen>))))
You’ll get a result, in game, showing the following message every 2 seconds:
128.000, which is the accurate distance.
It really helped me understand the game better.
Since I very quickly realized that this also was the distance used as ‘range’
in-game.
It also became clear to me, that this was a part of the binary counting
system.

The Binary numeral system
For all of you, not knowing what this system is, here’s a quick reminder.
All the 0101011101001000 – numbers that we have gotten to know as what’s
behind the computer – is binary counting.

Here’s a link to Wikipedia: http://en.wikipedia.org/wiki/Binary_numeral_system

But, if you want to just have a quick introduction to it, it’s a system, where
each 1 is ‘on’ and each 0 is ‘off’ Let’s try to count to 10, BINARY STYLE!

1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010

Which, translated will be (in the decimal system):

1, 2, 3, 4, 5, 6, 7, 8, 9, 10.

There IS a system to all this nonsense.

To say it easily, every number in the binary system, has a value equal to the
previous number times 2.
And the first number is 1.
Meaning, that this is the actual numbers: 1 means 1, 10 means 2, 100 means
4, 1000 means 8, 10000 means 16, 100000 means 32, 1000000 means 64,
10000000 means 128. (Remember this one :3?)
Then you can combine them to create other numbers. 18, for instance, is a
mix of 2 and 16: 10010.


If you didn’t understand my explanation, you could try counting binary on
your hands. But I’m not going to devote any more time to explaining this
system, try the wiki link, possibly.


To wrap up all this binary nonsense, I did it to help you get an understanding
of why and how the game has been put together.

Also, it should help you in-game to estimate, e.g. exactly how long 400 range
really is. (3 and 1/8 of a square)
This gives you a deeper understanding of the game, and you can make better
estimates to how to put your own maps together.

I know that I’ve learned from it, so why shouldn't you?


Colour – the codes explained easily.

Note: The Title should perhaps have been ... 'as easy as i could'

So! Have you ever wondered why the hell yellow is also known as |cffffcc00
x|r ? (The x being your text) Whilst unit colours have been in a range of 0 to
255? And floating text triggers specifies the colour in percentages?

They’re clearly not based on the same system.
Or are they?
Well, I can tell you, that with a bit of calculation, they are! Let’s begin with
the text code. It’s setup is quite like this:
|cffxxyyzz{insert text here}|r. It looks odd, since I’ve replaced six of the
digits here with something else.
So! Here’s the trick: The x’s code for red, the y’s
code for green, and the z’s
code for blue.

And, instead of these xyz’s, you can put one of these numbers/characters:
0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f. Leaving you with 16 options, per x, y, or z.

This system is known as the hexadecimal system.

Here’s the wiki link, if you want to know more:
http://en.wikipedia.org/wiki/Hexadecimal
It is also known as Hex code.

I won’t explain it as I did with binary, but go to the link, if you really want to
learn about it, instead, I’m going to show you it’s use in colour codes.

It’s actually quite simple. In WCIII (VERY simplified!) 0,1,2,3,4,5,6,7,8,9
,a,b,c,d,e,f. Means 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15. And, when we
set something like this into the colour-codes like, |cffFF0000|r It turns out
as red as it can get.
It’s the first digit times the other (basically).

--- Taken From Ap0calypse ---
(A, B, C, D, E, F
10, 11, 12, 13, 14, 15)

You need to multiply the first character with 16 (G) + the second character.
FF
FF = F * 16 + F
FF = 15 * 16 + 15
FF = 255
--- Taken From Ap0calypse ---

And that’s where we know the unit codes from!
They range from 0 to 255, Which is the exact same as the text codes,
although less ‘code-y’.

Now it is possible to see a connection.

And, you know, to recalculate that number to percentage is easy.
But for those of you not knowing it, you just divide 255 by 100, and then
multiply by how many percentages you want.

It leaves you with how much you need to type into the unit colour-codes.
If you want an easy way to change it to text code, take the square root of
the result, and use find the nearest number from 0-9, A-F. And use that
twice after one another.

It will give you a, maybe a bit, crude result, but I would say that it would do.


Epilogue

I certainly hope that my hours of work will get used for a better
understanding of the numbers of WCIII, and get all readers to a higher level
of map-creating, and understanding.


˜The_Clam (Also Gamecrafter_DK)


Thanks to:

Maskedpoptart, who did a little more on the numbers, link to his post here: It is number 12, if you want to scroll down yourself.
ap0calypse :D That li'l dude are always ready to help :D
http://www.hiveworkshop.com/forums/.../understand-numbers-wciii-148770/#post1387918
 

Attachments

  • Regionscrn.jpg
    Regionscrn.jpg
    61.5 KB · Views: 2,216
Last edited:
Level 8
Joined
Aug 4, 2006
Messages
357
This tutorial is slightly informative, but you could use some work on your ability to explain things. Also, you have a false understanding of the binary numeral system.
1, 01, 11, 001, 101, 011, 111, 0001, 1001, 0101

Which, translated will be (in the decimal system):

1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
It would actually be:
Code:
1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010

Think about it this way: we are used to representing numbers in a numeral system called "decimal". We count through the digits {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} until we run out of digits. Then we add "1" to the place to the left, and continue counting at the current place, starting from 0. Basically, ten is represented as "10" because there are no more digits to use after "9" in decimal.

Binary is pretty much the same, except you can only use the digits {0, 1}. This means that we run out of digits after the number one, and have to add "1" to the place to the left, and start the current place from "0". So, the number two is represented by "10" in binary because there are no more digits to use after "1".

If this still doesn't make sense, just look out how you count in decimal if you put 0s in blank places:
"0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0008, 0009, 0010" <--- OH SNAP
whereas binary would look like:
"0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010"
 
Level 11
Joined
Nov 4, 2007
Messages
931
Epilogue

I certainly hope that my hours of work will get used for a better
understanding of the numbers of WCIII, and get all readers to a higher level
of map-creating, and understanding.


˜The_Clam (Also Gamecrafter_DK)
Nope, the moderator of this forum was kidnapped and taken to a secret government facility for his crime of approving good tutorials.
 
Level 27
Joined
Jan 26, 2007
Messages
4,788
I already knew all of this and it's not entirely correct...

It’s actually quite simple. In WCIII (VERY simplified!) 0,1,2,3,4,5,6,7,8,9
,a,b,c,d,e,f. Means 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16. And, when we
set something like this into the colour-codes like, |cffFF0000|r It turns out
as red as it can get.
It’s the first digit times the other (basically).

The F is 16, and 16 times 16 is 256, and, 1 times 1 is 1.
Well, this isn’t true.
All the results, will (To say it very simply) be minus 1.
So that 1 times 1 is 0, and 16 times 16 is 255.
F = 15

(A, B, C, D, E, F
10, 11, 12, 13, 14, 15)

You need to multiply the first character with 16 (G) + the second character.
FF
= F * 16 + F
= 15 * 16 + 15
= 255

The rest is correct though (1 square is 128x128, which is derived from binary, etc).
It could be useful, but doesn't addresses a lot of information (and it doesn't really go deep into the color codes, only the surface of the numbers and where they come from).
 
Level 13
Joined
Mar 30, 2009
Messages
973
It’s actually quite simple. In WCIII (VERY simplified!) 0,1,2,3,4,5,6,7,8,9
,a,b,c,d,e,f. Means 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15. And, when we
set something like this into the colour-codes like, |cffFF0000|r It turns out
as red as it can get.
It’s the first digit times the other (basically).

http://www.hiveworkshop.com/forums/...-numbers-wciii-148770/index2.html#post1513002
Follow that link to get a proper explanation, i lulzfailz.

dude you should rework that part of your text, not say that you were wrong in the previous passage and that the link should be followed for correction. please just fix it yourself. (CTRL+C CTRL+V?)
 
Level 27
Joined
Jan 26, 2007
Messages
4,788
Try showing the real number 100.00 in Wc3 and you will get something like 99.998 or 99.985 (I can't remember right).
I did not test your technique, but if it shows precisely 128.000 then we've got big problems.
Eh? It shows precisely 100.000...
I do know that wc3's reals are capable of having 8 cyphers (so it's possible to have the real "0.12345678" in JASS).
 
Level 27
Joined
Jan 26, 2007
Messages
4,788
10.00 * 10.00 OR 100.00 * 1.00
Whatever I try, I get 99.985!
There's something seriously wrong with your warcraft.
No matter what I try (10.00 * 10.00 / 100.00 * 1.00 / 12.50 * 8.00 / 6.25 * 16.00 / ...) I always see exacly 100.000.
I tried to multiply that number with 1000 to see if there was any other number behind it (like 100.0002, the 2 won't normally show up), but that just gave me 100000.00.
 
Level 27
Joined
Jan 26, 2007
Messages
4,788
Anything is wrong with my computer. (Even my hard drive starts failing and my video card won't load if my bluetooth adapter is in!)
Uuhh... I don't know a lot about PC's (I did understand what you said though >.>), but if a PC fails to properly calculate 10.00 x 10.00, then there's indeed something wrong D:

This is pretty off-topic though, how about you try to consult a technician or at least someone who has some experience with this?
I really don't know what could possible cause this.
 
Level 20
Joined
Dec 9, 2007
Messages
3,110
Uuhh... I don't know a lot about PC's (I did understand what you said though >.>), but if a PC fails to properly calculate 10.00 x 10.00, then there's indeed something wrong D:

This is pretty off-topic though, how about you try to consult a technician or at least someone who has some experience with this?
I really don't know what could possible cause this.

Me neither.
 
Top