Difference between revisions of "Talk:Gilgalad"

From Robowiki
Jump to navigation Jump to search
(Question about robocode physics)
(reply - matching the right wave)
 
(3 intermediate revisions by 3 users not shown)
Line 6: Line 6:
  
 
So, I have been re-writing my movement over the past months and I have a question about the robocode physics.  When finding the correct wave to log a hit as in onHitByBullet I could use:
 
So, I have been re-writing my movement over the past months and I have a question about the robocode physics.  When finding the correct wave to log a hit as in onHitByBullet I could use:
<code><syntaxhighlight>(time - wave.getStartTime()) * wave.getBulletVelocity()</syntaxhighlight></code>  However onBulletHitBullet would need: <code><syntaxhighlight>(time - wave.getStartTime() - 1) * wave.getBulletVelocity()</syntaxhighlight></code>  Does anyone know why this is the case? (My guess is that the onBulletHitBullet event is called on the turn after bullets hit while the onHitByBullet event is from the current turn but I would like to be certain.)
+
<code><syntaxhighlight>(time - wave.getStartTime()) * wave.getBulletVelocity()</syntaxhighlight></code>  However onBulletHitBullet would need: <code><syntaxhighlight>(time - wave.getStartTime() - 1) * wave.getBulletVelocity()</syntaxhighlight></code>  Does anyone know why this is the case? (My guess is that the onBulletHitBullet event is called on the turn after bullets hit while the onHitByBullet event is from the current turn but I would like to be certain.) --[[User:AW|AW]]
 +
 
 +
: Actually in my experience it varies far more then this, much to my annoyance. For a bullet bullet collision it is usually -1 or -2 offset and even that distance may be up to 11.5 off (regardless of bullet speed). The normal collision is usually same for normal collision as well. I have been looking for a more elegant way of handling these, but so far nothing has really presented itself. &#8212; <span style="font-family: monospace">[[User:Chase-san|Chase]]-[[User_talk:Chase-san|san]]</span> 19:55, 17 November 2011 (UTC)
 +
:::The method I showed above seems to work 100% of the time.  Are you using getHitBullet() or getBullet()?
 +
:: When I try to match bullets to waves, I find the closest wave, and then consider it a match so long as (closestWaveDist <= bullet.getVelocity()*2 + 0.1).  Pretty sloppy tolerance there, but I get by with it. -- [[User:Skotty|Skotty]] 00:14, 20 November 2011 (UTC)
 +
 
 +
:So I looked in the sources (BulletPeer.java) and it appears that for some reason bulletHitBullet events report the bullet locations from the previous turn.  Weird, but now I know that my method should work.  (If no other wave surfers handle this the way I do, that should probably be changed.  Any thoughts?)
 +
 
 +
: Well, if it's a bug, I agree it should be fixed. But if you match on the nearest wave that has a matching bullet power, you should be fine - you're guaranteed to get the right wave and the angle you record won't be any different. I also restrict my matches to waves within distance 50, as a sanity check - though I now realize that two power 3 waves could be distance 48 apart if the enemy is also moving full speed directly at my position when the wave intercepts, so I should decrease that. Hopefully if you're firing power 3 and moving directly at me, I'm sufficiently accurately blowing the crap out of you that this isn't a huge issue. ;) --[[User:Voidious|Voidious]] 03:20, 20 November 2011 (UTC)

Latest revision as of 04:20, 20 November 2011

So, I added Gilgalad to the 1v1 participants list on Thursday, but it still isn't listed in the rumble, does anyone know if I did something wrong?--AW 20:12, 5 August 2011 (UTC)

Just fixed it for you. You put "aw.Gilgalad" on the participants page when your java class is actually "aw.Gilgalad.Gilgalad". --Rednaxela 00:19, 6 August 2011 (UTC)

Thank you, I will have to change that in the next version. --AW 18:08, 6 August 2011 (UTC)

So, I have been re-writing my movement over the past months and I have a question about the robocode physics. When finding the correct wave to log a hit as in onHitByBullet I could use:

(time - wave.getStartTime()) * wave.getBulletVelocity()

However onBulletHitBullet would need:

(time - wave.getStartTime() - 1) * wave.getBulletVelocity()

Does anyone know why this is the case? (My guess is that the onBulletHitBullet event is called on the turn after bullets hit while the onHitByBullet event is from the current turn but I would like to be certain.) --AW

Actually in my experience it varies far more then this, much to my annoyance. For a bullet bullet collision it is usually -1 or -2 offset and even that distance may be up to 11.5 off (regardless of bullet speed). The normal collision is usually same for normal collision as well. I have been looking for a more elegant way of handling these, but so far nothing has really presented itself. — Chase-san 19:55, 17 November 2011 (UTC)
The method I showed above seems to work 100% of the time. Are you using getHitBullet() or getBullet()?
When I try to match bullets to waves, I find the closest wave, and then consider it a match so long as (closestWaveDist <= bullet.getVelocity()*2 + 0.1). Pretty sloppy tolerance there, but I get by with it. -- Skotty 00:14, 20 November 2011 (UTC)
So I looked in the sources (BulletPeer.java) and it appears that for some reason bulletHitBullet events report the bullet locations from the previous turn. Weird, but now I know that my method should work. (If no other wave surfers handle this the way I do, that should probably be changed. Any thoughts?)
Well, if it's a bug, I agree it should be fixed. But if you match on the nearest wave that has a matching bullet power, you should be fine - you're guaranteed to get the right wave and the angle you record won't be any different. I also restrict my matches to waves within distance 50, as a sanity check - though I now realize that two power 3 waves could be distance 48 apart if the enemy is also moving full speed directly at my position when the wave intercepts, so I should decrease that. Hopefully if you're firing power 3 and moving directly at me, I'm sufficiently accurately blowing the crap out of you that this isn't a huge issue. ;) --Voidious 03:20, 20 November 2011 (UTC)