Talk:Wave Surfing

From Robowiki
Revision as of 21:52, 9 July 2009 by Voidious (talk | contribs) (→‎The Next Level: cool idea, some thoughts)
Jump to navigation Jump to search

The Next Level

Quite a while ago I had an idea that could bring Wave Surfing to a new level, but I never got around to implementing it. Since the wiki's been quiet the last few days, I thought perhaps something like this might provide a kick to get things rolling again. My idea is Wave Surfing with a twist: not only do you surf the wave(s) that have been fired, but you also take into consideration the waves that have not yet been fired. By predicting your movement, you can predict what the enemy will see, and thus by looking at your movement stats you can see where they are likely to fire. Now, for the interesting part: by varying where you go, not only do you vary what GFs you reach, but you also vary what the enemy sees, and thus where they shoot. Danger can be calculated not only as a low point on a graph, but also on the entropy of the enemy's firing stats when presented with this movement. The more peaked the profile, the better this movement option (provided we can get to a low point). A system like this could basically 'figure out' how to do a movement type like Stop And Go, and probably other amazing types of movement we haven't thought of yet. There! How's that for some food for thought? =) --Skilgannon 20:23, 9 July 2009 (UTC)

Some interesting thoughts here. I'm initially skeptical (as usual =)) because it reminds me of the diminishing returns on surfing waves beyond the first couple. But ignoring that... One hurdle with this is that while you can predict your own movement, you can't (accurately) predict the enemy's movement, which also impacts what they "see" -- distance, lateral velocity, wall distance, etc. depend on enemy location as well as your own. It's a funny thought to use your gun to predict their movement to assist in your own movement. =)

So let's say you can guesstimate the enemy movement -- and maybe the full range of their movement options are pretty similar for our purposes anyway. So for each of my movement options, I'd figure out if/when the enemy would fire (based on gun heat) during that prediction, check my stats of the enemy's bullets fired / bullets hit, factor in the precise max escape angle of that firing situation, and multiply the probability he would hit into the danger calculation. Kinda similar to how many of us factor in distance (and maybe instead of distance, since these two factors would not be independent). I'm still skeptical, but this sounds really interesting!

Good to see I'm not the only one still pondering the next big thing. =) I still want to find a breakthrough in Anti-Surfer Targeting... I know it's there!

--Voidious 20:52, 9 July 2009 (UTC)

You cannot post new threads to this discussion page because it has been protected from new threads, or you do not currently have permission to edit.

Contents

Thread titleRepliesLast modified
BS Learning214:22, 2 December 2017
What type of wave surfing is this?308:50, 21 July 2017

BS Learning

I had been thinking about gathering more information about the enemy gun and finally found a way to do it. If we know that a bullet shadow is safe, can't we add it to safe points to learn. A robot would be able to learn without getting hit. What do you think?

Dsekercioglu (talk)12:37, 2 December 2017

shadowed area isn’t really safe until your bullet passes enemy wave. so just do it every time enemy wave breaks.

keep tabs on shadowed area as in keeping track of hits, and retrieve them in the same way. then shadowed area could be handled like real shadows, but weighted.

Xor (talk)14:16, 2 December 2017

I am going to do it like that in Oculus 1.3.3. Also I was too lazy to calculate without bullets passing the waves so I did it by simulation. It will be easier to add.

Dsekercioglu (talk)14:22, 2 December 2017
 
 

What type of wave surfing is this?

I made this for a micro bot. It is wave surfing but it is not Goto or True wave surfing. It is something more like gravity surfing.Is there a name for this? Sorry for pasting the all code.

    public static double[][] m = new double[3][5];
    double enemyEnergy = 100;
    ArrayList<Wave> waves = new ArrayList<>();

    public void run() {
        setTurnRadarRightRadians(Double.POSITIVE_INFINITY);
    }

    public void onScannedRobot(robocode.ScannedRobotEvent e) {
        double bulletPower;
        double absoluteBearing = e.getBearingRadians() + getHeadingRadians();
        double lateralVelocity = getVelocity() * Math.sin(getHeadingRadians() - absoluteBearing + Math.PI);
        if ((bulletPower = (enemyEnergy - (enemyEnergy = e.getEnergy()))) <= 3 && bulletPower >= 0.09) {
            waves.add(new Wave(bulletPower, getHeadingRadians() + e.getBearingRadians() + Math.PI, e.getDistance(), (int)Math.round(lateralVelocity / 8)));
        }
        double max = 0;
        double dir = 0;
        for (int i = 0; i < waves.size(); i++) {
            Wave w = waves.get(i);
            w.move += getVelocity();
            w.time--;
            if (w.time <= 0) {
                waves.remove(w);
                i--;
            } else {
                dir -= w.dir / w.time;
                max += 1 / w.time;
            }
        }
        dir /= max;
        setAhead(Math.max(-1, Math.min(dir, 1)) * 36);
        setTurnRightRadians(normalRelativeAngle(wallSmoothing(getX(), getY(), getHeadingRadians() + e.getBearingRadians() + Math.PI / 2, (int)Math.signum(dir)) - getHeadingRadians())); //Staying perpendicular to the enemy to have a large escape angle
        setTurnRadarLeftRadians(getRadarTurnRemaining());
        System.out.println(Arrays.deepToString(m));
    }

    public void onHitByBullet(robocode.HitByBulletEvent e) {
        if (!waves.isEmpty()) {
            Wave w = waves.get(0);
            m[w.segment][w.segment2] += Math.signum(w.move);
        }
    }

    public void onHitWall(robocode.HitWallEvent e) {
        onHitByBullet(null);
    }

    public double wallSmoothing(double x, double y, double currentAngle, int dir) {
        if (dir != 0) {
            currentAngle += Math.PI / 20 * dir;//This is optional. I use it to get away from the enemy
            Rectangle2D battleField = new Rectangle(25, 25, 775, 575);
            while (!battleField.contains(x + Math.sin(currentAngle) * 160 * dir, y + Math.cos(currentAngle) * 160 * dir)) {
                currentAngle -= Math.PI / 45 * dir;
            }
        }
        return currentAngle;
    }

    public class Wave {

        double speed;
        double mea;
        double time;
        int segment;
        int segment2;
        double dir;
        double move = 0;

        public Wave(double power, double angle, double distance, int segment) {
            time = distance / (speed = (20 - 3 * power));
            mea = 8 / speed;
            this.segment = segment + 1;
            dir = (int)Math.signum(m[segment + 1][segment2 = (int)Math.round(time / 91 * 5)]);
            if(dir == 0) {
                dir = Math.random() < 0.5 ? -1: 1;
            }
        }
    }
Dsekercioglu (talk)12:34, 12 June 2017

I'm not sure I follow your logic with this. Could you explain how the pieces are meant to work?

Also, there might be a bug with w.move += getVelocity();, since that is the velocity of the robot not the wave.

Skilgannon (talk)22:32, 19 July 2017

To predict where to move: robot sums the predictions of the waves weighted by time since fired. After if it is positive it moves ahead, if it is negative it moves back.

To learn: Every wave gets the total velocity of the robot while it moves, not deleted. If the wave hits, it gets the sign of the total velocity and add it to it's slices.

When a wave is fired it gets the value in it's slices and sets it's prediction to it.

Dsekercioglu (talk)08:05, 21 July 2017
 

Sorry if the weighted sum is positive, it moves back.

Dsekercioglu (talk)08:50, 21 July 2017