Tutorial:Turning Props Into Plops/3
[quote author=dedgren link=topic=112.msg181998#msg181998 date=1221945588] [font=Verdana][size=9pt][size=13pt][b]Turning a prop into a plop - A tutorial (Part Three)[/b][/size]
This is the third part of the 3RR Plopperizer™ tutorial. [url=http://sc4devotion.com/forums/index.php?topic=112.msg181757#msg181757][font=Verdana][size=9pt]Part One is here [[color=green]linkie[/color]][/size][/font][/url] and [url=http://sc4devotion.com/forums/index.php?topic=112.msg181906#msg181906][font=Verdana][size=9pt]Part Two is here [[color=green]linkie[/color]][/size][/font][/url].
When we last left off, we were looking at the Reader's directory list pane. We'll start with column 1: "Entry".
[size=7pt][i]Fig. 15[/i][/size] [img]http://img219.imageshack.us/img219/9971/fig15pb2.png[/img]
As noted, we'll be editing all of these files: the exemplar, LTEXT and PNG files directly, and the DIR file indirectly just before we finish up. Exemplar files are a purpose-determined collection of fixed game parameters into which we will be entering specific values. I've taken care of identifying which exemplars you will need for a ploppable and what parameters are required in each. Your job will be to enter the unique values necessary to set up the ploppable. By the time you complete the tutorial, you'll know how. LTEXT files are what generate the menu flyout information
[size=7pt][i]Fig. 16[/i][/size] [img]http://img223.imageshack.us/img223/5217/fig16ds1.jpg[/img]
and PNG files are what create the ploppable item icon in the menu. The DIR file is...well, again, we'll get to that later.
We'll skip over the headings to "Type", "Group" and "Instance", as we won't be editing any of the "Compressed", "Location", "Filesize", or "Num" entries (at least not directly, anyway) in the process of making a ploppable.
[size=7pt][i]Fig. 17[/i][/size] [img]http://img217.imageshack.us/img217/8350/fig17iw8.png[/img]
These three columns consist of sets of three eight alphanumeric character hexadecimal numbers: i.e: "6534284a e83e0437 de522800".
[size=7pt][i]Fig. 18[/i][/size] [img]http://img509.imageshack.us/img509/9586/fig18co4.png[/img]
I feel obliged to give folks who haven't worked with hex numbers the briefest explanation of them...
[i]...whoa, whoa! You folks running away! I promise I'll make this short and relatively painless. It'll help to know this- promise...[/i]
...if you are a hexadecimal master, we'll see you in just a minute.
All hexadecimal (as we'll refer to it from this point) is is counting in a difference base system. Remember "Base 2" from junior high and middle school...
[i]...all I can remember is the end of recess and awkward dating...[/i]
...you know: 0=0, 1=1, 2=10, 3=11, 4=100, 5=101, and so on. Foundation of the computer age and all that. Lots of ones and zeroes. Rings a bell, eh?
Well, hexadecimal is counting in Base 16. Now, before you go crazy wondering how they do that (not to mention why, which we'll get to in a minute), I'll simply tell you. Hexadecimal adds to the numerals 0-9 the alpha characters A-F to make up a number. So
0=0, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7, 8=8, 9=9 (and here's where it gets interesting) 10=A, 11=B, 12=C, 13=D, 14=E, 15=F (and here's where it gets weird) 16=10, 17=11, 18=12, 19=13, 20=14, 21=15, 22=16, 23=17, 24=18, 25=19 (and here's where it gets positively scary) 26=1A, 27=1B, 28=1C, 29=1D, 30=1E, 31=1F, and...
[i]...here's where Elvis leaves the building...[/i]
...well, if you figured out that 32=20, let's just say you now understand hexadecimal better than I did for many, many years. Let me throw a few more at you. 100=64, 253=FD, 1067=42B. And, just for grins, 3729926144=de522800, our "instance" hexadecimal number last noted above.
Now, are we going to expect you to do do hexadecimal calculation in order to create ploppables? Absolutely not! There's just one thing you need to understand out of all this- only the digits 0-9 and alpha characters A-F can be used in hexadecimal to make up a number. It would take Base 36 to have "PB11X36A" be a valid number, as "P" and "X" are not valid hexadecimal alpha characters.
[b]n.b.[/b]: If you find yourself wanting to convert decimal numbers into hexadecimal, and [i]vice versa[/i], the Reader has a conversion function. For simplicity's sake, though, just use the "Scientific" calculator that comes with Windows for occasional conversions.
[size=7pt][i]Fig. 19[/i][/size] [img]http://img219.imageshack.us/img219/1654/fig19yl4.png[/img]
So, now that you can count up to F, why in God's green earth would anyone bother?
Have you ever wondered how it is possible that thousands (my guess) of folks have created custom content for the game over the past five years or so and you almost never hear of one creator's contribution conflicting with another's? Let's make some educated guesses- I think the number of BATs created for the game out there probably number in the low 10,000s. That's because the total number of uploads to the STEX, which is the largest exchange, is just over, as of about five minutes ago, 12,200. The LEX accounts for another 1,800 or so. Let's say, then, that the total number of BAT objects created out there is about 25,000. Now, just for the sake of argument, let's say that each was ploppable, and you somehow had each one in your plugins folder. Each one of these, then, would have (at least) one instance number associated with it.
Remember our "address" analogy we used back in Part Two? One eight alphanumeric character hexadecimal instance number references 4,294,967,296 possible locations. That's over four billion possibilities, for those of you who are, like me, prone to brain freeze when you see a number longer than seven figures.
Now, the way to sum this up is basically, out of four billion possibilities if you have 25,000 random choices, what are the chances that two of those choices will be the same? [url=http://en.wikipedia.org/wiki/Birthday_paradox#Cast_as_a_collision_problem][font=Verdana][size=9pt]Wikipedia calls this a a statistical "collision problem" [[color=green]linkie[/color]][/size][/font][/url] and sums up the math as follows.
[size=7pt][i]Fig. 20[/i][/size] [img]http://img502.imageshack.us/img502/2494/fig20mk4.png[/img]
Not that, as I've admitted, I'm a real math giant or anything but I know the answer to this one without even doing the calculation...
...[i]real d-mn small[/i].
Now,you've probably figured out that SC4 uses TGIs for lots of things in the game, so what effect might this have, however small? The answer is that we just looked at the effect of changing the instance number. There's also about four billion possible "group" numbers and another four billion "type" numbers. That's, glossing over a lot of picky details, about four billion cubed, or 79,228,162,458,924,105,385,300,197,375 different discrete addresses. Now, a few of you might have a really, really big plugins folder, but I still don't think you have anything to worry about.
So, hexadecimal is used for SC4 TGI numbers because, in just 24 alphanumeric characters, it creates an effectively infinite number of entirely separate ways to refer to things in the game. Neat, huh?
I'm winding up Part Three here, because I know everyone wants to wrap a cold towel around the head after all that math. You'll find [url=http://sc4devotion.com/forums/index.php?topic=112.msg182091#msg182091][font=Verdana][size=9pt]Part Four here [[color=green]linkie[/color]][/size][/font][/url].
David
[size=6pt]131555[/size][/size][/font] [/quote]