Author Topic: Cost for turning  (Read 10193 times)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Cost for turning
« on: October 04, 2005, 06:03:15 PM »
Say you're a bot.  Right now, you can spin and spin in any direction in any amount for free.  This isn't quite realistic.  A better system could be formed.

Currently the system works like: Assume the bot is in a vacuum.  What mechanism does it use to turn?  well, the best answer is probably small compressed air cannons placed 90 degrees to either side of the bot.  These fire in tandem such that a net torque is produced. This torque starts the bot spinning.  These same cannons stop the bot at a designated angle.  This all happens betwen cycles.

Thus, bots have zero rotational velocity at any given cycle.

Question:

Do we want to keep it so that bots have zero rotational velocity during each cycle?  If we don't, then bots keep spinning after they 5 .aimdx store indefinately at some rotational speed.  This speed would slow down if they gain mass.  If we do, then a bot that is constantly spinning will be charged a much larger value of energy than need be for the starting/stopping.

There are pros and cons here.  Old bots would be broken if we have rotational momentum hold over between cycles.  .aimdx and .aimsx might need to be rewritten entirely to be the amount of energy you want to spend to spin instead of the amount of spin you want...

However, we would get to use some new physics things, and sneaking up on a bot from behind becomes a useful strategy, implying more stratagy in the hunt.

I'll write two different proposals for each method, so we can all see how they differ.

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Cost for turning
« Reply #1 on: October 04, 2005, 11:11:56 PM »
I like the new system, it is better for evolution sims.  But all you guys designing bots will have a difficult time...  
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Cost for turning
« Reply #2 on: October 05, 2005, 12:29:00 AM »
I am increasingly wanting to pull the program in one direction, while the older bots try and stop me.  Trying to make the changes backwards compatible is quite a challenge.

I would favor changing turning to be applying energy to cause your bot to turn.  I'd love to have everything in the simulation using the new physics stuff.  While it's different from the old version, it makes adding new physics things quite natural and easy.

On the other hand, it usually involves me spending several hours re-learning my calc based physics stuff.

Are there any Newtonian Physicists in the house?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Cost for turning
« Reply #3 on: October 05, 2005, 09:28:35 AM »
This is what I've come up with:

The cost to turn a bot is:

4/5 *mass * radius * pi^3 * abs(delta aim) / 1256

where delta aim is aimdx - aimsx.

That gives rather large values for turning however.  I'll double check my work later tonight.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Cost for turning
« Reply #4 on: October 05, 2005, 09:30:06 AM »
[ABE] Message posted before the last one by Nums.
A more backward compatible method will be to assume that rotations include a rotational acceleration and a rotational deceleration at the correct point. This rotation can be charged for proportional to the bot's mass.

I like this system as it maintains the present system for doing stuff like precise angled MB construction.

However I also like the idea of using rotational momentum as that would allow a bot to continue rotating forever at a very small initial cost.

How about we use BOTH systems?

Keep the old way but add a small mass-anglechange-proportional charge for rotations.

Add new rotation commands that just add rotational acceleration without stopping at the other end. Cheaper to start rotating than .aimsx but less precise control as to the end point. This will work just like .up and .dn in that it applies a known amount of force which will be translated into motion by the program based on the mass of the robot.

Should be pretty easy to implement.
« Last Edit: October 05, 2005, 09:31:31 AM by PurpleYouko »
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Cost for turning
« Reply #5 on: October 05, 2005, 09:34:55 AM »
Quote
That gives rather large values for turning however. I'll double check my work later tonight.
Sounds kind of expensive. We should aim a pretty low costs for rotation. Something like 1 point of energy for 1 full rotation (1256) of a bot with mass 1 and diameter 100

Fat bots will obviously cost a lot more, as will large bots.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Cost for turning
« Reply #6 on: October 05, 2005, 09:43:51 AM »
The above assumes a bot accelerates then decelerates between each cycle.

I got it from constructing a function for theta with resepect to time.  THen differentiating it.  Then again, to get alpha.  Then using Force(t) * radius = I * alpha(t).

Force(t) = moment of inertia of a sphere / r * alpha(t).

abs(Force) = I / r abs(alpha(t)

Then I integrated abs(Force) over 0 to 1.

Point is I think that's an accurate physics function, assuming that bots turn using the same efficiency with which they move around, and that their little engines are strapped to either side of the bot for maximal torque.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Cost for turning
« Reply #7 on: October 05, 2005, 09:49:41 AM »
I don't disagree with your formula. It looks pretty accurate from a cursory glance.

All I am suggesting is to apply some kind of scale factor constant to keep total costs managable.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Cost for turning
« Reply #8 on: October 05, 2005, 03:41:56 PM »
Okay, here's a better system with easier math that I'm sure works:

Each bot gets a new variable which is it's angular velocity.  It holds over between cycles, however, the .aimdx, .aimsx commands still work relative to no turning.

So a bot that wants to spin at a constant speed would do 5 .aimdx store every turn still.

Each bot is charged:

.002 * mass * radius * abs(new desired angular velocity - old angular velocity)

and new angle = old angle + new desired angular velocity)  (That's a Euler approximation for you numerical analysis types).

nrg for the turn.  I can show the work process I used to get this if you like, or not.  Rest assured, it's an accurate mathematical model.

Now, say you aren't moving at all.  Then you do 5 .aimdx store, then do nothing.  What are you charged and when?

Well, the first turn you're charged .002 * mass * radius * (5-0) = .6 nrg for a normal bot.

Second turn, you're charged .002 * mass * radius * abs0-5) = .6 nrg for a normal bot.

So constantly spinning becomes a very good strategy still for when there's nothing to eat, since you're only charged for starting the spin and ending it.  But turning constantly and drastically in combat uses alot of nrg.  Trying to turn 90 degrees would cost nearly 38 nrg, and then another 38 nrg if you stop turning the turn after.

I think I'll also add a new component to a shot's vector that comes from the bot turning.  If you're spinning really fast, the bullet is going to veer off from what you'd expect it to do if you weren't spinning.  Like a sling.
« Last Edit: October 05, 2005, 03:47:30 PM by Numsgil »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Cost for turning
« Reply #9 on: October 05, 2005, 03:58:19 PM »
Quote
Trying to turn 90 degrees would cost nearly 38 nrg, and then another 38 nrg if you stop turning the turn after.

That is horribly high  :(

Charging this much to rotate a bot is going to make building a Multi-bot prohibitively expensive since each segment of a 6 part bot will have to make several turns that will total at least 720 degrees.
That is the only way I could make Hexagonis build his MB body and he isn't even cross tied. Adding that would make at least another 360 degrees.

720 degrees times 6 robots makes a total cost of 1824 energy just to form its structure.

If we implement this cost regime then we can pretty much say goodbye to large MBs altogether.

If you multiply the whole system by a factor of 0.01 (or possibly even 0.1) then it might be affordable otherwise the costs are just going to destroy any chance of MBs evolving or even being designable.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Cost for turning
« Reply #10 on: October 05, 2005, 04:46:40 PM »
But that cost is trying to do the whole turn in a single cycle.  If you take, say, 5 cycles to  turn, then the cost becomes: 7.5 nrg to start the spin, another 7.5 to stop.

If you take 10 cycles, then it becomes 3.8 to start and 3.8 to stop.

That's all for bots of 1000 body.  Smaller bots can turn much easier.  Huge behomoths are more difficult.

We've been letting bots spin for free, which isn't realistic.  If we charge, and implement it correctly, we can incorporate it into the rest of the physics engine.  Maybe have off center collisions produce spin.  Things like that.

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Cost for turning
« Reply #11 on: October 05, 2005, 04:53:58 PM »
Quote
I think I'll also add a new component to a shot's vector that comes from the bot turning. If you're spinning really fast, the bullet is going to veer off from what you'd expect it to do if you weren't spinning. Like a sling.

Will it also fly away faster?  :)  or farther :)
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Cost for turning
« Reply #12 on: October 05, 2005, 04:56:54 PM »
Faster, yes, if done right.  And hence farther too.  The hard part would be in aiming it correctly.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Cost for turning
« Reply #13 on: October 05, 2005, 05:06:13 PM »
How about we keep the bots turning the same way. But charge them more for doing bigger turns proportional to the mess and everything. We can even trow in deselaration only the bot has to calculate its turn with the deselaration in mind. I basicaly want to save up on pointless dna in the bots.

MB = Easy

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Cost for turning
« Reply #14 on: October 05, 2005, 05:09:39 PM »
That's more or less what I'm suggesting.

The apparent behavior from the bots would be unchanged.  Bots would operate exactly like before.  Only the costs would be different.  And the angular velocity would effect some interesting physics things.  Otherwise identical.

Quote
MB = Easy

how so?