Working out and idea for a game based on solar system flight. Assume the sun is at 0,0 and planets are slowly walking around a grid, so many squares from the sun (like, Mercury =3, and Venus=5 and Earth=9 (and Pluto, something like 285 or so)).
It would work very easily if, before you fly to another planet, you file a flight plan. This would take into account where you are starting and where you are going and set up a path of squares you need to move across before making it (using good old A2 +B2=C2 stuff). Once you start out, you are moving 1 square each day. Burn fuel and now it's 2 a day. But you need to flip and start decelerating before you get to your destination.
All fine and good. Again, you aren't running across a messy grid (with all those weird diagonals), you are moving along a path (determined by the location of planets on a grid).
My only problem I'm facing is ... electricity. I'm wanting that you need to swing out your solar panels to pick up power from the sun. The further away you are, the less well your gain is (past Jupiter, it's pretty much rubbish).
But lets say you are making the long haul from Uranus to Pluto, and they happen to be in conjunction (opposite sides of the sun). If setting up a flight path from, lets say, +200,0 to -300, 0 (with 500 path squares to cover) is there a way to determine how close EACH square of that path is to the sun? Because, in conjunction like that, you'll be swinging right past the sun and can get that critical power boost.
If I knew this, I could also know when you are in the asteroid belt (from your range to the sun). But I need to know if there is some calculation to know how far each path square is from the 0,0 center.
On this hinges everything.
(and Pluto, something like 285 or so)
I thought it would be more like 500 on that scale; but google says 355 (39.5 times farther than Earth)
need to know if there is some calculation to know how far each path square is from the 0,0 center.
You already know how to find a distance between two points using their (x,y) coords:
distance² = (x₁-x₂)² + (y₁-y₂)²
What you need here is probably distance², because the power generated by a solar cell is reduced according to distance squared from the sun. And with the sun at (0,0), the formula is even simpler: power gained per unit time is just your base power divided by (x²+y²).
Working out the average of all the squares they pass through in a day would be inaccurate; but probably close enough for a game
Trust me, even on that scale, Pluto was way far away. Generally you had to fly the entire game and get every fuel tank, air tank and power battery you could get to make the run. You'd accelerate steady off one of the inner planets, boosting hard and shaking your ship and body apart (if you took it slow, you took it longer and might not make it). Usually I'd be going 12+ squares a turn, just coasting along. That was when I'd tune my ship and try to heal my injuries from the high gees. Meanwhile, I'd have to figure the factorial of my deceleration to figure when I needed to flip and burn hard. And there was nothing worse than an engine failure on those last few burns to not have you slip right by and die just off Pluto.
While reading your response, it gave me the idea of how to do this. What I'll probably do is mock it up over the next few weeks and put a demo out there so people can fly the bare bones version (just flying, nothing else). Eventually I'll put in all the other things my old game had - gambling, bomb defusing, assassins, everything. So, coming soon...
One funny story about the game (this was from a decade ago). A friend and I were writing our various pieces. When it came time to actually do your mental and physical states, I combined them. I figured that if you were injured or going mad, the affect would be pretty much the same on your effectiveness. So why quibble about open wounds and mental disturbance?
Since you had your mental state to worry about - long burns and the emptiness of space would make morale problematic - I added things you could buy and take in your ship. Booze, drugs, a bible, video games, even pornography. Each would give you a boost using them if you "got the blues".
Then my friend called while playing the game over the weekend. Right as he was about to do a critical final burn to enter an orbit (he HAD to be a the controls), there was a solar flare. So, his choice was to hide in his shielded sleep bunk or stay at the controls and manage orbital entry. He chose the latter and got a good dose of radiation, which dropped his health/morale.
So he calls me up after this and tells me the story and says, "You know, I used smut to heal radiation burns. Who would have thought..."
The next day, I was splitting morale from health.