# LaserTargeting

Robo Home | Changes | Preferences | AllPages

The name or this method of Targeting is based on the idea that you point a laser sight at the enemy. To hit with the bullet you need to adjust the sight for the enemy's expected movement.

It is very similar to using VirtualBullets but less memory-consuming. Basically, you store where you are and where the enemy is at a certain time, then you mark a desired time in the future for an observation of the enemy, usually the time it would take for a bullet to reach the enemy. What you get is an observation of the enemy's actual change in position relative to the straight aim.

Usually I have used this in a way similar to GuessFactorTargeting, select one of the observations at random and interpolate/extrapolate it to get a guess factor. Random selection among the observations should be as good as using the "most usual" observation and in addition, it solves the problem of what to do when several observations are equally usual. See also RandomTargeting.

LaserTargeting evolved from keeping a log of everything every turn and is well-suited to melee combat because you do not need to scan the enemy every turn.

Bots I built with LaserTargeting include Neptune, Pluto and the MiniBot CherryBlossom.

In a way, LaserTargeting was partly responsible for starting off the [MiniBot Challenge]? because I realized that the ugly code I originally wrote for Neptune could be written much more compactly and beautifully.

--tobe

How would you randomly select among the most usual obesrvations? I've been struggling with that for quite a while now and I can't think up an algorithm apart from just selectin one of the, say, three most common observations. But I would want it to work more like Random.nextGaussian(). Not a normal distribution of course but a distribution based on the size of each observation segment. -- PEZ

A way to select a random point based on the observed distribution is to create a kind of histogram, count the total number of observations, select a random number in the range and advance trought the histogram till you reach it. Another way is to put then in an array and select just one (because the most common repeat more frequently, the selection would be OK). -- Albert

Ah, yes, if you keep the histogram at a reasonable resolution that would work well. I will try that. -- PEZ

BTW. Marshmallow uses LaserTargeting for its statistical gun (though it's called "sector aim" in the code). The difference is that it checks every tick after a bullet is fired if it has either hit (see Marshmallow/CodeSnippets for that code) or missed and only then checks the "laser beams". This makes it more accurate since few enemy bots allow you to estimate a very accurate BulletTravelTime. -- PEZ

Good idea. I guess you could also easily convert it to get a Wave-like system. -- tobe

Well, I think it is very like Wave (as far as I have understood that concept). -- PEZ

What's the difference between this and pattern matching? :-/ -- Tango

Do you mean the difference between PatternMatching and LaserTargeting? If so the difference lies in that

• PatternMatching looks for a movement pattern in the past that looks like the most recent one and from there it replays the movement of the bot to figure out its destination.
• While LaserTargeting simply records how many times each lateral angle sector is used and then uses this information to aim (fireing at often used sectors more often than others). Marshmallow divides the angle space between -40 and +40 degrees into 11 sectors.
Another way to look at the difference is that LaserTargeting makes an advanced bot as TheArtOfWar an easy target since it's ShrapnelDodging system very often brings it to the sectors around -16 and +16 degrees from its original location. While PatternMatching (at least Marshmallows simple implementation) doesn't work very well since the same dodging system creates a too wide spectre of movement patterns. -- PEZ

Ok, it seems i misread something somewhere... :-/ -- Tango

Well, [[?iley]] seems to be able to combine these two systems so the question is very relevant. -- PEZ

FloodHT (my work in progress) is currently attempting to use this for pattern analysis as well, which is a good idea, assuming your opponent is moving primarily relative to you (i.e. - excellent against my CircleBot, not as useful against SpinBot) -- Kawigi

Ok, I havent really understood the basis of this, it seems to be a combination of GuessFactorTargeting and some angular stuff. Is this just one of the descriptions of the early GF, or is it more? -- Jokester

Or is it less? I think it would be better to describe it as a stepping-stone to waves, but the idea of what should be done with them is distinct from GuessFactorTargeting. -- Kawigi

Is it? I would say Marshmallow had the exact same idea as GuessFactorTargeting about what to do with them. It's definately less that GF targeting though. Technically both LaserTargeting and GF targeting could be implemented using Waves, VirtualBullets, a simple estimate of BulletTravelTime or some other thing.(Marshmallow used waves, that's clear to me now). Conceptually LaserTargeting is GF targeting without the brilliant insight that you should regard the relative (to current situation) angular/lateral movement of your enemy rather than the raw angle difference. This

1. doubles (and then some, see point 3 below) the amount of data you need
2. doubles the learning time
3. and if you don't segment on lateral direction you get a significant decrease in accuracy (GF targeting doesn't need segmenting on lateral direction)
Or using alternative wording; Using LaserTargeting over GuessFactorTargeting is stupid if you understand both concepts.

-- PEZ

Robo Home | Changes | Preferences | AllPages