O'Reilly logo

Programming Game AI by Example by Mat Buckland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Earth’s rotation is slowing down slightly every year, by the late sixties this
became problematic for scientists who needed increasingly precise mea
-
surements for their experiments. Today, therefore, a second is measured as:
The duration of 9,192,631,770 periods of the radiation corresponding to
the transition between the two hyperfine levels of the ground state of the
cesium 133 atom.
This definition provides today’s scientists with the constant time interval
they require for their precise experiments.
Time in computer games is measured in one of two ways: either in sec
-
onds (just as in the real world) or by using the time interval between
updates as a kind of virtual second. The latter measurement can simplify
many equations but you have to be careful because, unless the update rate
is locked, the physics will differ between machines of varying speeds!
Therefore, if you choose to use a virtual second, make sure your game’s
physics update frequency is locked to a reasonable rate — usually the rate
of the slowest machine you’re developing for.
Ü
NOTE Not all that long ago the majority of computer games used a fixed
frame rate and every component — rendering, physics, AI, etc. — was updated
at the same frequency. Many of today’s sophisticated games, however, specify a
unique rate for each component. For example, the physics might be updated 30
times a second, the AI 10 times a second, and the rendering code allowed to go
as fast as the machine it runs on. Therefore, whenever I refer to an “update
rate” in the text, if I don’t specify a context, it will be in the context of the subject
I’m talking about.
Distance
The standard unit of distance — a scalar quantity — is the meter, abbrevi
-
ated to m.
Mass
Mass is a scalar quantity measured in kilograms, abbreviated to kg. Mass is
the measure of an amount of something. This can be a confusing quality to
measure since the mass of an object is calculated by weighing it, yet mass
is not a unit of weight; it is a unit of matter. The weight of an object is a
measurement of how much force gravity is exerting on that object. Because
gravity varies from place to place (even here on Earth), this means the
weight of an object can vary in different places, even though its mass never
changes. So how can mass be measured accurately?
Scientists have overcome this problem by creating a platinum-iridium
cylinder that everyone has agreed to call THE kilogram. This cylinder is
kept in Paris and all measurements are made relative to it. In other words,
you can go to France and have your own duplicate kilogram made, which
weighs exactly the same as THE kilogram. Now you know that wherever
A Math and Physics Primer | 29
Physics

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required