SegmentedData/Segments

From Robowiki
Jump to navigation Jump to search

I would like to use this page to discuss potential segments for use in targeting. If you have the time and inclination to share how about letting us know what types of segmentation you use. I have started the list below. I am sure there are others and I am sure that some of my explanations below are sketchy or flat out wrong but it's a start =^> Also the formatting on this page is horrible. Could a WikiMaster fix this? -- jim


  • GuessFactor: Guess factor is a form of KentuckyWindage used to tune your gun. In it's crudest sense, it is a measure of the difference from where you aimed to where you should have aimed to actually hit. This is accomplished in many different ways, the most common of which are Waves and VirtualBullets. There are other methods for doing this.
  • Distance: Simple range to the target at shot time. Almost always divided by some constant to limit the amount of segments used. For instance:
 Math.min(10, (int)(e.getDistance() / 100))

That would results in segments from 0 - 10, with all data above 1000 pixels aggregating into the 10 bin.

  • Bullet Flight Time: Sort of a variation on distance segments. The idea here is to divide the distance by the bullet velocity to get a number of ticks until impact. As this is usually a large number, the tick count is often divided by 5 or 10 to get a reasonable number of segments. For instance:
 Math.min(10, (int)((e.getDistance() / (20 - 3 * shotPower)) / 10)

This would result in 11 bins of 10 ticks each. Each bin would cover from 80 to 197 pixels depending on shot power.

  • Target Velocity: Simply segmenting on a targets velocity. If used in a raw form, it results in 9 segments. Some folks chose to aggregate some of the possible velocities to reduce the numer of segments. For instance:
velIndex=(int)e.getVelocity();
  • Target Lateral Velocity: A variation of segmenting on straight velocity. This method accounts for a target not moving truly perpindicular to your position. See the LateralVelocity page for a method to calculate a targets lateral velocity. For Instance:
latVelIndex=(int)(lateralVelocity / 3);

This results in 3 latVelIndicies. This is also an example of aggregation. Here the lateral velocities 0 - 2 are placed in the first (zero) index, 3 - 5 are placed in the second (one) index, and 6 - 8 are stored in the third (two) index.

  • Change in Target Heading: According to Andrew's posting in the RobocodeRepository, this is a segment that he added to FloodMini's gun in the creation of Neo. This is often used in PatternMatching as well.
  • Bullet Power: David Alves once mentioned that he did this with a gun he used in the TargetingChallenge (stupid rules =^>).
if(enemyVelocity==0) moveTimes=0;  else  moveTimes++;
moveTimesIndex=moveTimes/5;
    • Ok, so this segment slightly puzzles me. The code snippet above given a theoretically infinite index. I tried segmenting by movetime divided by the projected bullet travel time, but that sucks so i'm looking for further inspiration... --Brainfade
        • The idea here is to try and determine the number of ticks since your enemies velocity last equalled zero. In theory this might help you determine stop and go bots (Cigaret style movement) or see if there is some periodicity to an enemies reverse time. The snippet that I provided above can give an infinitely large result, in the case of a bot that never reverses. You could use
          moveTimesIndex = Math.min(9, moveTimes/5)
          to get a range from 0 - 9 inclusive to limit that. You could also use a larger divisor to potentially reduce possible answers. You will have to play with a bit as I have found in practice that this does not seem to help any of my efforts. I have heard that others are having some success using this as a segment. -- jim
          • Isn't this one of AdNeo's segments?
            • I don't believe so, most of his segments come from FloodMini conceptually, except for LateralVelocity, which he changed to something else. -- Kawigi

PEZ sometimes uses one or more of these (along with several of the ones mentioned above).

  • Lateral acceleration: This is one of the most discriminating segmentations I've tested and is used by all my bots except Verti and Hypo.
    • Care to expand on this one PEZ?
    • Lateral Velocity is described further up, Lateral acceleration will just be change in lateral velocity, won't it? -- Tango
      • Indeed, that's by definition. Though lateral acceleration is more discriminating in my experience. Since the enemy is always either accelerating, deccelerating or constant in the lateral dimension it only multiplies your segmentation by 3 and yet tells you a lot. Here's a function that works pretty well:
            int accelSegment(double deltaBearing, double oldDeltaBearing) {
       int delta = (int)(Math.round(5 * enemyDistance * (Math.abs(deltaBearing) - Math.abs(oldDeltaBearing))));
       if (delta < 0) {
           return 0;
       }
       else if (delta > 0) {
           return 2;
       }
       return 1;

} Keep in mind that "lateralVelocity == deltaBearing". RoboGrapher can show you just how discrimination this segmentation is against particular bots. -- PEZ.

    • Actual absolute acceleration is also good, although I haven't done any real testing to decide which is better. I could see how lateral acceleration could tell a little more about some bots (like, say, SpinBot), but not a lot of them that I'm worried about. -- Kawigi
      • I think it might be pretty equivalent. Though I seldom care about the veocity of the enemy so I don't have that data around to calculate the acceleration. -- PEZ
  • Distance from center: Can capture near wall and in-corner behaviour, especially in combination with other segmentations.
  • AdvancingVelocity: Well, Mako uses it but I don't think it really works very well against most enemies.
  • Wave Type: Is this a Wave following a real bullet or not? Some bots show _very_ different profiles here. -- PEZ


JohnDoe added:

  • The number of enemies on the battlefield
  • The distance the enemy is from the center, or how far they would have to move in a straight line to hit the wall
    • I think this might be the same as "Distance from center" =) -- PEZ

Here's a couple of segments I have on the drawing board for Fractal:

  • The enemy's distance until offscreen
    • In other words, the length of the line segment extended from the enemy's current heading (normalized by the enemy's velocity) through the bounds of the battlefield
    • It seems we have some sort of consensus that this measure might be a good segmentation dimension. =) -- PEZ
  • The enemy's AdvancingVelocity
    • I think this was mentioned above, but it could be used by movement against bots that do DynamicDistancing; if one type of bin provides more of a spike, your bot could move more aggressively/passively to get a reaction out of the enemy and force the enemy's AdvancingVelocity into the bin you want (possibly powerful against bots such as VertiLeach who are strongly DynamicDistancing)
    • This could certainly be strong against VertiLeach. Though it is not using DynamicDistancing. Quite the opposite actually. But if you mean it is trying to control its distance, that entirely the case. But that's not what DynamicDistancing is about. (DD is about figuring out at what distances your bot might be stronger than the enemy bot.) -- PEZ
    • Right. So um... 'bots that control their distance' then. :) Is there a wiki page about this? -- Vuen
  • The magnitude of the antigravity vector acting on an enemy (in Melee)
    • This means calculating the antigravity for the enemy rather than for self, and segmenting on this; I had been planning something similar in another of my bots a while back, but never got around to it
  • The number of teammates an enemy has remaining (in Teams)
    • Could be very useful; droids can die when there are no radars left, and certain teams may modify their movement strategies based on this (DrunkenTeam comes to mind)

-- Vuen


Starrynte sometimes segments on:

  • 1v1
    • Lateral Velocity - kind of combining segmentation of heading and enemy velocity
    • Distance - probably (haven't tested) good against rambots, antigravity
    • Abs(abs(<where pm gun tells you to shoot, slight modification of NanoLauLectrik's in this case>) - abs(absbearing)) - somehow bringing PM into consideration - don't know if this one works that well yet
  • No melee gun needing segmentation *yet*...