Author Topic: Movement  (Read 5109 times)

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Movement
« on: April 06, 2005, 11:40:24 AM »
Can someone tell me how the movement is calculated for bots?  I know that .up and .down provide acceleration, but how do "movement factor" and "friction" are applied?  How are the values on "options" panel relate to the speed?

I assume that "gravity" and "brownian motion" simply adjust the position of a bot, without actually affecting it's speed, but I also would like to get some idea on how the values in "options" relate to the actual bot movement.

Thanks.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Movement
« Reply #1 on: April 06, 2005, 01:20:39 PM »
Actually your assumption is wrong

Gravity and brownian motion both apply an acceleration to the robot, as does bouyancy in pond mode. Friction simply reduces the present velocity by a factor.

.up, .dn, .sx and .dx all apply an acceleration in the specified direction. This acceleration is split up (by the program) into x and y vector acceleration such that the net effect is to accelerate the bot relative to the direction it is facing.

In the program loop, all accelerations from all sources are added together then if they exceed 100 (magnitude) in either x or y direction they are capped at 100.

Next, these accelerations are applied to the robots (added to the present velocity) in directional vectors (the direction the robot is facing) and compared with the robot's current maximum velocity (calculated by its size and mass and available to the DNA via *.maxvel). If the new velocity is greater than *.maxvel then it is capped at that value.
maximum velocity is unrelated to anything in the options panel

Next the robots are actually moved.


Swimming factor is only designed to allow MBs to swim by girating around. For regular sims you should just ignore it.
As for Moving factor?  :blink:
I have no idea what it does. I have never come across any code that references it in any way. I haven't ever actually gone looking for it but I just haven't encountered any in the physics modules.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Movement
« Reply #2 on: April 06, 2005, 01:44:54 PM »
OK, just to simplify things, let's consider just one direction (vertical)

then to get new velocity program sums up accelerations (or decelarations) from 5 sources:

1. .up and .down.  The values are directly related to speed, 10 .up means velocity will increase by 10

2. brownian motion.  How are values from option screen relate to speed?  What would 4 do, what would 8 do?

3. Friction.  Same question - what do values in the option screen mean?  Does it depend on bots' size?

4. Gravity. Same question.

5. Bouyancy.  Is it 0 by default (meaning no effect)?  Can it be negative (pull bot down)?  Does it depend on value of "gravity"?  In theory it should, but I don't know if that was implemented?


About moving factor - it certainly is somewhere in the program - I can see the effects of it.  Set it too small and bots don't move at all, set it very high - they run like crazy.
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Movement
« Reply #3 on: April 06, 2005, 02:15:05 PM »
  • Yes exactly.
  • Brownian motion will choose a random value between 1/10 of the value on the slider X -1 and 1/10 of the value on the slider, then apply that acceleration to the robot.
    A value of 8 will result in a random acceleration between -0.8 and + 0.8
    This is applied seperately to x and y directions using a different random number for each
  • Friction. The robots current velocity is reduced by an amount equal to current velocity minus 1/10 of the value set in the friction slider.
    Velocity = 10
    Friction = 3
    new Velocity = 10 - (10 X (3/10)) = 7
  • Gravity is again applied at 1/10 of the value of the slider.
    A gravity of 10 will result in a downward acceleration of 1
  • Bouyancy is zero by default.
    Its effects are cumulative with gravity but do not depend on it since in pond mode it is assumed that there must be gravity and also that that gravity will impart no acceleration on any creature that has neutral bouyancy with respect to the liquid in which it is currently swimming. Hence the reason why Bouyancy was unavailable outside of pondmode. (may not be true any more)
  • Moving. You are right. It does have an effect. I just went in search of it and found a little one liner that multiplies all applied accelerations by a factor of slider value/100.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Zelos

  • Bot Overlord
  • ****
  • Posts: 707
    • View Profile
Movement
« Reply #4 on: April 06, 2005, 03:08:58 PM »
what are the movement relative to?
When I have the eclipse cannon under my control there is nothing that can stop me from ruling the world. And I wont stop there. I will never stop conquering worlds through the universe. All the worlds in the universe will belong to me. All the species in on them will be my slaves. THE ENIRE UNIVERSE WILL BELONG TO ME AND EVERYTHING IN IT :evil: AND THERE IS NOTHING ANYONE OF you CAN DO TO STOP ME. HAHAHAHAHAHAHAHA

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Movement
« Reply #5 on: April 06, 2005, 03:50:27 PM »
They are relative to your PC screen which may or may not be moving.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Movement
« Reply #6 on: April 06, 2005, 03:51:52 PM »
rofl

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Movement
« Reply #7 on: April 06, 2005, 03:56:01 PM »
Maybe he's running DB on a laptop in his car while travelling at the legal speed limit down the highway.
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
Movement
« Reply #8 on: April 06, 2005, 04:44:46 PM »
Movement factor is the percentage of any accelerations that actually make it to movement.  I guess it represents imperfect cilia and stuff.  Set it to zero and the only way to move is with ties(I think), so it certainly has some uses.

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Movement
« Reply #9 on: April 06, 2005, 05:30:55 PM »
So, you are saying that "10 .up store" actually is not directly converted to velocity of 10, but to velocity of 8 at most, when moving factor is 80?

And what do you mean by "any" acceleration?  Is it applied after ALL accelerations are calculated?  Or it only refers to .up and .down commands?
"Never underestimate the power of stupid things in big numbers" - Serious Sam

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Movement
« Reply #10 on: April 06, 2005, 07:42:30 PM »
I can't remember for sure, but I think it's just for applied acceleration using .up, .dn, etc.

Yep, if you store 10 in up the best speed you can get it 8.  That was one of the first things I figured out when I got the program.  If you look, Ymir tries to compensate for this.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Movement
« Reply #11 on: April 06, 2005, 11:01:09 PM »
Then again though, if your robot is really skinny and has a body mass of 0.5 then you will get a speed of 16 from an up value of 10 (actual 8)

Is this getting confusing or what?
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline shvarz

  • Bot God
  • *****
  • Posts: 1341
    • View Profile
Movement
« Reply #12 on: April 06, 2005, 11:04:18 PM »
Yes it is.  I am going to make a new section for wiki called "TechDetails" - we can post  info for advanced users there.
"Never underestimate the power of stupid things in big numbers" - Serious Sam