Route Calculation
When navigating New Eden, you need to find the best route from system A to system B. The in-game route planner offers several options to customize your pathfinding:
- Route preference: shorter, safer, or less-secure.
- Security penalty: how strictly to apply the route preference.
If you want to implement this in your own application, there are two main approaches:
- Use ESI - Simple and straightforward, perfect for occasional route calculations.
- Write your own - More complex but preferred for applications that need to perform many route calculations.
This guide covers both approaches, starting with the simpler ESI option.
Using ESI
The simplest way to calculate routes is to use EVE's ESI /route route. This closely matches the in-game route planner behavior without requiring you to implement pathfinding algorithms.
The route accepts the following parameters (either via query-parameters or via request-body JSON):
- Origin system ID: System to start the route from.
- Destination system ID: System to end the route at.
- Route preference:
Shorter,Safer, orLessSecure. - Security penalty: Value controlling how strictly to apply the route preference.
This route returns a list of system IDs representing the calculated route.
Example Usage
import requests
def get_esi_route(origin_id, destination_id, route_type="Shorter", security_penalty=50):
url = f"https://esi.evetech.net/route/{origin_id}/{destination_id}"
params = {
"preference": route_type,
"security_penalty": security_penalty
}
response = requests.post(
url,
headers={
"X-Compatibility-Date": "2025-09-30",
"User-Agent": "esi-docs-example",
},
json=params,
)
if response.status_code == 200:
return response.json() # List of system IDs
else:
raise Exception(f"ESI route calculation failed: {response.status_code}: {response.json()}")
Writing Your Own
When implementing your own route calculation system, you need to understand how pathfinding algorithms work and how to model New Eden's transportation network.
Pathfinding Algorithms
Pathfinding algorithms treat New Eden as a graph where:
- Nodes represent solar systems.
- Edges represent connections between systems (stargates, wormholes, etc.).
The most common pathfinding algorithms are:
- Dijkstra's Algorithm: Guarantees finding the shortest path but can be slower for large graphs.
- A* Search: More efficient than Dijkstra when you have a good heuristic.
Most programming languages have libraries that implement these algorithms, or you can implement them yourself if you need more control over the behavior.
Important: A* Heuristic Considerations
A* requires a heuristic function (H-value) that estimates the remaining cost to reach the destination. This heuristic must never overestimate the actual cost, or A* won't guarantee finding the optimal route.
In New Eden, creating an accurate heuristic is challenging because:
- Systems may appear closer in 3D space but require longer routes due to gate connections.
- "Pocket space" regions can create misleading distance calculations.
Recommendation: Set the heuristic value to zero for A* in EVE route calculation. This effectively makes A* behave like Dijkstra's algorithm, ensuring optimal routes.
Reading Static Data
To build your route calculation system, you need data about systems, their connections, and their security status. This information is available in the Static Data export (SDE).
The systems and their security status are available in the mapSolarSystems table.
The static connections are available the mapStargates table.
To create a graph for pathfinding:
- Load all systems from
mapSolarSystemsto get the systems and their security status. - Load all stargates from
mapStargatesto get static connections between the systems. - Create bidirectional edges between connected systems.
- Add connections for Ansiblex (player-owned jump bridges), Wormholes, or Shipcasters.
This graph can then be used with Dijkstra's algorithm or A* to find optimal routes based on your chosen cost function.
Cost function
The cost function is the heart of your route calculation system. It determines how "expensive" each system transition is, influencing which route the algorithm will choose. EVE Online provides three distinct cost function modes, each with different security preferences.
The snippet below serves as example for how cost functions can be used.
import heapq
# This is a simplified implementation of a pathfinder algorithm, and only serves as example.
def find_path(origin_system, destination_system):
open_list = []
closed_list = {}
heapq.heappush(open_list, (0, None, origin_system))
while len(open_list) > 0:
current_cost, current_parent, current_system = heapq.heappop(open_list)
if current_system in closed_list:
# This system was already seen with a lower cost.
continue
closed_list[current_system] = current_parent
if current_system == destination_system:
return build_path(closed_list, current_system)
for neighbour in get_neighbours(current_system):
if neighbour in closed_list:
continue
# define cost_fn() to calculate the cost. There are examples below.
cost = current_cost + cost_fn(current_system, neighbour)
heapq.heappush(open_list, (cost, current_system, neighbour))
# Reverse-walk the closed list to find the shortest path.
def build_path(closed_list, current_system):
path = []
while current_system is not None:
path.append(current_system)
current_system = closed_list[current_system]
return path[::-1]
# Implement this yourself.
def get_neighbours(system):
raise NotImplementedError("get_neighbours is not implemented")
Shorter
This mode finds the route with the fewest jumps, regardless of system security status.
Safer
This mode prioritizes routes through high-security space, making longer routes acceptable if they avoid dangerous systems. The lower the "security penalty" (0-100, default of 50), the more likely the route will use low-security or null-security space.
import math
security_penalty = 50 # Value between 0 and 100. In-game uses a default value of 50.
sde_systems = {} # Implement this yourself. Load the systems from the SDE.
def cost_fn(from_system, to_system):
system_security = sde_systems[to_system]["securityStatus"]
penalty_cost = math.exp(0.15 * security_penalty)
if system_security <= 0.0:
return 2 * penalty_cost
elif system_security < 0.45:
return penalty_cost
else:
return 0.90
Less-Secure
This mode finds routes that prefers low-security space. The lower the "security penalty" (0-100, default of 50), the more likely the route will use high-security or null-security space.
import math
security_penalty = 50 # Value between 0 and 100. In-game uses a default value of 50.
sde_systems = {} # Implement this yourself. Load the systems from the SDE.
def cost_fn(from_system, to_system):
system_security = sde_systems[to_system]["securityStatus"]
penalty_cost = math.exp(0.15 * security_penalty)
if system_security <= 0.0:
return 2 * penalty_cost
elif system_security < 0.45:
return 0.90
else:
return penalty_cost