Difference between revisions of "Movement"
m (→Examples:: store fixed) |
m (Fixed typos) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
==Syntax:== | ==Syntax:== | ||
− | When a bot stores a value in .up, .dn, .sx, or .dx, the bot is attempting to move with the | + | When a bot stores a value in .up, .dn, .sx, or .dx, the bot is attempting to move with the strength of that value in the given direction. |
*[[.up]] accelerates the robot forward in the direction that he is facing. | *[[.up]] accelerates the robot forward in the direction that he is facing. | ||
*[[.dn]] accelerates the robot backward from the direction he is facing. | *[[.dn]] accelerates the robot backward from the direction he is facing. | ||
− | *[[.sx]] accelerates the robot at an angle of | + | *[[.sx]] accelerates the robot at an angle of 90 degrees to the left of the direction he is facing. |
− | *[[.dx]] accelerates the robot at an angle of | + | *[[.dx]] accelerates the robot at an angle of 90 degrees to the right of the direction he is facing. |
====Example:==== | ====Example:==== | ||
Line 26: | Line 26: | ||
===Range:=== | ===Range:=== | ||
− | Any number from | + | Any number from -32000 up to +32000 can be stored in any of these locations but the values are filtered prior to being used by the robot. Any value with a magnitude of more than 1000 will be reduced to 1000. (no change in sign will be made) |
===Vector acceleration:=== | ===Vector acceleration:=== | ||
Line 33: | Line 33: | ||
====Examples:==== | ====Examples:==== | ||
− | 5 [[.up]] | + | 5 [[.up]] [[store]] 5 [[.dn]] [[store]] |
A bot storing 5 in up and 5 in down is charged nothing because the colinear vectors add up to 0. | A bot storing 5 in up and 5 in down is charged nothing because the colinear vectors add up to 0. | ||
− | 3 [[.dx]] | + | 3 [[.dx]] [[store]] 4 [[.up]] [[store]] |
− | A bot storing 3 in .dx and 4 in .up is charged 5, the magnitude of the resulting vector, sqr( | + | A bot storing 3 in .dx and 4 in .up is charged 5, the magnitude of the resulting vector, sqr(3^2+4^2), in the resulting vectors direction. |
===Movement Factor:=== | ===Movement Factor:=== | ||
Line 51: | Line 51: | ||
==Activation hierarchy:== | ==Activation hierarchy:== | ||
− | Movement commands are executed after [[ | + | Movement commands are executed after the rotation commands such as [[.aimdx]] or [[.setaim]] |
==Associated Keywords:== | ==Associated Keywords:== |
Latest revision as of 20:14, 14 February 2014
Movement refers to the bots' primary method of locomotion. The movement commands are part of the heart of the DarwinBots DNA language. Without these, there could be no movement, just bouncing, gliding, flowing and tie-pushing.
Contents
Sysvars:
Movement:
Forwards compatibility note: aimdx is the old name for aimright aimsx is the old name for aimleft |
Syntax:
When a bot stores a value in .up, .dn, .sx, or .dx, the bot is attempting to move with the strength of that value in the given direction.
- .up accelerates the robot forward in the direction that he is facing.
- .dn accelerates the robot backward from the direction he is facing.
- .sx accelerates the robot at an angle of 90 degrees to the left of the direction he is facing.
- .dx accelerates the robot at an angle of 90 degrees to the right of the direction he is facing.
Example:
cond start 10 .up store stop
A robot with this gene would constantly accelerate forward at a rate of 10 per turn. That is to say that his forward velocity would increase by a value of 10. If he should rotate then the direction in which the acceleration takes place would also change.
Technical Details:
Range:
Any number from -32000 up to +32000 can be stored in any of these locations but the values are filtered prior to being used by the robot. Any value with a magnitude of more than 1000 will be reduced to 1000. (no change in sign will be made)
Vector acceleration:
All four relate to vector acceleration rather than actual movement. The direction of the vector acceleration is defined by the direction in which the DarwinBot is facing when the command is carried out. Prior to actual movement of the DarwinBot the values in .up .dn .sx and .dx are all added together such that a negative .up and a positive .dn will add to make a larger acceleration in the .dn direction and a positive .up and a positive .dn, of equal magnitude, will cancel each other out.
Examples:
5 .up store 5 .dn store
A bot storing 5 in up and 5 in down is charged nothing because the colinear vectors add up to 0.
3 .dx store 4 .up store
A bot storing 3 in .dx and 4 in .up is charged 5, the magnitude of the resulting vector, sqr(3^2+4^2), in the resulting vectors direction.
Movement Factor:
This movement force is multiplied by the Movement Factor, which allows a user to modify the efficacy of the bots' manual movements. By lowering Movement Factor, the user is encouraging bots to find other methods of locomotion. Perhaps forming ties and swimming.
Ties and Repulsion:
Next, these accelerations are added to any existing accelerations due to the actions of ties and repulsion fields (when robots get too close together). Finally, the accelerations are converted to X and Y vectors and applied to the DarwinBot by adding them to existing velocities in the X and Y directions. The total velocity (length of the resulting vector) cannot exceed 40 units per cycle so any excess is then lost.
Movement energy costs:
Energy costs to the DarwinBot are calculated based on the input values. These vary with robot mass and applied acceleration but cannot exceed 100 energy points per vector per cycle.
It is charged energy based on the value stored in these locations only in so far as that value actually applies to generated forces. A bot storing 200 in .up is charged only as much as it takes for its speed to reach the maximum allowed value.
Activation hierarchy:
Movement commands are executed after the rotation commands such as .aimdx or .setaim
Associated Keywords:
See also: