A look at some of the physics of Grobots. To effectively understand and fine-tune side behavior, a working knowledge of this is usually required.
There are several universal properties which define robots and the environment, namely time, distance, energy, and mass. Other physical properties, such as speed, acceleration, and power may be derived from these using real-world Newtonian mechanics formulas.
The Grobots unit of time is the frame, which at regular speeds is equal to roughly 1/30 seconds.
There is no named unit of distance, but one side of a small grid section on the main view is equal to one "distance unit". (A large grid section is called a tile. A tile is 10 distance units on each side.)
The unit of energy is nameless. One typical robot costs 1000 energy to construct. Unlike modern real-world physics the unit of energy is fundamental, not derived from distance, mass and time.
The unit of mass is nameless as well. One typical robot is 20 mass units.
Engines automatically attempt to accelerate towards the velocity requested by their instructions, with the acceleration limited by the engine power. Engines take the following energy to use:
acceleration * mass * max(0.05, speed) / 0.2
So they produce a maximum acceleration of:
acceleration = power / mass / max(0.05, speed) * 0.2
Drag (as acceleration) is:
robot_drag = 0.15 speed^2 + 0.01 speed + 0.001 food_drag = 0.3 speed^2 + 0.01 speed + 0.004
Combining the above two shows how fast one can go with a given engine and how much energy is spent to travel at various speeds:
|Steady speed||Engine power||Energy per distance traveled|
Note that 0.05 is the most efficient speed if you aren't in a hurry.
The seek-location primitive is merely a convenience. It is equivalent to:
seek-location: ;x y position v- dup norm radius < if 0 engine-power! 2drop else engine-max-power engine-power! 0.08 vs* rect-to-polar engine-velocity! then return
- Each food (both manna and corpses) loses 0.12 energy per frame to decay.
- An average of 0.25 energy worth of added per tile per frame, in 400-energy chunks. That's an average of one manna chunk added to each tile every 1600 frames. The initial density of food is (on average) 150 energy / tile. The initial manna is sized between 40 and 400 energy per manna so that the initial distribution of sizes is fairly similar to the distribution later on.
- Dead robots leave half their biomass as a corpse. Aborting a robot in progress leaves three quarters of its biomass.
Weapons and damageEdit
- Blasters and grenades move at a speed
range 250 / 0.35 pow. For example a range 2.5 shot travels at a speed of (2.5/250)0.35 = 0.20, and a range 25 shot travels at a speed of (25/250)0.35 = 0.45. This speed is relative to the velocity of the robot that fired the shot when the shot was fired, so
shot-velocity normmay be more or less depending on how fast and in what direction to firing robot was going.
- Force fields, syphons and enemy-syphons reach their destination instantly (after one frame). For these shots
shot-velocityis simply the position of the firing robot relative to the position of the shot. We did it this way in part so that e.g.
shot-velocity vnegate anglegives the direction a shot is coming from irrespective of its type. The type of a shot can be determined using the
- Cells over the standard mass of 20 take extra damage, proportional to the excess mass. This is to compensate for the combat advantages they typically have otherwise. (This is a crude fix; Devon would prefer to find another way to balance combat.)
- When a robot dies, it creates an explosion of strength .01 * biomass.
- Explosions do more damage to larger targets (to reduce the advantage of large cells) and on direct hits:
damage = strength / (sqrt(strength / target_mass) * 0.5 + 1) * overlap
overlap is the fraction of the explosion's radius where the target most nearly approaches the center: 1 if the target contains the center of the explosion, 0 if the target barely touches the edge of the explosion, 0.5 if the target reaches halfway to the center. So the center of an explosion does full damage; 30% of the way from the edge does 30% damage.
- Force fields are less effective at long distances, and when off-center:
force = field_power * 0.003 * overlap * sqrt(target_mass) / (distance / 20 + 1) / max(target_speed, 0.05)
The shield power is the rate at which energy is added to the shield. Shields decay at about 6% per frame (for normal-sized robots):
shield_decay = 0.002 * mass + 0.01 * shield
...so it takes about 30 frames to raise or lower a shield most of the way.
Shields reduce damage taken:
damage_fraction = 1 / ((shield / mass)^2 + 1);
|Shield power||Stable level||Damage taken|
Syphons, eaters and outgoing weapons are reduced by the same fraction as damage (outgoing syphons are accidentally reduced by the square of this fraction). But shields are deprecated because they're poorly balanced, so we don't recommend using them in new sides.