I suggest you ...

Normalize angle reference system

Normalize all angles to the same reference system. Now some angles (robot.angle) points to the top of the screen when its value is 0 and others point to the left (robot.cannonAbsoluteAngle). Also, some are in the 0..360 range, but others are in -180..180

45 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Berny CantosBerny Cantos shared this idea  ·   ·  Admin →

    11 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • justfixthisjustfixthis commented  · 

        it WILL not break other robots. As said, and as common sense dictates, just mark the current vars as deprecated, and add new normalized variables.

      • Ivan SIvan S commented  · 

        Normalizing angle system is an excellent way to filter out an ENORMOUS number of clones/copies.

        Original authors will update their robots, clones will go down the rank ladder.

      • Toni UebernickelToni Uebernickel commented  · 

        I don't see why this is required.

        The range of -180..180 degrees is actually reasonable when representing the bearing between two objects.
        The gun of a robot is just another object which support point is on the robot itself. Thus having -135 degrees (pointing rear left) or 135 degrees (pointing rear right) is perfectly fine.

        It's much more descriptive than having the range of 0..360!

      • Egor SaveikoEgor Saveiko commented  · 

        This could be fixed without breaking backward compatibility adding alternative vars with normalized angles relative to one angle start. old robots will work, but new can be write in new angles:
        Smth like this:
        robot.log("CAA Normalized:" + robot["cannonAbsoluteAngleN"]); //see N in the end of var
        robot.log("CRA Normalized:" + robot["cannonRelativeAngleN"]);
        robot.log("RA Normalized:" + robot["angleN"]);

        Or players can add some normalization functions like
        //change degree start from 0 to 90 (90 will be 0, 180 - 90, 270 - 180, 360 - 270)
        A -= 90;
        if(A < 0) A+=360;

      • Matthew BellantoniMatthew Bellantoni commented  · 

        I couldn't find this documented anywhere. Is it? This consumed about an hour of my time.

      • alexanderzeillingeralexanderzeillinger commented  · 

        ev.bearing of the onWallCollision event seems flipped to me. It returns the relative angle of the robot in reference to the wall, not the other way around as I think it should be. The bearing of onHitByBullet is correct, though.

      • Fredrik HåårdFredrik Håård commented  · 

        I'd suggest keeping the current method as-is, document that it is broken and deprecated, and add another one with a different name to authors can migrate their bots without breaking.

      • Phil D.Phil D. commented  · 

        I'm curious how this could be fixed without breaking backward compatibility.

      Feedback and Knowledge Base