# Simulating relativity in a velocity verlet algorithm

1. Jul 18, 2009

### cephron

(Skip to the * mark if you would like to see my question without the background)

Hi,

I'm trying to write a turn-based computer game which simulates space combat at relativistic speeds, but I'm a beginner at programming and I don't know much physics beyond the high school level. The game consists of spacecraft flying through a 30 lightyear-by-30 lightyear 2-dimensional space roughly reminiscent of the Local Cloud, trying to destroy their opponents while dealing with the lightspeed delay and a realistic simulation of the ship's inertia and the gravity of nearby stars.

*
My current inertia-and-gravity simulation is based on the velocity verlet algorithm ( http://en.wikipedia.org/wiki/Velocity_Verlet#Velocity_Verlet ), which is purely Newtonian. Obviously, this won't do, because this puts no limit on the speeds ships can attain.
I think converting the whole simulation to general relativity would be completely above my head. I'm wanting to know if there's any simple or medium-difficulty way of simulating a lightspeed limit of the velocity of the ships - without losing kinetic/potential energy - that can be integrated into the velocity verlet algorithm.

Any help would be most welcome!

(If this is outright impossible for some obvious reason, I apologize for the blatant ignorance!)

cephron

2. Jul 20, 2009

### cephron

Ok, here's what I'm thinking of doing, so far. It seems like an obvious solution, but I'm unsure of its accuracy.

Whenever I'm calculating the acceleration of the particle for the next timestep, I'll use the base mass multiplied by the relativistic factor of change ( 1 / sqrt(1 - v^2/c^2) ).

This would end up leaving acceleration due to stars' gravity unchanged, since the mass term cancels from the equation, but it would greatly diminish the acceleration of the drive when the ship is at high velocities. One of my main concerns with this is that, if a ship was accelerating towards a star, it's drive might bring it to 0.99c and the star's gravity - with the relativistically increased mass cancelling out - might push it over the edge.

Would this accomplish the goal? Or would it be screwed up because I'm not also including the time dilation and lorentz transformation? Or perhaps I need to include the relativistic factor in the acceleration due to star gravity, somehow?

Thanks in advance for any input.

Last edited: Jul 20, 2009
3. Jul 20, 2009

### cephron

Since my broad questions don't seem to interest people (which is fine, lol), I'll try to break it down into simpler questions:

1)

Using the above figure as a reference (the units are only meant to be guides, change them if it becomes more convenient), what kind of acceleration due to gravity according to the star's reference frame would one expect on the 1kg-object in the case where:
a) The object is at rest or traveling at low velocity?
b) The object is traveling at .99c perpendicular to the source of the gravity?
c) The object is traveling at .99c towards the source of gravity?
Main point being, would they be different?

2)
What sort of time would it take for an object in the edge of the solar system (say, in the near edge of the kuiper belt) to fall into the sun, if it starts out at rest relative to the sun? Years, decades? A century? How about if it started a light year from the sun?

4. Jul 21, 2009

### Ich

Ther'es an equation on p. 34 of http://www.worldscibooks.com/etextbook/6833/6833_02.pdf" [Broken] that might help you.

Last edited by a moderator: May 4, 2017
5. Jul 21, 2009

Staff Emeritus
You won't get the right answer by plugging in relativistic mass. In fact, I doubt very much that this algorithm will work at all - the expansion assumes a is independent of v, right? Sorry.