I Faking a Formula For Movement Through Gravity

AdmiralOlson
Messages
2
Reaction score
1
I have a strange question. It's strange because I don't need a correct answer. I need an answer that seems correct and leads to predictable results. I'm making a multiplayer computer game where the players fire cannons in outer space. The cannon shells will move through the gravitational fields of planets. If there weren't planets, I could sync the location of the shells on all the different computers by giving the velocity and position of the shell at a specific time to each computer. Because the movement is completely deterministic, and because the networking system I'm using provides accurate time measures across all the computers, each computer can calculate the location of the shell at the specified time. Complete accuracy and all I needed to do was send a velocity vector, a position vector, and a time.

There are planets though. The movement of the shells is still completely deterministic, but I don't know what the formula is. I'm hopeful I can still sync the location of the shells, this time by giving three vectors instead of two: the acceleration, velocity, and position of the shell at the specified time. Or is that only true if there is just one gravity source? With two gravity sources, is it impossible to summarize the movement of the shell with three vectors? And if it is possible, how do I derive the vectors? Simplifying the problem, the planets don't move.

There are potentially going to be dozens of cannon shells at any given time, so if I have to have each shell send its location to each player every tenth of a second, it's going to be way too much network traffic. I'm using Unity, which doesn't have a deterministic physics engine, so I can't count on each computer coming to the same results if they calculate the gravity separately.

Also, even if it is impossible to derive the three vectors, it might not matter. If I can come up with something that looks right, and is consistent enough that the player can predict where the shell is going to go, then I don't care if it's inaccurate. The players won't even notice.

Any ideas?
 
Physics news on Phys.org
One possibility is to have only one gravitational source active on a shell at a time. As the shell leaves the sphere of influence of one planet and enters another you can switch the gravitational source to the new planet.
 
  • Like
Likes jedishrfu
Thats not an unreasonable assumption as the interplay of multiple planets will effectively cancel in deep space or one planet will clearly dominate.

Kind of like the lagrange points where gravity is zero between the Earth and Moon.

https://en.m.wikipedia.org/wiki/Lagrangian_point
 
jedishrfu said:
Thats not an unreasonable assumption as the interplay of multiple planets will effectively cancel in deep space or one planet will clearly dominate.

Kind of like the lagrange points where gravity is zero between the Earth and Moon.

https://en.m.wikipedia.org/wiki/Lagrangian_point

I'm sorry it took me so long to reply, but I actually did come up with a solution. The standard method for syncing projectiles in networked multiplayer games is to provide the same velocity, position, and time to each client, as I've stated. I can effectively do the same thing with projectiles being pulled by gravity as long as the location and strength of the gravitational sources, and the times when we calculate the gravitational strength, are the same. SO! I provide velocity, position, and time, and each client calculates the acceleration due to gravity at that specific time. Then we use the acceleration, velocity, and position to estimate where the projectile will be in 1/30 of a second, let's say. Because each client is using the same numbers, they should get the same results. Then we repeat the process. It should be deterministic.

Thanks Drakkith and jedishrfu for your comments. I'm going to keep thinking through your suggestion because it could lead to a much simpler method.
 
  • Like
Likes Negatratoron

Similar threads

Replies
15
Views
5K
Replies
11
Views
3K
Replies
12
Views
3K
Replies
6
Views
2K
Replies
30
Views
5K
Replies
42
Views
7K
Back
Top