How Can a PID Controller Improve Missile Guidance in a Game?

Click For Summary
SUMMARY

The discussion focuses on implementing a PID (Proportional-Integral-Derivative) controller to enhance missile guidance in a game inspired by Asteroids. The current challenge involves stabilizing the missile's angle to accurately align with the target point, as the existing method results in overshooting due to oscillation around the target. The missile's dynamics include a variable velocity vector, initial rotation, fixed acceleration, and maximum rotation speed. The goal is to dampen the angle difference (theta) to zero efficiently, ensuring precise targeting of asteroids and enemies.

PREREQUISITES
  • Understanding of PID control theory and its application in dynamic systems.
  • Familiarity with vector mathematics, particularly in 2D space.
  • Knowledge of game physics, including missile dynamics and acceleration principles.
  • Experience with programming algorithms for real-time simulations.
NEXT STEPS
  • Research PID controller tuning techniques for optimal performance in dynamic environments.
  • Explore vector interpolation methods to improve missile trajectory calculations.
  • Investigate existing algorithms for pathfinding and interception in game development.
  • Learn about implementing damping functions to stabilize motion in game physics.
USEFUL FOR

Game developers, particularly those working on physics-based simulations and missile guidance systems, will benefit from this discussion. It is also relevant for programmers interested in enhancing AI targeting mechanisms in games.

tenpoints
Messages
1
Reaction score
0
Hey all,

This is a bit of a broad subject so I'm not sure which section it best applies to, but here it is anyway.

I'm working on a massively over-engineered version of the original Asteroids game. How over-engineered? Well the problem I have right now is desigining and implementing a guidance system that will be used for missiles targeting asteroids, and aliens targeting the player. It will later be extended to navigating around obstructions via a series of waypoints.

I have an algorithm that finds the point of intersection of asteroid and missile, but I don't have an accurate enough method for calculating the duration of flight (to get the point accurately).

Asteroids have a velocity vector with a constant magnitude and angle.

Missiles have:
  • A velocity vector with a variable magnitude and angle.
  • An intial rotation based on the rotation of the ship. Variable name: rotate
  • A fixed rate of acceleration.
  • A maximum speed of rotation.

When fired, the goal of the missile is to align its velocity angle with the angle between the missile and the target point. I have a function called theta which returns the difference between these two angles.
When theta is:
  • Positive: The target is off to the right of the missile.
  • Negative: The target is off to the left of the missile.
  • Zero: The target is dead ahead of the missile.
The range of angles is from -179 to 180 degrees.
In the game, an angle of 0 degrees (missile rotate) is facing right.

The problem I'm having at the moment is that my current commands tell the missile to rotate right or left based on theta, and as a result the missile tends to fishtail around the line of intersection and often ends up overshooting the target point.

What I need is an algorithm/equation to stabilise the missile's angle by "dampening" the velocity vector to theta=0 in as short a time as the thrust and rotation of the missile will allow. Once the missile has the right angle it will pass right through the target point.

The missile can only apply an acceleration in the direction of rotation.

Once I have an accurate hit on a point I can calculate the number of steps to reach that target, either by simulating the path before actually launching it, or with an equation, apply a function to determine the length of the path (possibly less expensive processwise).

Any ideas?
Thanks :-)
 
Physics news on Phys.org
Having variable missile speed and finite turinig speed makes it difficult to compute the interception path.

Controling the missile via rotation & linear acceleration forward only, makes it even more difficult to follow the interception path, even if you knew it exactly.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K