Author Topic: Some fancy aiming:  (Read 3571 times)

Offline googlyeyesultra

  • Bot Destroyer
  • ***
  • Posts: 109
    • View Profile
Some fancy aiming:
« on: August 17, 2007, 11:45:42 AM »
Ah, yes; I have returned. After a ridiculously tiring trip, I have an aiming question. I'm working on a crude multi-bot, and I need to know the exact velocity of a shot in grids per cycle. Essentially, I'm working on a wacky bot that will lead when it shoots, hopefully ending the era of bots that ram each other in order to feed.

Anyways, what is this magical constant or formula to determine shot velocity?

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Some fancy aiming:
« Reply #1 on: August 17, 2007, 12:48:06 PM »
Two cases:

Shots initiated by a bot.  The velocity/direction of such a shot is the vector sum of the firing bot's velocity at the time the shot was fired and a vector of length 40 in the direction the shot is fired +/-  a random value of up to 20 degees.  The value of 40 is legacy and stems from a day when bot radii were fixed.  There is some evidence in the code that the intent is to make larger bots have higher shot velocities but this has not been implemented...

Shots returned as a consequence of being hit by a shot.   These have exactly half the velocity (in the exact opposite direction with no random perturbance added) of the shot which caused them to be emitted.  They do however, last twice as long as bot-initiated shots...

This is for 2.43.  It's been played with over the versions.  What is there now is the result of trial and error, especially w.r.t. increasing the chances of released nrg shots impacting the attacker.

One relatively simple addition I have been planning to do someday is to allow for shot velocity and lifetime to be under the control of the firing bot with some nrg cost logarithmicaly scaled to higher velocities and longer ranges.  This would allow for sharks with laser beams if they were willing to pay the cost for high velocity shots...
« Last Edit: August 17, 2007, 12:49:57 PM by EricL »
Many beers....

Offline googlyeyesultra

  • Bot Destroyer
  • ***
  • Posts: 109
    • View Profile
Some fancy aiming:
« Reply #2 on: August 17, 2007, 01:07:13 PM »
First of all, I'd like to correct one of your statements. The returning shot has some portion of the hit bot's velocity added. That out of the way, does what you say essentially mean that if I have a bot that is fixed, it's shots will be fired at exactly 40 grids per cycle?

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Some fancy aiming:
« Reply #3 on: August 17, 2007, 01:22:23 PM »
Quote from: googlyeyesultra
First of all, I'd like to correct one of your statements. The returning shot has some portion of the hit bot's velocity added.
Sorry, right.  Meant to say that the returning shot's velocity is half the relative velocty of the impacting shot.  

Quote from: googlyeyesultra
That out of the way, does what you say essentially mean that if I have a bot that is fixed, it's shots will be fired at exactly 40 grids per cycle?
Yes.  The diretion will vary +/- 20 degrees.
Many beers....

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Some fancy aiming:
« Reply #4 on: August 17, 2007, 07:40:02 PM »
I find this interesting w.r.t your post on 'should shots have mass' Eric, IIRC, which I doubt I do, isn't mass weight X speed or something? Somewhere along the lines of a small object travelling at a high velocity can cause the same damage as a large object traveling at a slow speed...

I'm not sure how you could calculate costs for such but should shot speed be adjustable as well as shot weigh/nrg?
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Some fancy aiming:
« Reply #5 on: August 17, 2007, 08:55:26 PM »
Quote from: Jez
I find this interesting w.r.t your post on 'should shots have mass' Eric, IIRC, which I doubt I do, isn't mass weight X speed or something? Somewhere along the lines of a small object travelling at a high velocity can cause the same damage as a large object traveling at a slow speed...

I'm not sure how you could calculate costs for such but should shot speed be adjustable as well as shot weigh/nrg?

Force = Mass X Acceleration.

Since shots are fired or impact in a single cycle, the acceleration can be though of as the shot's velocity (or relative velocity) per cycle per cycle.  So yes, bottom line, faster shots carry more force, more kinetic energy.  So do more massive shots.  If we gave control of either or both to the firing bot, the amount of accleration (recoil) they expereinced as a result of firing the shot (or the target expereicned as a result of being impacted) would be a function of both.

Costs would be proportional to the mass and speed.  For existing shot types, I think I would make the mass implicit as a function of the payload amount (which means things like nrg shots would become less massive as they age) and the cost of firing the shot at the default speed would be the same as is today - the basic user defined per shot cost plus the cost of the payload.  There may be loopholes in this approach that require tweaking, but you get the idea.

What I would probably do is make the cost of firing a shot at increasingly higher velocities increase at some seriously exponential rate, perhaps 2^X.   Firing a shot at twice the defalut velocity costs four times the per shot cost.  Three times the default is 8 times the shot cost and so on.

You could only directly set the mass of a shot for the new shot type, say shots of type -8 by specifying the amount of shell/mass it should contain as payload.  Firing shots of this type, even at the default velocity should provide a decent enough recoil for propulsion.
Many beers....