[Home]AdvancingVelocity

Robo Home | Changes | Preferences | AllPages

The speed at which your opponent is moving toward you, perpendicular to LateralVelocity. If you stand still, RamFire usually has an AdvancingVelocity of 8 and MyFirstRobot will probably normally have an AdvancingVelocity of close to 0. A robot moving straight away from you would have an AdvancingVelocity of -8.

The formula for calculating this is:

	double advancingvelocity = -Math.cos(e.getHeadingRadians()-absbearing)*e.getVelocity();
absbearing is the absolute bearing to your target. If you take off the negative sign, I suppose it would be the retreating velocity. --Kawigi


Questions / Comments

I tried using the sign of the advancing velocity in CassiusClay version 1.9.6.10. But I think maybe I did that segmentation the wrong way. This is the relevant code:

	double approachVelocity = e.getVelocity() * -Math.cos(e.getHeadingRadians() - enemyBearing);
	wave.approachSignIndex = 1 + (approachVelocity == 0 ? 0 : PUtils.sign(approachVelocity));
-- PEZ

This is how I calculate advancing velocity, so assuming enemyBearing above is the abs bearing then it's exactly the same.

double advancingvelocity = -Math.cos(firedAt.getValue(firedAt.heading, stepsBack)-PulsarMax.robotStats.getAbsBearingTo(firedAt, stepsBack))*firedAt.getValue(firedAt.velocity, stepsBack);
Clearer:
double advancingvelocity = -Math.cos(enemyHeading-absBearingToEnemy)*enemyVelocity;
But most of all I think comparing that double to 0 is way to restrictive. Have some margin instead perhaps? This is coming from somone with 50 less score of course though...

-- Pulsar

Yes, I always forget about the danger in comparing doubles to 0. But in this case it might hold since it's a true zero value in the velocity reading I want to check for. I'll test with some debug outputting now. Thanks! -- PEZ

Yup. You are entirely right. I get very few hits in the middle bucket the above way. In fact I get exactly what I asked for when thinking zero velocity would be the mid bucket. That's not very good... -- PEZ


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited August 7, 2004 10:52 EST by PEZ (diff)
Search: