[Home]VirtualGuns/AsOf20060129

Robo Home | VirtualGuns | Changes | Preferences | AllPages

Sorry for just blindly moving all this. But it gets hard to see what is relevant after a while.... I'm trying to get more tidy VirtualGuns page. -- PEZ

From the VirtualGuns page ... From the RoboRumble/RankingChat page...

It should be noted that the fix also mysteriously hindered Jekyl's performance against the Flood bots, which Jekyl has been a significant problem for for some time, before he was in the top 10. I may finally be passing up DT as "the bot that requires buggy aim to be hit" (FloodHT 0.7 had a really funny targeting bug in one of its guns that ended up getting selected against SandboxDT when it kicked in). -- Kawigi

I guess that's a big advantage of VirtualGuns. Right now I have a huge bug in GD's gun though, it is definately not worth keeping there. =) -- PEZ

Yeah, VGs is the perfect solution. Have both the buggy gun and the fixed gun in the bot, and pick between them. That way you don't lose the illogical benifit, and you still get to improve against normal bots. -- Tango

Provided, of course, you have a working selection scheme. Which is not always trivial. At least not a fast learning one... -- PEZ

...and you usually seem to do worse than having one gun or the other... -- Kawigi

Yeah, I know you often say that. I will prove you wrong some day. =) -- PEZ

I'm confused; how did we suddenly break into a giant embedded bulletted list rather than just normal posting? :) Hope nobody minds if I break the trend... Anyway, about VirtualGuns, you guys are forgetting the fact that all the guns in a VirtualGuns array usually have very different learning times. For equal learning time guns, considering them on the large-scale, they can be an advantage, but against a single enemy, as jim pointed out they can never perform better than your best gun. They can't help you out against a single enemy, and they are basically useless to test against the top few dozen bots. However, with varied learning times, while your highly-segmented GF gun will be rarely accurate until it has enough data, your slightly segmented GF gun will be able to produce quick results that at first will be better than the high segmented gun. However across the course of the battle, using rolled statistics the highly segmented gun will quickly kick in as soon as it has enough data to consistently produce better results than the slightly segmented gun. This is what SandboxDT uses IIRC, and not a selection of equal learning time guns. This is part of what AutomatedSegmentation tries to do, but analytically rather than statistically. Anyway in the past couple of days I came up with a much better way to weight the reliability of the axis, but it's exam time now and I don't really have time for Robocode. I'll be back on it sometime later; just give me a few weeks :).

-- Vuen

The reason we went with bulleted lists is that the VG discussion was not the last topic on the page. This is a wiki, you can break any trend you like. =) I think you are pointing out the only real weakness with VG arrays. Learning time and descisions on when to start trusting this or that virtual statistic and when to reset the ratings and such. It is tricky. I don't agree that a VG array could never be better than your best gub against a particular opponent though. Consider opponents that uses different movement strategies in different segments (like Chameleon for instance). I think many bots do this by accident as well. -- PEZ

vote: are virtual guns worth it with the the option to use a single guess factor gun instead? --andrew

Name YesNoMaybe
David Alves X
Jamougha X
Kawigi X

Hope that helps. :-) --David Alves

But only because of all the new AM bots which are so hard to hit with GF guns. -- Jamougha

I think that no one has successfully used VG's in the purest sense in an optimal way, although I wouldn't rule out someone doing it. Although I think that VG's as an implementation is too undependable relative to one solid gun, except in the case of very special-purpose guns. As far as using multiple general purpose algorithms for targeting in the same bot, I think that the only way you'll ever have it work as good as or better than your best general-purpose gun is to have them cooperate - the guns can't be completely independent of each other if they are to perform better overall than either of them (something like having a husband and wife hold a contest to see who can conceive first without the help of the other). -- Kawigi

I'd be pretty mad if my wife won. :-P --David Alves

i bet your wife would be very confused if you won.--andrew

can someone help me with this virtual gun stuff. i have a seperate wave class for virtual gun waves. i fire a virtual gun wave whenever i fire a real bullet. when i make the wave, i make an array of doubles inside the wave object which holds the guessed angles. so when after the wave hits,i check to see if the hitting point was a guessed value,if it was, i update the stats accordingly for that gun. so:

 public class VGunWave extends Condition{
		double vDistance;	
		double bulletPower;
		double vBearing;
		double vBearingDirection;
		Point2D vGunLocation;
		double[] vGuns=new double[3];//this holds the angles chosen at the moment the wave was fired by the different guns
		
		public boolean test(){
			 if (( this.vDistance+= (20-3*this.bulletPower) ) > this.vGunLocation.distance(enemyLocation)){
				try{
			   if (vGuns[0]<absoluteBearing(this.vGunLocation,enemyLocation)+.5&&vGuns[0]>absoluteBearing(this.vGunLocation,enemyLocation)-.5)
					vGunStats[0]++;
				if (vGuns[1]<absoluteBearing(this.vGunLocation,enemyLocation)+.5&&vGuns[1]>absoluteBearing(this.vGunLocation,enemyLocation)-.5)
					vGunStats[1]++;
				if (vGuns[2]<absoluteBearing(this.vGunLocation,enemyLocation)+.5&&vGuns[2]>absoluteBearing(this.vGunLocation,enemyLocation)-.5)
					vGunStats[2]++;
				}catch(Exception e){out.println("*");}
				removeCustomEvent(this);
		    }
			return false;
		}
but it's not working.what ami doing wrong?--andrew

Are you using degrees or radians here? If degrees then .5 is probably too small, if radians then it's definitely too large. You could try using

 if(Math.abs(Utils.normalRelativeAngle(vGuns[1] - absoluteBearing(this.vGunLocation, enemyLocation))) < Math.atan(18/vGunLocation.distance(enemyLocation)) 

or something like it; Math.atan(18/enemyDistance) should be half the angular width of the opponent. Or you could just add the difference, or the square of the difference, between the predicted angle and the actual angle for faster learning. -- Jamougha

i don't understand what you mean by adding the difference. should this work:


		public boolean test(){
			 if (( this.vDistance+= (20-3*this.bulletPower) ) > this.vGunLocation.distance(enemyLocation)){
				try{
				double angle=Utils.normalRelativeAngle(absoluteBearing(this.vGunLocation,enemyLocation)-getGunHeadingRadians());
			   if (vGuns[0]<Math.atan(18/enemyDistance)+angle&&vGuns[0]>angle-Math.atan(18/enemyDistance))
					vGunStats[0]++;
				if (vGuns[1]<Math.atan(18/enemyDistance)+angle&&vGuns[1]>angle-Math.atan(18/enemyDistance))
					vGunStats[1]++;
				if (vGuns[2]<Math.atan(18/enemyDistance)+angle&&vGuns[2]>angle-Math.atan(18/enemyDistance))
					vGunStats[2]++;
				}catch(Exception e){out.println("*");}
				removeCustomEvent(this);
		    }
			return false;
		}
--andrew

Different subject, but does anyone check to see if an enemy bot dodges a bullet or not, so it can decide to fire VBs every turn at myfirstrobot and fire VBs only when fireing a real bullet at SandboxDT? I'm looking for example code for my bot.

Interesting question. I think it is very difficult to judge. The only way I can think of is what my grapher bots do. They keep different stats for "virtual" and "real" waves. Given enough data one could see if there is much difference between the two sets. But it takes a lot of data. Maybe if you do this in an otherwise unsegmented buffer for it... -- PEZ


A Question on the speed of VirtualGuns, I have been trying to get my VirtualGuns to process fast but they just make my bot skip way to many turns. Is there any tricks to make my VirtualGuns go faster? -- KID

What types of guns are in your VG array? Also, how are you storing them? Having a bunch of complex guns or storing them inefficiently seem to be the most likely reasons that would cause your VGs to slow down. A bit more info on your implementation would be useful for troubleshooting. --wcsv

Also, choosing 'the gun to fire' only 2 or 3 ticks before you fire and only calculating the angle to shoot those last few ticks can help. The rest of the time you can leave your gun in HOT- or LT-position. -- GrubbmGait

One problem I have always seen with VirtualGuns is how do you accurately select the proper gun to use against a specific target? Try this: do a TCChallenge with your VG array but store hit percentages with all your guns. When the Challenge is over, find the best gun and do the TCChallenge again but always selecting this gun and see if the results vary. I have always contended that a VirtualGun? array was never going to be any better than your best gun. The very fact that you cannot accurately select your guns 1005 of the time would degrade the performance of this gun even. The best VG system in the game was in SandBoxDT?. Paul never gave alot of clues about it, but from the words he used to describe it, one could gather that it would more and more finely segment your movement history, but it was always a GuessFactor gun (with some exceptions and I think only at very close ranges where HOT or LinearTargeting was almost garunteed to hit). The nice thing about this was you could use coarse segmentation early in an engagement to speed learning and as the match progressed get more and more refined. No one ever figured it out. Best gun in the game right now is the one in Shadow and it is not a VG or even a GuessFactor gun. Emulate that and you will have done something. It also has the benefit of being deadly to WaveSurfers. -- jim

For each of my guns I find every possible shot within 50 ticks-to-impact and compare the expected time to target against the historical hit percentage at that range, and keep the best 'firing solution'. Then I compare all of the gun's optimal firing solutions's and hit percentages, and use the best one among them. That means from shot to shot I may be using a different gun because I am closer or farther. I store these hit percentages for each range of each gun against each target. It's a lot of buckets. I generally have about a 3% skipped turn rate, which is not terribly alarming. -- Martin Alan Pedersen

Well to explain the situation that I’m in, first I’ll give the rundown on the class that came into play:

	EnemyData? - has all the data for a given enemy.
	VirtualGun? - one per robot and then per targeting type.
	VirtualBullet? - the bullets that I fire from my VirtualGuns.
	Targeting - the interface that all my targeting class implement.

So, in each of my EnemyData? class, I have an array of VirtaulGuns?. For the constucter for a VirtualGun?, I pass it my robot (AdvancedRobot), an enemy robot (EnemyData?), and a targeting type (Targeting). I also create a bullet watcher condition class inside of the VirtualGun? class that runs through my ArrayList of VirtualBullets. So then every turn I call the “update” method by give it the fire power of the bullet I want to fire. Then I add that VirtualBullet? that I created in the “update” method to the ArrayList, and when my BulletWatcher? class sees that a bullet as hit or missed, it removes the VirtualBullet? from the list and ups the FIRED int, and maybe the HIT int. So then to find the best VirtualGun? for a give enemy (EnemyData?), I run through its array of VirtualGuns, and find the one with the best hit rate. (I can send anyone the src for my bos if you want, just send me an e-mail)

So as you can read, that’s a lot processing time for each bot on the field. That makes my bot skip a lot of turns (it was up to 60% one time for four enemys with four guns each). ANY help would be nice to have. -- KID

In addition to Grubb's comment about only aiming before you're about to fire, I'd say you might try only shooting a virtual bullet when you're *actually* firing, instead of every turn. It will greatly decrease the amount of virtual bullets you're firing, as well as increase accuracy against bots that detect when you fire as a sign that they should dodge. Another general thought would be that you could increase the amount of guns as the number of enemy tanks decreases - like just use general targeting methods (eg, into a cluster of enemies) when the field is full of bots, and enable more advanced, individual VirtualGuns when you're down to 3 or less enemies. -- Voidious

Well, I have about 8 guns calculating every possible shot within 50 ticks every round, and I track stats for 'virtual' bullets as well as virtual bullets fired in the same round as an actual shot. I'm only calculating a firing solution for one enemy in any given round, so duels vs. melee doesn't affect processing time. I'll estimate 20 possible shots per round per each of 8 guns comes to 160 virtual bullets generated and tracked every round. And it works with 3% skip rate. I'm invested a lot of time into my design, and evidently it has paid off. I remove each virtual bullet once its distance travelled has exceeded the distance from its origin to the target's present location. -- Martin Alan Pedersen

With all of these systems, can you garuntee you will choose perfectly? I was never able to accomplish it and in practice I found that my best gun was the one thats in Jekyl. I refined it in BlackPearl and solidified it in DarkHallow. It performs well in the TC but seems more susceptible to WaveSurfers that I would have liked. When I ran emperical tests with Jekly?'s original VirtualGun? system against a simple bot like SpinBot, I could not accurately choose the PM gun. I also tested a VG system against the target bot from the PatternMatchChallenge?. Despite scoring almost perfectly with the PM gun, I could not re-liable pick and used the PM gun with a VG system. This is why I ask: Can you choose 100% accurately and are you sure you are not degrading your performance? -- jim

Well, no and no. Fortunately I don't need 100% accuracy and performance only has to be 'good enough'. If you pit Ugluk against SnippetBot or pulsar.Nanis? you will see Ugluk's guns will lock on to the movement behavior and nail them. Ugluk's stats against them tell the tale. Against Spinbot or Walls, or any other bot that has a really pronounced movement tendency, Ugluk is going to become aware of it quickly and lethally. That only goes for linear, circular, and tangental oscillation, which are all independently handled guns. (I just added a pattern matcher but it is really raw and not a preferred gun.) If you have a pattern matcher that outperforms all of the simpler guns, by all means use it. I do not.

There is also the work experience / employment catch-22 with guess-factor guns. Until you start taking real shots you don't have data for your guess factor guns to use. So.. you can use some default like aiming at 0 degrees or you can prime your guess factor gun with results triggered by your simpler guns / pattern matcher. -- Martin Alan Pedersen


Robo Home | VirtualGuns | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited January 30, 2006 10:41 EST by PEZ (diff)
Search: