Asteroids 2

From Naevwiki
Jump to: navigation, search

This is a more in-depth article about asteroids, their implementation, and their consequences. Discussion available on the forums.


We assume that asteroids in the game are either local, finite bodies of asteroids, each with its own shape and properties, or system-wide asteroid fields that extent infinitely in all directions. See the original asteroids proposal for more information.

We further assume that contact with asteroids is harmful to most ships, though in varying degrees. However, this constitutes an important invalidation of another assumption that has always been true so far, namely that movement in space is unrestricted. While ships may of course always enter asteroid fields as they please, doing so is generally undesirable. In effect, asteroid fields present "terrain" in a system, something that was never there before (excepting the nebula, but this is a system-level phenomenon).

Let us look at some of the repercussions.

Routing for fleet AI and navigation

When fleets move through a system, they will move to their destination waypoint in a straight line. However, when that straight line is broken by an asteroid field, there is a need for the fleet to route around it, as plowing through it would almost certainly result in the loss of ships. Routing around obstacles is not a trivial problem to solve. In the case of asteroid fields, this is compounded by the possibility of a destination being inside an obstacle, in which case going around is not possible. The AI needs to have suitable fallback behavior to deal with these issues. The above applies not only to fleet AI, but to the autonav as well. When autonavigating to a jump point, the autonav should safely steer the player around asteroid fields. The same should be true for in-system navigation, except when the destination is actually inside an asteroid field. In systems that are filled with asteroids, the AI can go about its business normally, on the assumption that any ships in the system are capable of handling the asteroids.

The above assumes there are no safe lanes in the system. Safe lanes are assumed to always avoid obstacles, so the autonav can simply follow the existing navigation data when following these lanes.

Routing for missions

For missions that require the player to get to a destination within a time limit, such as the rush cargo missions, it becomes necessary to take asteroids into account. An algorithm to calculate the shortest fly distance from A to B without passing through any asteroid fields is required. The implication of this is that system geography must be loaded even when the player isn't in that system. It may also be necessary to find a route around an asteroid-filled system.

Combat AI

In combat, the AI should be careful not to fly into asteroid fields that pose a threat to its ship. Generally, the AI should attempt to stay out of any asteroid fields unless chasing the player, in which case it should still break off if the asteroid field is too dangerous for it. This may be hard to determine.


The passage into hyperspace currently involves rapid acceleration. Asteroids in the path of this acceleration may incur a swift and unexpected death, so while jumping ships should probably be invulnerable to asteroids. Alternatively, a new jump animation that does not involve the acceleration could also work.