September 16, 2013

Inside Interplanetary: Targeting Problems

One of these must hit!
Hello. I'm Sasu and I like to write blogs.

Everyone's been very busy lately. We're working hard to get everything essential working without a hitch, but hitches keep coming along. Well, that's the reality of game development and there's not much you can do about that. Except maybe try to design things in a more detailed way.

So, today, let's try something a bit different. Instead of me just telling you about a game mechanic, I'll explain some problems we've come across in testing and some solutions we've formed up.

Let's discuss...

The Difficulty of Hitting Your Enemy

Well, I guess one did.
While testing Interplanetary, we've repeatedly come across a tiny problem with the Targeting System: it's darn difficult to hit your opponent! There are many things that play a part in this.

The planetary system is alive. Once you've set the trajectory and fired your cannon, time unfreezes and the planets start orbiting. It can be very difficult to foresee the movements of this slightly chaotic system. The biggest problem here is that the planets have a large influence on their surroundings, thanks to their...

Strong gravitational fields. Now, this is something that's almost impossible to predict for a mere human. Sure, you can account for a planet moving in front of your firing line, but can you calculate how exactly it affects your firing trajectory with its gravitational pull? We can't.

The planets are quite tiny. Small things are more difficult to hit than big things. Who knew?

When shooting a single railgun slug at your enemy planet, the odds of hitting it are very small, even if it happens to be right next to you. Building 15 railguns and firing them all makes it a bit easier, but managing to maintain such an artillery would be very difficult and time consuming in the final game, not to mention the bother of targeting each and every one of them every time. Something needs to change, but what?

We Have Some Ideas

A planetary prediction system would make it much easier see the future positions of planets. We have plans for a system that shows the player the "shadows" of the planets' upcoming positions, depending on the current trajectory drawn. The future trajectory of the railgun slug, affected by the position of the planets, would also be shown as a shadow.

Looks a bit complicated on paper.

The obvious problem with this solution would be that it takes away the element of predicting planet positions and may make the game way too easy to play. Of course, there would be extensive balancing done to accommodate for this feature.

Lowering the effect of gravitation would be an easier way to tackle the problem, but doing so would also make the game less interesting. In the earlier builds, you only really needed to worry about the gravity of the sun. Other planets' pull was much weaker, so it was possible to actually pull off very accurate attacks. This did take away some of the fun, since crazy, unexpected trajectories didn't happen.

We could just make the planets bigger. This might be the easiest solution and the least problematic for now. The biggest foreseeable problem with it is the change to the visual style. We're trying to keep a "realistic" feel to the game and to sort of keep it grounded. Bigger planets might give the planetary system a caricatured feel. Or, maybe we should give the planetary system more of a "war room"-feel. It doesn't look particularly realistic as it is, so maybe adding more elements to make it look more like a tactical representation of the real thing, would be a good idea.

Now, we simply pick one idea, implement it and test. Or maybe we should use them all? Or something completely different? What do you think?


  1. Plotting courses in gravitational fields so as to intersect a given target is hard enough when you have something like Kerbal's trajectory-adjuster (where you can tweak it back and forth before committing to a burn). I think doing it without some kind of help would feel like artificial difficulty unless you could fire lots of tracer shots and get some idea of whether a given angle works or not.

    I mean, this is kind of like playing worms/scorched earth where even if your enemy doesn't try to move, you have to recompute the firing solution anyways. I think you'd kind of want the player to be able to iterate on their firing solution to narrow it down.

    Maybe there's some number of 'instant' tracer shots you can use to test-fire?

    1. Excellent ideas!

      We do have to do some more testing with simpler tweaks, but this is absolutely something we'll keep in mind.

      The way it is at the moment does feel like artificial difficulty at first, but it's really not that bad while actually playing a bit more. There are so many other things to consider, such as different weapon types and the amount of shots fired.

  2. From what I gather you're predicting the path of the projectile based on where the planets are at launch time, not accounting in the projection for how they'll actually move? Or am I misunderstanding? If I had an alpha key I could get a better understanding ;)

    I've been slowly working on a hobby project for a while (too long) trying to teach myself orbital mechanics as I go. My project is about trade ships in a 2d version of our own solar system, and I intend to have AI ships. That's the hard part for me. Like Kerbal Space Program I've been using the patched-conic approximation because full N-body simulation is hard/impossible to predict without simulating ahead the whole system to plot the path an object will take, and that gets very expensive.

    For my ships trajectory I had wanted to have full n-body simulation and gradual acceleration but achievablity has had me pull back to patched-conic and 2-body, as reliable arrival at destination is more important for me than nice gradual changes in orbits. Missing is a bigger deal for a ship with crew than it is for ordinance.

    I got some help online in predicting encounters with the spheres of influence of different objects, as it helps to know if the moon is going to interfere while leaving earth. No idea if it's something that would be of any use to your project but this guys answer worked for me and I like sharing information with cool projects.

  3. Having played the greenlight alpha version, I think that the targeting system is just too tedious to use for firing multiple shots per turn.

    My idea for improvement would be replacing the "firing angle and velocity" type control with a "target point and velocity" system. As the targets are always other planets that move on a known simple path, the player should be able to select the path intersection between the fired projectile and the target planet simply by clicking on the view. The plus side of this is that it the challenge of estimating the planet's movement and affect of the gravitation pull still stays, but the targeting procedure would become much faster and easier. Currently you can imagine the trajectory you want, but it takes quite some time to find the correct velocity and angle combination that comes even close.

    Of course this will probably need some advanced mathematics to solve the firing angle so that the intersection happens, and in many cases there won't be a solution. When a solution is found, it likely isn't unique, and that is where the firing velocity adjustment comes into play. Maybe you could use numerical, iterative approach that tries to find the closest match within the two-parameter problem space.

    If you want to increase the challenge even further, add variation to the planet's orbital planes. An inhabited moon on a polar orbit of a gas giant would be extremely hard to hit, balancing for it's limited space and resources! ;D

    In any case you should add a clear marker of the selected weapon's possible firing angle, the small green cone you currently have simply doesn't cut it.


    1. Come to think of it, you will need to implement a firing solution calculator for the AI players anyway. Probably won't be an easy task, so better get to it then!

  4. Somehow, the current firing mode is an emersion breaker. I know it aides playability, but I am always asking myself how a civilisation incapable of space travel can get hold of such highly detailed 3d models of its solar system. I would like to have a targeting view inspired by the sketches shown on the current "research button", and the firing shown in the 3d model.