Tidal/Celestial bodies equations

  • Thread starter cnblock
  • Start date
  • Tags
    bodies
In summary, the conversation was about creating an artificial intelligence for video games that has an understanding of celestial bodies and their relation to enemy units. The equation for calculating gravitational forces between bodies was mentioned and the need for a simplified version for a layman to understand. The conversation also discussed the use of vector arithmetic and the steps needed to simulate the movement of particles in orbit on a screen. Resources for further learning and implementation were provided.
  • #1
cnblock
9
1
I was thinking that it would be cool to be able to create an artificial intelligence for video games which has an understanding of celestial bodies in relation to clumps of enemy units. The enemy units become the celestial bodies, and your units clump to engage them. I would be running the celestial bodies equation for all my counter units, so I would essentially be forking the algorithm multiple times for certain units. Would it be at all possible to get a synopsis of the equations in a packet that a layman can understand? I would essentially need the equation that calculates the tides in relation to the moon, but it would be two dimensional, and would therefore be telling my units what affinity they should have for certain areas of the map. I am a software developer, so if one could explain with very simple and or vocabulary names of the elements of the equation that would be great. Software equations get evaluated backwards, but if you need to do it the other way, that's fine. I would need to know how to scale down to a battlefield approximation.

var num = 1
num = num + 2
num = num * 3
 
Computer science news on Phys.org
  • #2
The bodies will have velocity in your 2D world, that will change due to gravitational forces of all other bodies or players through the inverse square law. G * M1 * M2 / r^2.
Start here; https://en.wikipedia.org/wiki/Gravitational_field#Classical_mechanics
https://en.wikipedia.org/wiki/N-body_simulation

Or find any book on Orbital or Celestial Mechanics.

If you want our real Solar system predictive computations...
Beginners programming guide here; Astronomical algorithms, by Meeus J. Willmann-Bell, 1991.
See also; SLALIB, find code here by following https://en.wikipedia.org/wiki/Starlink_Project
 
  • Like
Likes jim mcnamara and anorlunda
  • #3
I can see that the equation you have given me is Gravity times Mass1 times Mass2 all divided by the radius of my circle squared. Please check that last sentence. I will probably add a scalar multiplier in order to overwhelm forces that approach by a certain factor. Should be simple multiplication. Thanks.
 
  • #4
cnblock said:
all divided by the radius of my circle squared.
No, divided by the distance between those two masses squared.
 
  • #5
You seem to be new to this.
You will need to do vector arithmetic on x and y components.

Define a particle as an object. It has mass m, position px and py, and velocity vx and vy vectors.

For each time step you must;
1. Sum all the force components fx and fy of gravitational forces on each particle, due to all other particles using the force = G.m1.m2 / r2 equation.
2. Use that force and the particle mass to update the particle velocity component vector.
3. Work out the new position of each particle based on last position and velocity.
4. Redraw the screen.

Setup a couple of particles with mass, position and velocity. See if you can simulate one particle orbiting another on the screen.
 

1. What are tidal/celestial bodies equations?

Tidal/celestial bodies equations are mathematical formulas used to describe the movements and interactions of celestial bodies, such as the Earth, moon, and sun, and their effects on tides and other phenomena.

2. How are tidal/celestial bodies equations used?

Tidal/celestial bodies equations are used by scientists and astronomers to predict and explain the behavior of celestial bodies and their effects on Earth, including tides, eclipses, and other astronomical events.

3. What factors are considered in tidal/celestial bodies equations?

Tidal/celestial bodies equations take into account various factors, such as the masses, distances, and gravitational forces between celestial bodies, as well as the rotation and orbit of each body.

4. How accurate are tidal/celestial bodies equations?

Tidal/celestial bodies equations are highly accurate, but they are constantly being refined and adjusted as new data and observations become available. They can also be affected by unpredictable factors, such as the gravitational pull of other celestial bodies.

5. Can tidal/celestial bodies equations be used to make long-term predictions?

While tidal/celestial bodies equations can accurately predict short-term events, such as tides, their accuracy decreases for longer time frames due to the complex and constantly changing nature of celestial bodies. Therefore, they are not reliable for making long-term predictions.

Similar threads

  • Astronomy and Astrophysics
Replies
2
Views
3K
  • Sci-Fi Writing and World Building
Replies
21
Views
804
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
823
Replies
8
Views
1K
  • Sci-Fi Writing and World Building
Replies
22
Views
8K
Replies
1
Views
504
  • Introductory Physics Homework Help
Replies
1
Views
2K
  • Mechanical Engineering
Replies
1
Views
3K
  • Advanced Physics Homework Help
Replies
1
Views
1K
Back
Top