Game Development Reference
In-Depth Information
Results of interest are then written to the output and debug files. So, that's pretty much
it. After the loop finishes, the files are closed and the application terminates.
If this were an actual game, you would use the club head velocity results along with the
collision response method we showed in Chapter 3 to determine the golf ball's trajectory.
You could model the flight path of the golf ball using the methods we showed you in
Chapter 6 .
Billiards
Now let's take a look at a different example. You may not think of billiards as a sport,
but it is recognized internationally as a cue sport. Cue sports are a family of sports that
include billiards, pool, snooker, and other related variations. For simplicity, we'll stick
with the term billiards , although the topics presented apply to all cue sports.
Billiards is a good example of an activity that takes place over a limited physical space.
Thus, when writing a billiards video game you need only concern yourself with a very
finite space composed of well-established geometry. Billiard tables are typically 1.37 m
× 2.74 m (4.5 ft × 9 ft), with some longer and some smaller depending on the game,
style, and space available. Tables are typically cloth-covered slate. Balls vary in size be‐
tween games and regions, with American-style pool balls measuring about 57 mm (2.25
inches) in diameter. Balls used to be made of wood, clay, or ivory, but nowadays they
are plastic.
All these characteristics are important little details that you must consider if you're going
to make a realistic billiards video game. The slate table and hard plastic balls have certain
impact characteristics. The cloth-covered table provides some resistance to rolling. Side
bumpers are not as hard as the slate table, thus yielding different impact characteristics.
Fortunately, data on billiard tables and balls is readily available on the Web. And sim‐
ulating billiards in a video game is fairly straightforward.
Billiards makes an interesting example because collisions are the heart of the game, and
such an example also gives us an opportunity to demonstrate rolling contact. Figure 19-2
and Figure 19-3 illustrate the example we'll focus on. We have three object balls (the
ones that get struck with the cue ball) set up in the middle of the table in a loose triangle
configuration.
Search Nedrilad ::




Custom Search