Talk:GuessFactor Targeting Tutorial

From Robowiki
Revision as of 04:08, 16 May 2009 by Voidious (talk | contribs) (found the bug)
Jump to navigation Jump to search
Credits - GuessFactor Targeting Tutorial
Old wiki page: GuessFactorTargeting/Tutorial
Original author(s): RoboWiki contributors

Beginner questions

Hi, I'm totally noob at Wave-based methods. I think I understand the idea, but to test the targeting I copied the code and added some simple movement to it. But the results are poor! The unsegmented version was something like a rolling average gun, but the segmented was just miserable. I know that this is just a sample code, but in this state it's just unusable. Here is the testbot: [1] --HUNRobar 17:18, 15 May 2009 (UTC)

Well I've never used that exact code so I can't really tell, but one thing I don't like about it's segmentation is that I feel the distance is too segmented for a 35 rounds battle. I believe the idea is only to show how segmentation can be done, not to use those exact values, I'd recommend dividing by 200 instead of 100 and see if it improves. But on the general note I'd recommend getting the grasp on the idea and then writing your own code, you probably will like to use some graphical debugging so you can check if your waves are getting aligned with your bullets and read carefully on how the game physics are. When and where the bullet does come out the bot after the setFireBullet is called, all that stuff makes a big difference. I'm not really sure if the bot in the tutorial is intended to work as is, but the explanation in the article combined with code gives a very good insight on how it works. That's only my opinion, I did learn a lot from the tutorial(although the segmented version wasn't there yet), just never used the code directly. And if you have specific questions I'll be happy to help you as much as I can. --zyx 21:58, 15 May 2009 (UTC)
Hey dude. Watching the bot fight, there's obviously some bug, and I found it: you're still using stats.length as the number of bins when aiming, but that's returning 13 instead of 31 after you add the distance segment. The tutorial should probably mention this in the part about adding segmentation. If you hardcode the "stats.length-1" parts as "30" instead (or use static final vars, however you wish), it starts working normally. (As it is now, a "best index" of 30 would be giving a GuessFactor of 18/12 = 1.5!)
Zyx makes a good point that 13 distance segments is probably way too much, too, and this is compounded by the fact that this version is only firing waves when it fires a real bullet (instead of every tick). GFTargetingBot might be a good next step for you to take a look at. Good luck! --Voidious 03:08, 16 May 2009 (UTC)