Author Topic: Shotcode maker - I need [some of] YOU!  (Read 6033 times)

Imppa

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 1372
  • Karma: +31/-31
    • View Profile
Shotcode maker - I need [some of] YOU!
« on: January 01, 2011, 20:54:53 »
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:

Code: [Select]

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:
Code: [Select]
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 :P. All help is appreciated, since this would take probably months for me to finish it...:D
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!
Den glider in, Den glider in, Den glider in i mål igen...

Scatcycle

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 1967
  • Karma: +44/-65
  • swag
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #1 on: January 01, 2011, 21:01:34 »
If I can I will work on this soon...

It would be a great thing to have, but is it really necessary? We have the blank shotcode...

Anyways, I will work on it in a different programming language, as I do not know Java yet, so I will keep you updated on that.
I feel it

Pulse Cloud

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 802
  • Karma: +23/-19
  • The pickle-shooting Cannon.
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #2 on: January 01, 2011, 22:04:49 »
So you want to create shotcodes yourself? Like.. those circular images?
*sigh*
You don't need to be an expert at programming - you need to know how to use Paint (or Photoshop).

Sure, it would be a good exercise and it would be fun (lolno), but using Photoshop is WAAY easier and WAAY faster.

KISS. :)
I am tree.

Phantasm 08

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 745
  • Karma: +14/-4
  • Scatcodes are the Gruntz Pajamaz
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #3 on: January 02, 2011, 04:43:37 »
Well, it'd be more user-friendly and way faster once it was set up, than using Paint or something, and it would be a useful program to whip up a shotcode in no time flat, and if you mess up in an image editor, you'd have to refresh it or undo the last action, and when you finished you'd still have those unsightly lines between the blank areas. 

Oh, and a simple tip for defining variables is to categorize them by type, and define them all at once, like so:
Code: [Select]
     int Bit = 117,
     shotcodeWidth = 14,
     shotcodeHeight = 14,
     degreePerBit = 15,
     Error = 117;

At least you can in C++, and that's what it looks like you're using.  In later versions, one would think it would be at least that efficient, if not more so.
01010000 01101111 01110011 01110100 00100000 01101000 01101111 01100011 00101100 00100000 01101110 01101111 01101110 00100000 01100101 01110010 01100111 01101111 00100000 01110000 01110010 01101111 01110000 01110100 01100101 01110010 00100000 01101000 01101111 01100011 00101110

Imppa

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 1372
  • Karma: +31/-31
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #4 on: January 02, 2011, 10:35:27 »
As Phan said, when the program would be set up, it would be much easier than faster to make one THAN IN PHOTOSHOP. Creating the app is a different story...:P

Oh and Phan, I am using Java there.
Den glider in, Den glider in, Den glider in i mål igen...

Pulse Cloud

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 802
  • Karma: +23/-19
  • The pickle-shooting Cannon.
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #5 on: January 02, 2011, 12:36:28 »
How to Photoshop (or Illustrator for vectorized graphics (ie, perfectly smooth lines)):
1- Create new layer and draw a circumference
2- Create a layer for each "circle segment" (create one, copy-paste and rotate)
3- DONE! Just hide the unnecessary layers and it's game.

You feelin' me, dawg?
I am tree.

nightcrafter27

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 803
  • Karma: +27/-22
  • she / her, puzzles 👀
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #6 on: January 02, 2011, 18:13:29 »
How to Photoshop (or Illustrator for vectorized graphics (ie, perfectly smooth lines)):
1- Create new layer and draw a circumference
2- Create a layer for each "circle segment" (create one, copy-paste and rotate)
3- DONE! Just hide the unnecessary layers and it's game.

You feelin' me, dawg?

4- Post image on SGP and wait for imppa to decode it.
5- Get results, possibly days later
6- Feel that dawg
« Last Edit: January 02, 2011, 18:36:04 by Scatcycle »
ODST is all about switches, isn't it?

Hello from 2023! PM me if you want to chat on Discord!

Imppa

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 1372
  • Karma: +31/-31
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #7 on: January 02, 2011, 19:54:06 »
How to Photoshop (or Illustrator for vectorized graphics (ie, perfectly smooth lines)):
1- Create new layer and draw a circumference
2- Create a layer for each "circle segment" (create one, copy-paste and rotate)
3- DONE! Just hide the unnecessary layers and it's game.

You feelin' me, dawg?

4- Post image on SGP and wait for imppa to decode it.
5- Get results, possibly days later
6- Feel that dawg
You callin' me slow?  >:(
And while that is true, Night, let me correct you before Pulse does. There are probably more people who could decode it, if you'd just download the app (it supports majority of the models out there, I think). And even if you didn't, you could probably find people from bnet or other groups who would gladly do it in matter of hours (assuming the case catchs interest once more).
No, that is not the thing. The thing is that even though some people could do it easily (if we gave them the models ready), most probably couldn't. Would they even bother doing that much? "Here are the models, now download them on your computer, open your Photoshop and make it work!" Wouldn't it be better if we said "Just scroll down a bit and start placing your bits"?
If an application cannot be made, THEN we will go with the old model. But Pulse, please try to understand that the app would be much better for that huge thing people call Internet.
Den glider in, Den glider in, Den glider in i mål igen...

Scatcycle

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 1967
  • Karma: +44/-65
  • swag
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #8 on: January 02, 2011, 19:57:25 »
How to Photoshop (or Illustrator for vectorized graphics (ie, perfectly smooth lines)):
1- Create new layer and draw a circumference
2- Create a layer for each "circle segment" (create one, copy-paste and rotate)
3- DONE! Just hide the unnecessary layers and it's game.

You feelin' me, dawg?

4- Post image on SGP and wait for imppa to decode it.
5- Get results, possibly days later
6- Feel that dawg
You callin' me slow?  >:(
And while that is true, Night, let me correct you before Pulse does. There are probably more people who could decode it, if you'd just download the app (it supports majority of the models out there, I think). And even if you didn't, you could probably find people from bnet or other groups who would gladly do it in matter of hours (assuming the case catchs interest once more).
No, that is not the thing. The thing is that even though some people could do it easily (if we gave them the models ready), most probably couldn't. Would they even bother doing that much? "Here are the models, now download them on your computer, open your Photoshop and make it work!" Wouldn't it be better if we said "Just scroll down a bit and start placing your bits"?
If an application cannot be made, THEN we will go with the old model. But Pulse, please try to understand that the app would be much better for that huge thing people call Internet.
*snickers*

But anyway, if people are intelligent enough to make a real, working shotcode, they will know how to use paint.
I feel it

Imppa

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 1372
  • Karma: +31/-31
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #9 on: January 02, 2011, 20:41:43 »
But, but...:(
Den glider in, Den glider in, Den glider in i mål igen...

Phantasm 08

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 745
  • Karma: +14/-4
  • Scatcodes are the Gruntz Pajamaz
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #10 on: January 03, 2011, 01:54:43 »
But if people are smart enough to use paint, they would also recognize the importance of having an easy-to-use app, as opposed to individually saving a blank shotcode, and making a new Paint image every time they wanted to make a shotcode.

Face it, people are lazy, and generally, if they have to go out of their way to do something simple on our site, they're not going to like it nearly as much as taking the cursor and going click-click-done. That kind of thing really can make or break the sale. Yes, I'm speaking metaphorically here, but you get the idea.

My dad works mostly with C#, but I sent this page to him in the hopes that he might have some insight. He does web programming for the State Board of Education, so this should be right up his alley.
01010000 01101111 01110011 01110100 00100000 01101000 01101111 01100011 00101100 00100000 01101110 01101111 01101110 00100000 01100101 01110010 01100111 01101111 00100000 01110000 01110010 01101111 01110000 01110100 01100101 01110010 00100000 01101000 01101111 01100011 00101110

Scatcycle

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 1967
  • Karma: +44/-65
  • swag
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #11 on: January 03, 2011, 02:05:45 »
But if people are smart enough to use paint, they would also recognize the importance of having an easy-to-use app, as opposed to individually saving a blank shotcode, and making a new Paint image every time they wanted to make a shotcode.

Face it, people are lazy, and generally, if they have to go out of their way to do something simple on our site, they're not going to like it nearly as much as taking the cursor and going click-click-done. That kind of thing really can make or break the sale. Yes, I'm speaking metaphorically here, but you get the idea.

My dad works mostly with C#, but I sent this page to him in the hopes that he might have some insight. He does web programming for the State Board of Education, so this should be right up his alley.
How many time are people going to make shotcodes? Not even people at the SGP exceed over 5-10.
I feel it

nightcrafter27

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 803
  • Karma: +27/-22
  • she / her, puzzles 👀
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #12 on: January 03, 2011, 02:10:51 »
Well, Immpa, I would love to decode shotcodes. But, I have bought three different apps to do that, and none have worked. I'm also learning Java, albeit much farther behind you, and would love an opportunity to get some hands on experience. The app would bring more attention to our site than a blank shot code image would.

And Scat put your name in my earlier post :P
ODST is all about switches, isn't it?

Hello from 2023! PM me if you want to chat on Discord!

Scatcycle

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 1967
  • Karma: +44/-65
  • swag
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #13 on: January 03, 2011, 02:14:26 »
Well, Immpa, I would love to decode shotcodes. But, I have bought three different apps to do that, and none have worked. I'm also learning Java, albeit much farther behind you, and would love an opportunity to get some hands on experience. The app would bring more attention to our site than a blank shot code image would.

And Scat put your name in my earlier post :P
I talked about this with Imppa, I told him that our app could get us money, could be used for actual stuff, not just halo stuff, and we could get money for it.

Imppa said: "Nah."
I feel it

Phantasm 08

  • SGP Moderator
  • Hero Member
  • ***
  • Posts: 745
  • Karma: +14/-4
  • Scatcodes are the Gruntz Pajamaz
    • View Profile
Re: Shotcode maker - I need [some of] YOU!
« Reply #14 on: January 03, 2011, 03:30:57 »
I talked about this with Imppa, I told him that our app could get us money, could be used for actual stuff, not just halo stuff, and we could get money for it.

Imppa said: "Nah."

Well, I only have this to say to Imppa.

You would be surprised how much money you can get for saving someone two seconds of trouble.  

How many time are people going to make shotcodes? Not even people at the SGP exceed over 5-10.


The difference between having an application where you click a single data point to fill it all in, and having to shade it in with Paint may not be much.  But being able to do it in the same window, without having to open an extra program, and being able to copy it and save it as it is, will be far easier.  Not to mention, that much easier to bring up if you have a sudden idea, and have a finished product in a matter of seconds rather than minutes.  It's a matter of convenience, and THAT'S what the public wants.  Not everyone will be inclined to save that blank Scatcode and edit it themselves, but being able to fill in the blocks at the push of a button will be received with more open arms.  It will also have cleaner edges, and it'll LOOK better.  It's easier and faster, and anyone can produce an end result that looks good.

Who knows?  Maybe we can make our own shotcode, that corresponds to our site.  And, as much as I like Enigma's Octagon, I bet we could replace the one on 8-Bit Johnson's cover with our own personalized shotcode.
« Last Edit: January 03, 2011, 04:13:06 by Phantasm 08 »
01010000 01101111 01110011 01110100 00100000 01101000 01101111 01100011 00101100 00100000 01101110 01101111 01101110 00100000 01100101 01110010 01100111 01101111 00100000 01110000 01110010 01101111 01110000 01110100 01100101 01110010 00100000 01101000 01101111 01100011 00101110