View source for Talk:ExclusionNano

From Robowiki
Jump to navigation Jump to search

Contents

Thread titleRepliesLast modified
A Few Suggestions301:45, 29 April 2013

A Few Suggestions

I was looking through the code of version 1.2, and I noticed some things you might want to fix in the next version. Here they are:

  • I don't think the code in onBulletHit is doing what you think it's doing.
  • The while loop in the radar code is unnecessary. Also, Double.POSITIVE_INFINITY is a byte cheaper than 1 / 0.
  • Infinity Radar is sloppy enough even with setAdjustRadarForGunTurn. If I were you, I would get rid of that and replace it with setAdjustGunForRobotTurn.
  • Finally, you can assign a new value to d0 inline in your aiming code to save a byte.
Sheldor02:15, 28 April 2013

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:Talk:ExclusionNano/A Few Suggestions/reply.

Take a look at Sabreur's code, it should have the solution to both problems.

Basically, in the onBulletHit event, you want to adjust the enemy energy to account for the damage from the bullet that just hit, so it doesn't register a false Energy Drop. When you use a (mostly) constant bullet power, like Sabreur does, you can pre-calculate and hardcode the bullet damage to save a lot of Codesize. However, if your bullet power is highly variable, you need to adjust by Rules.getBulletDamage(e.getBullet().getPower()).

Sheldor16:14, 28 April 2013
 

BulletHitEvent.getEnergy() gets the enemy energy AFTER the bullet hits and its energy drops. So I shouldn't need to adjust by the bullet power. Sure I might miss a bullet fire, but at the time I was low on codesize.

But after all the reductions I can actually fit that in.

Chase01:45, 29 April 2013