Home           About           Downloads

Simple tennis program

This program is the beginnings of a tennis simulation featuring some basic tennis mechanics.

This program demonstrates a means of making the ball land anywhere with an arbitrary apex height, and a means of determining which part of the trajectory can be reached by the player.
In this way, the program demonstrates a framework for staging all sorts of different scenarios and tennis playing strategies in the tennis universe.

Description of AI behaviour:

  • AI runs directly toward the ball to intercept it
  • AI runs to the center of its half of the court after hitting the ball and before its opponent does
  • AI decides on where it would like the ball to land by choosing a random spot in opponent's half of the court
  • AI may control the height of the apex of the ball's parabolic trajectory

The parabola the AI desires is precomputed, and an appropriate initial velocity vector is computed for the ball so that the ball follows the desired trajectory under the influence of a physics model which only includes gravity.

The physics ball is rendered as a white sphere, the "scripted" constant x-velocity ball is rendered as a yellow sphere.
I render both to ensure that they match up precisely.

The precomputed parabola is rendered as well. The green portion is the portion that can be reached by the player, the red portion is the portion that cannot be intercepted in time.

In this version, I've made the camera follow the player, so there is no interactivity.

Esc will close the program.


No comments:

Post a Comment