Here's the thing:
I've been working on my thread/article about shotcodes for some time now. I feel like it's coming together soon, but there is a piece I cannot craft alone, myself: an application that you can use to re-create shotcodes. It would be an excellent finishing touch to the text, and would probably draw interest, since it would be easy to re-create and test the shotcodes/find something awesome/possibly achieve glory.
But as said, I am not able to do it. I am very interested in coding, and I have already some experience of Java, but I still don’t know enough about GUIs or such (I only know some methods from it, thanks to my incomplete programming course in school
. Thankfully, I have noticed that there are some (talented?) programmers in SGP, who could, perhaps, create it for me. What do you say?
If you are interested, and I hope you are, here’s the plan:
The idea of the program is to create an environment where you can easily re-create shotcodes that are unreadable or damaged (in this case, the shotcodes in Halo: Reach) or try different bit combinations to see where the code will take you (fun?). Selecting the bits would be done by clicking the area where the bit is located, which would change the bit from 0 to 1 (white to black) or vice versa. After this the code could be read.
In the beginning, the program would draw a blank shotcode to the background, where the bits can be set up. Here, the radius of the shotcode is
7r, so that the radius of one ring is
r, and that the datarings would be 4r to 5r and 5r to 6r.
To determine which bit should be changed, a method named
determineBit would be used. determineBit would have two parameters,
x and
y, namely the coordinates of the click of the mouse. Since there are 2 rings (5r and 6r) and 24 sectors (each sector is 15 degrees), the bit could be determined by it's distance and degree in relation to the bullseye using trigonometrics and pythagorean theorem (Do I even know what am I talking about? :laugh:).
The method would look like this:
public static int determineBit (double x, double y)
{
int bit = 117;
int shotcodeWidth = 14;
int shotcodeHeight = 14;
int degreePerBit = 15;
int error = 117;
int r = 1;
x -= shotcodeWidth / 2;
y -= shotcodeHeight / 2;
/*Since the ring x*x + y*y = 7r*7r, or The boundaries of the shotcode, is drawn
* around the origo, all the calculations must be made there. Meaning, when the
*user clicks the center of the shotocde, in the calculations, he is clicking the
* origo (0, 0). That is why certain values, like half of the size of the
*shotcode and coordinates must be taken out of the click coordinates.
*/
if (x*x + y*y >= 4*r*4*r)
{
if (x*x + y*y <= 6*r*6*r)
{
if (x > 0)
{
if (y > 0)
bit = (int) Math.floor (Math.abs(Math.toDegrees (Math.atan (x/y)) / degreePerBit));
else if (y < 0)
{
bit = (int) Math.floor (Math.abs(Math.toDegrees (Math.atan (y/x)) / degreePerBit));
//Note the difference to the earlier case
bit += 6;
}
else if (y == 0)
bit = error;
}
else if (x < 0)
{
if (y < 0)
{
bit = (int) Math.floor (Math.abs(Math.toDegrees (Math.atan (x/y)) / degreePerBit));
bit += 12;
}
else if (y > 0)
{
bit = (int) Math.floor (Math.abs(Math.toDegrees (Math.atan (y/x)) / degreePerBit));
bit += 18;
}
else if (y == 0)
bit = error;
}
else
bit = error;
if (x*x + y*y >= 5*r*5*r)//If on outer rim
bit += 24;
}
else
bit = error;
}
else
bit = error;
return bit;
}
(Don't worry, if you still don't understand, you don't have to: I've checked it works.)
The value of determineBit is from 0 to 47, giving 48 values, one for each bit. If the click does not hit any bit, it returns error value/117
.
Each bit would have a value in a chart
int bitValues [48]. When the user clicks the bit, the value of that bit goes up by 1. When the value can't be divided with 2, the bit is drawn. When it can, or the value is zero, it is not drawn:
if (bitValue [determineBit(x,y)] % 2 != 0 || bitValue [determineBit(x,y)] == 0)
bitValue [determineBit(x,y)]++;
The image of the bit would be a .png, which would b as big as the shotcode, but only the area of the selected bit would be present in the image; the rest would be transparent. This way we don't have to think about how to calculate the coordinates of the bit, since they can be drawn to the same spot as the Shotcode. Thankfully, we dont have to create 48 different images, since we can do just 12 and then mirror them to create the rest.
Also, if we could have a grid you could toggle, placing the bits would be easier.
...And that's it. I'm sorry I can't code more than this, but I still am just an amateur
. All help is appreciated, since this would take probably months for me to finish it...
I can work on the images myself, but if there are any takers, I could use that time to write the thread, you know...
Thanks is advance!