Roll20 Physics

One of the things we often have to do in our Traveller games is work out some simple maths, such as how long it takes to travel a given distance in a ship with a given thrust. Basic GCSE maths tells us that the equation of motion is s = ut + \frac { a}{ 2 }t^2, which is easy enough, but also easy to get wrong when doing a BOTE calculation, especially when re-arranging to get the time to accelerate to the half-way point, then decelerate back down to a stop. So rather than trying to do this in our heads:

t = 2\sqrt{   \frac { s}{ a }}

But wouldn’t it be easier to just type something into Roll20 and have it work things out for us? For example:

!physics thrust 2g 15au

This can then tell us how long it will take, without having to remember all the right units to divide by to get a time in hours or days. So I’ve written a small API script which provides some basic support for some equations.

It produces two sets of numbers, one for the normal travel time (accelerate up to the mid-point, then decelerate to stop at the destination), and the second for ‘impact’ time, for objects such as missiles which don’t need to decelerate and just keep on thrusting until they hit the destination target.

If you don’t specify a thrust in ‘g’, then it assumes m/s². The distances can be in a number of different units, such as metres (m), kilometres (km) or millions of kilometres (mkm), as well as the astronomical units (au) shown above.

Players no longer have to remember that hours consist of 60 minutes when working out how long it will take them to get to a gas giant (an oversight that almost led to a short trip taking several weeks in our previous session).

Though it’s not much use in Traveller, you can also ask it for the rocket equation, by providing the wet mass, dry mass and I_{sp} for the rocket.

!physics rocket 1000 200 350

This will output the \Delta v for the rocket in km/s.

Planetary Statistics

It can also be useful to work out statistics about planets, the most common one being surface gravity.

g = \frac {4\pi}{3}G\rho r

Then there’s things such as escape velocity (not so important in Traveller where you have reactionless drives) and mass, as well as some basic orbital mechanics.

!physics planet 6400 5.5

The Physics API, given a planet’s radius and density, will output a range of basic data, including the planet’s mass, escape velocity and surface gravity. it will also give the mass of the planet relative to Earth, Jupiter or the Sun depending on how massive it is.

v_e = \sqrt{\frac{2GM}{r}}

You can also use units other than kilometres, though these are the default unless otherwise specified. Metres (m), Millions of km (Mkm) or Astronomical Units (au) are possible whenever a distance is given.

!physics planet 1e 1e

You can also specify relative values, such as specifying radius and density relative to Earth (E), Jupiter (J) or the Sun (Sol). So the above command, specifying ‘1e’, will output statistics for the Earth. If you want something with twice the radius of the Earth, use 2e etc.

It’s also possible to find orbital parameters by specifying an orbital radius for a planet. The orbital distance can either be the distance from the centre of the planet (the default), or the altitude above the surface by prefixing the distance with a plus (+).

!physics planet 1e 1e 6800km
!physics planet 1e 1e +400km

Asking for orbital parameters will provide the velocity of the orbit, its period, as well as the escape velocity from that orbit as well as the value of ‘surface’ gravity at that height.

You can also use this to work out orbits around a star, by specifying a stellar sized object as the ‘planet’.

In this case the period will be in significantly longer units of time, but otherwise the numbers are pretty much the same.

!physics planet 1sol 1sol 1au

All orbits are assumed to be circular, because anything else is more complicated and is rarely needed.

It doesn’t stop you putting an orbit inside the planet (or star), or correctly handle that situation, so try not to do it. However, it will tell you if you’ve created a black hole from which you can’t escape. It just doesn’t cope with relativistic velocities at all well for travel times. But these are unlikely to come up too often in most Traveller games, plus I haven’t been able to find an example of relativistic equations of motion that I can understand.


Since some people don’t like to type long commands, it’s possible to shorten what you type since the script accepts just the first few characters of a command or sub-command.

!phy thrust 1g 1au 

You only need to type ‘!phy’ as the initial API command, though anything up to ‘!physics’ will work.

The sub-commands can be shortened to the minimal unique length – since there are only a few sub-commands thrust can be shorted to ‘t’, planet to ‘p’ and rocket to ‘r’.

Also, all units are case insensitive.

The commands can of course be put into macros if you want a more graphical way of accessing them.


If you want the script, it is available on GitHub to use in your own games. The most recent docs are available at

If the number of equations on this post seems excessive, it’s because I’ve discovered the rather nice WordPress plugin Katex, which allows you to embed LaTeX into the page.

Samuel Penn