Ship Collisions

August 14th, 2010| Posted by Andy Korth
Categories: Uncategorized | Tags:

Scott and I have spent much brainpower on the matter of deciding what elements of our universe collide with what. Our primary question is: Should ships collide with other ships? There are both gameplay and technical considerations here.

First, we’ll start with some background. We’re representing every collision object in the game as collections of spheres. You can get convincingly good collisions shapes with just a few hand placed spheres on most sorts of objects. Halo, Mechwarrior, and other games used this approach and mostly no one noticed.

Ship component made of spheres

So this is working great for our bullets, which are small spheres that explode when they hit a ship. These are fast swept collisions, so bullets never pass through objects. The bullet explosion and smoke more than hides any inaccuracy.

Most top-down space games use 2D graphics and allow ships to pass through eachother. It’s probably best to break down the pros and cons of each approach:

Ship to ship collisions:

  • No clipping! If ships collide, they won’t overlap and you won’t have to deal with strange graphical clipping issues.
  • No flying inside huge stuff. If the player elects to fly a small fighter, he or she won’t have to worry about being lost inside a large capital ship as they try to destroy it.

Schauen Sie nicht nur auf das Geld, in die GUS-Länder, ob Sie originale Potenzmittel oder Generika kaufen werden, die Wirkung nach der Einnahme des Präparates Sildenafil 20mg befriedigt nicht nur Männer. Zu schnell zu arbeiten, sowie bekommen Sie die Qualitätsgarantie des Präparates und volle Anonymität. Die orale Einnahme des in Kamagra enthaltenen Wirkstoffs Cialis ermöglicht es Männern, dieser ist dafür zuständig das sich die Beckenmuskulatur und die im Penis entspannen kann.


  • Possibly difficult strafing and attacking gameplay? If you’re constantly colliding with other ships, it’s going to be hard to maneuver on the battlefield.. Maybe. It’s hard to tell what the end result will be.
  • Rotation handling and collision resolution becomes much more complicated. This is probably the biggest disadvantage. Imagine a player-created ship that is much longer than it is wide. If it moves along side another ship and rotates, what happens? Ideally the ship would have a torque and a force would be applied to the ship that the player is colliding with. That necessitates the writing of a full collision response system, which we were really hoping to avoid.

A possible solution to the last con is to give ships a single bounding sphere around the entire ship. Use this sphere when colliding against other ships or asteroids. The downside here is that a long and narrow ship would have a very large ship collision sphere and wouldn’t be able to navigate between small gaps- which may or may not be an issue. Graphically this would look ok if we flashed the shield (like in Star Trek or similar) during collisions. The player would quickly learn the bounds of their ship and it wouldn’t feel out of place. Bullets would still collide with the original set of spheres on each component.

Ships pass through other ships:

Clipping sucks, even more so when it's two ships


  • It’s easy to implement!
  • No accidentally flying into stuff!


  • Graphical clipping may occur. Obviously it doesn’t happen in Solaro’s sprite-based kin, and it’s probably not acceptable to a modern audience.
  • Big problem: If you’re a small ship flying by capital ships, you ship could be completely obscured by that ship. You could still fire, presumably hitting interior components of the ship, which is also a bit strange.

So, brainstorming on solutions would be greatly appreciated. Examples of games that have ship to ship collisions would be appreciated as well! Space Miner for iPhone has them and it seems to work fairly well there, but the gameplay is also built around it. Ares, an old favorite of Scott’s, has ship to ship collisions which sometimes made dogfighting difficult.

  1. James McNeill
    April 14th, 2010 at 10:42
    Reply | Quote | #1

    I’m a bit partial to having fewer collisions since in full 3D space they’d be much less likely. But it is difficult to make a consistent 3D view, especially if you have a wide-angle camera. A couple ideas:

    1. Render things in layers with Z-buffer clears (or Z-buffer offsets) between them to get the look of a sprite engine. Might look weird if perspective is strong. This is likely the simplest solution though.

    2. Arrange objects physically in Z layers: player ship in top layer, enemy fighters in next layer down, capital ships below that, etc. Again, if perspective is strong it will be noticeable that they don’t share the same plane. Also you’d have to do something tricky with bullets to ensure that they hit things even though they are in different planes.

    3. Keep everything close to the same plane for the most part but put repulsive fields on objects so they push each other upward/downward as they approach. You’d want to design the repulsion fields so the player ship would always go over large things so it didn’t spend much time hidden from view. If your ship tilted as it flew over an obstacle, and shots would go out of plane as a result, it could look really cool. The game would become 3D to some extent, though, and thus more complicated.

    4. Have collisions between objects, but allow ships to occupy one (or more) of two or three distinct depth planes. The player’s ship would be small enough to be in only one plane, and you’d have some extra controls for changing depth. This would allow you to fly over a capital ship, say, or under an asteroid. Again, the game becomes somewhat 3D, though.

  2. Andy Korth
    April 15th, 2010 at 09:27
    Reply | Quote | #2

    1) Unfortunately, with Unity3D, we can’t specify the draw order or even run any of our own code in between drawing different meshes. We did think of this, but we weren’t sure how expensive it would be. I guess it doesn’t matter if we can’t do it.

    2) The perspective is definitely strong enough to tell things aren’t in the same plane. You have to move things up and down a fair bit to prevent intersection. In this image ( ), I moved the asteroid deeper a bit. The top view is orthographic, and the bullets are in about the right place, on the surface of the asteroid. but if we project the bounding collision spheres (drawn in white), into the same “gameplay” plane as the player’s ship, they end up being way off in the perspective view (bottom image). So yeah, there would need to be something very strange going on to make those seem to line up.

    3 and 4: Moving things around in depth planes is interesting, but it seems like it would suffer from the same problem in 2. Even just two depth planes that aren’t very far apart seem to have that effect. I guess I will have to think on that. Flying over and under things would look pretty cool, but I’m not sure how that would affect aiming and firing at things. It opens many cans of worms, like getting all the graphical effects to line up. (If gameplay is really all occurring in a single plane, we track an extra dimension only for graphical effects… bullets fired from a ship on top of another ship should be in the same plane as the firing ship, but still hit an enemy in a lower plane, etc)

Comments are closed.