Skip to Content
 

In need of a Good Will Hunting

7 replies [Last post]
oneMeVz
oneMeVz's picture
Offline
Joined: 06/08/2013

I'm designing this space-simulation wargame called "Delta Vector" that displays orbital mechanics realistically by using vectors. The calculations for every movement can be broken down into finding the graviational acceleration on the spacecraft by neighbouring celestial bodies, then add those vector(s) of gravity to the current velocity and any delta-v spent.

When it comes down to it, when you're spending each minute recalculating and adding vectors, it gets tedious. You can't just multiply your results to get through large time and space scales. Becuase as the spacecraft moves the acceleration and angle of gravity changes and thus changes the trajectory. Calculating moment-by-moment versus a chunk of time can make the difference of an orbital capture, overshooting flyby, or crashing into a planet.

I'd like to find another equation (if it exists) that can take into account these changes and find the precise infinitesimal position along the spacecraft's trajectory. I'm not a mathematician or rocket scientist, but I feel like this is something the guys at NASA have already figured out. If anyone who's really good at math or knows someone at NASA, it could really be helpful!

Thanks

MarkKreitler
MarkKreitler's picture
Offline
Joined: 11/12/2008
No easy solutoin

Hey One,

I'm not a rocket scientist, but I have an MS in Physics and recently wrote a web game with simple orbital mechanics, so I've just been over this problem. :)

The short answer is: you're not going to get a physically accurate simulation without doing the math over short time intervals. However, there are some things you could do that might be "good enough."

First, I'm going to assume that you're using a fixed board. If the planets can move during a game, or even from one game to the next, these techniques will fail, because they all involve doing the math ahead of time.

Second, I'll assume you're using a hex map. That's not critical, but it gives better results than the alternative.

The general idea would be to pre-compute the gravitational potential energy in every hex, and print that value into the hex as a number. You would color code each planet, then for each hex, calculate which planet exerts the most gravitational pull and color-code the hex to match. In some cases, you may find that the net gravity is small enough that you want to ignore its effects. Do not color such hexes.

In this system, you would use the concept of Energy to dictate where ships can go. You'll also need "turning charts," that dictate how many hexes forward a ship can move before rotating 60 degrees. The forward value would depend on the ship's speed -- the faster it's going, the farther it has to travel before turning.

At this point, you can develop a set of movement rules that involve the kinetic energy of the ship's current speed, the gravitational potential energy of the hex it occupies, and energy the player allocates to movement from the ship's power plant. I don't have time to work through the full breakdown at this point, but here is the outline:

1) Your ship's kinetic energy (KE) determines its speed. Physically, the formula is

KE = 1/2 * ship's mass * ship's speed squared

so you'll probably need a chart for ease of reference. Note that, when you do compute the gravitational potential energy of the board, you'll have to assume some mass for the ship. But notice also that the KE computation includes the ship's mass. It turns out the relationship between the ship's speed and the planetary gravitational potential is independent of the ship's mass, because it cancels out, so you can just assume all ships have a mass of 1 for your calculations.

2) At the start of each turn, record the ship's KE + power from engines. Call this the Movement Energy for the turn.

3) When the ship moves from one hex to another, there will be a difference in gravitational potential energy. If the ship is traveling to a hex with a higher energy, subtract the difference in gravitational energies from the Movement Energy. If the ship is going to a lower energy hex, add the difference.

Example: My ship starts the turn with movement energy 5. I'm in a hex with gravitational energy 3. I move to an adjacent hex with gravitational energy 6. This costs me 3 movement energy, reducing my movement energy to 2.

Example: Next, I move into a hex with gravitational energy 4. Since I'm dropping to a lower energy hex, I regain 2 energy, raising my movement energy to 4.

4) If my ship occupies a colored hex, it *has* to move because it's experiencing a gravitational force. If players want to remain stationary, they have to expend energy equal to the energy difference between the hex they are in and the next lowest hex that represents a legal move based on the current turning radius.

5) Players can opt to "free fall" through the gravitational field, in which case their ship must move into a hex of identical color whose gravitational energy value is less than or equal to the hex they currently occupy.

Even with these drastic simplifications, there are some sticky rules. For example, suppose you and I both start a turn with speed 5. We both allocate 5 units of power to our engines, but you accelerate down a gravity well and I thrust away from it. Since I'm moving to hexes with higher gravitational energies, I'll lose total Movement Energy. You, in contrast, will gain it as you are moving to hexes with lower energy.

Common sense tells us that you should move farther than me this turn, even though we started with identical speeds and engine power. This implies your movement system will have account for player acceleration during the turn, which is tricky. Star Fleet Battles had some optional rules for this, but it's the only game I know of to do so.

This is a tough problem -- very interesting, though. Probably the easiest solution is to write it as a compute game and port it to Dralius' table-top projection platform. :)

Best of luck!

Mark

McTeddy
Offline
Joined: 11/19/2012
This sounds like a software

This sounds like a software problem, so I'm going to answer like a software problem. Feel free to adapt the solution to human usage if needed.

There is a fairly common practice in video game programmer to handle complicated AI without slowing down the game which may or may not work for your situation. If you can't overshoot the calculations, you'll need to reduce the number of times that they are run each turn.

Instead, the programmers update the AI for half(Or less) of the enemies during each phase. One frame Group A runs the calculation, the next frame the other group does.

We have 30-60 frames per second... plenty of time that players won't notice the AI not being run.

BubbleChucks
Offline
Joined: 06/07/2012
Far to complex for me to

Far to complex for me to comment on the formulae without my brain melting, but very interesting. However, it would make for a great injection of realism in a miniatures game.

Miniature gamers like calculating attack vectors, but would they really embrace complex mathematics and would the required inclusion add to the gaming experience or suffocate it?

I like the idea of using the tabletop projection platform, but not everybody will have access to it.

You could simplify the hardware/software provision and boost the theme by linking the game to a calculative app. The app could display a space grid with objects that could be shifted around to form a representation of the board area the player wishes to move through.

So the player would access the app, shift the game objects (planets and gravitational affectors, represented as objects) to represent the environment. The player would then add the ship to its current location and draw a line of travel to the point they wish to journey too. The app would then display the relevant move data.

This would add to the theme if the app had a spacey graphic design because the players would feel like they are plotting a spatial course for their ship - drawing the player into the theme of the game instead of potentially pulling them out of the theme as they pen and paper calculate a course.

MarkKreitler
MarkKreitler's picture
Offline
Joined: 11/12/2008
Yup

I like Bubblechuck's app idea. However, going back and forth between App and board may prove fiddly. At that point, why not just play the thing on the tablet/phone?

(Yeah, I know the answer--shared real estate and so on).

One other thing to note: the original Traveler rules included vector-based ship-to-ship minis rules. Granted, they didn't explicitly deal with multiple gravitational influences, but they didn't rule it out, either. In a nutshell: players used lengths of string to represent velocity and thrust vectors of different magnitude, and performed the vector addition with the strings. One could extend this idea with string for the gravitational sources.

Still, in all, it would be very complex, and the sim would get less and less accurate the fewer calculations you did per turn.

Just one...tough...problem.

oneMeVz
oneMeVz's picture
Offline
Joined: 06/08/2013
Maybe I should have given a bit more info

No hexes. Planets move and are at scale. The board would be an entirely plexiglass surface with a second plexiglass set of movable rings underneath with a planet on each. There would be polar coordinates around the Sun and each planet to give quick reference to the distance the spacecraft is.

The equation for finding the acceleration is actually simple: its the added mass of the two objects (planet and spacecraft - although the mass of the spacecraft is so minute you could disregard it completely) divide by the square of the distance between the objects. There's also a gravitational constant you would normally multiply by, but this game is set in the future, and they'd use "natural units" of smaller magnitiudes instead, so they don't need that constant.
[mass/distance^2]

That's it. Then you add the vectors - No equations necessary! - you just draw the vectors end-to-end and there you have your next trajectory!

No pen and paper is really necessary for the calculations, but even a calcutator could easily be replaced by a Nomogram chart.

(Why computer games and tablet apps? I thought this was a forum for "boardgames"?)

MarkKreitler
MarkKreitler's picture
Offline
Joined: 11/12/2008
Yep...tough problem

If I remember correctly, the equation you're stating:

F = G M1 M2 / r^2, (masses multiply, rather than adding)

tells you the gravitational force, not the acceleration. The good news this makes life even simpler, because the mass of the spacecraft (say, M1) then drops out of the acceleration calculation altogether:

Net Force = M1 * a = G M1 M2 / r ^ 2

or

a = G M2 / r ^ 2, where M2 is the planetary mass, only (and, as you've mentioned, you can choose units such that G = 1).

But you'll still need the M2 / r ^ 2 calculation, won't you? So I'm not sure what you mean when you say "no calculations needed" -- or is this just referring to the vector addition?

But isn't the problem you're encountering the fact that the acceleration vector changes as the ship moves? So, if you want to find the continuous velocity of the ship, you have to integrate over small delta time -- which involves frequent calculation?

Also, if you have multiple planets, aren't you performing the a = M2 / r ^ 2 calculation per planet for every ship?

This is one advantage of using energy-based equations -- they are all independent of time. Meaning, if you compute the gravitational potential energy at two points in space, the amount of energy change when traversing between those two points is the same no matter how long it takes you to perform the move. There may be a way to leverage this into simpler movement rules that still capture the "gravity well" feel you're after. Not sure that's a viable option, though, given your setup.

I guess what I'm trying to say is, given your desire for an accurate simulation of gravitational effects, I don't see a practical way to represent force-based movement. But then, I'm no Good Will Hunting. :)

As for why computer games and tablets, its because many of us do both, and the design you're proposing, with the simulation you desire, doesn't seem realistic for a board game. That's assuming I've understood what you're after, which probably isn't the case. A good communicator, I am not. :|

Best of luck with this nasty problem!

oneMeVz
oneMeVz's picture
Offline
Joined: 06/08/2013
You're right, {M1×M2/R²} is

You're right, {M1×M2/R²} is only the force, and the spacecraft's mass even being small has some effect since it is multiplied. Although because the acceleration is the force divided by the mass, it's really cancelling the mass altogether from the equation. So I had the right equation, I just gave the wrong explanation for it.

Your energy-based system sounds interesting, but I do have a hard time understanding it witout anything to actually see.

I've also got the idea to help instead with the trrajectory is to find the elliptic orbit of the spacecraft and somehow determine the position at the certain time along the elliptic. I wish I could find more informative material on Kepler's Laws.

Syndicate content


forum | by Dr. Radut