Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Hyperspace Routes  (Read 2495 times)

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Hyperspace Routes
« on: July 23, 2018, 06:26:44 PM »

I think AI fleets can be taught to navigate hyperspace intelligently. The trick is to make a cheat sheet for them. Basically: generate a network of routes for AI (and players too) to use, then generate the hyperspace terrain from that network.

I believe this could encourage exploration, make routine travel more interesting, and more benefits besides. Most importantly: this would tie hyperspace together in a way both people and the AI can understand and have meaningful interactions with.

If merchants always follow well-known routes, then both you and AI pirates can lie in wait for them. Conversely, patrols know where to patrol. If scavenger fleets know where the secret routes are, then you can follow them to learn faster paths across hyperspace. Say an invasion fleet is headed towards your colony; thanks to those secret paths you know you might be able to get there before them even if you're farther away. And that's just a few examples.

If you doubt there's room in hyperspace for this like I kinda did, the following mockup demonstrates otherwise:
Yellow = major route, orange = minor route, red = smuggler/secret route, green = in-constellation route.
Spoiler

[close]


Beacons Light the Way

The route network is made up of nodes connected by segments. At each node of a route is a beacon. Beacons point to connected beacons with short fade-away lines or a similar graphic. Beacons have uniform naming conventions to aid navigation based on their route's name and a word describing their place in the route, such as "Dark Pass Terminus", "Karakum-Sunda Midpoint", or "Dark Pass - Tharos-Sunda Junction".

I recommend three kinds of routes, from easiest to hardest to travel: major, minor, and secret. Major and minor routes use beacons that run transponder-on. Secret routes are narrow and patchy, and their "beacons" keep a low profile by going transponder-off. Naturally, major and minor route beacons don't point to connected secret route beacons.

Can beacons be destroyed/deactivated/whatever? I would've said no, but given the destructible objectives introduced in the pirates blog post I guess it's possible! In any case, routes are marked out on the player's map as they find beacons/beacon-points/whatever.

Generation and Routing
Spoiler
Points and Lines

To create the route network, first a random mesh of potential nodes and segments needs to be generated. Next, nodes and segments are removed in a radius around stars. Constellations also remove nodes and segments in a small to mid-sized oval around their center.

Each star creates direct (i.e. unmarked) connections with every star and potential node within a certain radius, and has a chance to create a direct connection with stars and potential nodes at a medium distance. Nodes directly connected to star groups become potential terminus nodes. Potential segments between terminus nodes that are connected to the same star group become direct connections.

Next, random segments are removed from the potential route mesh. Optionally, random pairs of nodes can become jump point nodes connected by a jump segment. All (or at least most) dead ends in the mesh are removed.

Finally the physical routes can be generated. Major routes first. A major route selects a random node and goes in two directions adding nodes to itself, following certain rules to avoid shenanigans. One shenanigan that might be acceptable is a circular route, but I'm not sure. Each direction stops once it hits a terminus node or a node that's part of another major route.

From there, the generator ensures all star groups are connected by at least minor routes, adds some more random minor routes, and makes the rest of the potential nodes and segments into secret routes. It might be acceptable for major routes to include minor nodes and segments sometimes. For the finish, route and beacon names are generated.


From Here to There

For the AI to use all this effectively, it needs to know the optimal paths between every star. Luckily, these calculations can be done in advance. However, a database of paths between every star and every other star would be very large (with 200 stars you are looking at about 20,000 paths - not counting alternate paths). More importantly, calculating 20,000 paths could take a while when starting a game.

The same effect can be achieved with about 3,000 paths if each star group has a database of paths between all its stars and terminus nodes. This allows the route network to completely ignore the insides of the first and last star group for pre-calculated paths; they are attached as needed during gameplay.

To eliminate the need to calculate node by node over and over again, the route network can map out every hop. A hop is made up of the segments between two terminus/junction nodes. So hops know which star groups and/or other hops they are connected to, and they know their estimated travel time - modified by segment type. Major segments are treated as shorter than equal length minor segments, and minor as shorter than secret.

With the hop and star group data, the route network can easily calculate several optimum and near-optimum paths (some including secret routes, some not) between every star group. In addition, all this information can be used during gameplay to quickly calculate an efficient path when a player orders a course to a random point.

During gameplay, when a fleet wants to go to from one star to a star in a different star group, all this stuff comes together like this:
    The course plotter...
    - looks up the paths between the two star groups and selects one,
    - looks up the path inside the initial star group from the starting star to the first route node,
    - looks up the path inside the other star group from the last route node to the destination star,
    - and passes the complete course back to the fleet.
[close]


In the end, all a traveling AI fleet has to do would remain "fly in a series of straight lines". But with routes the lines are varied and meaningful.
« Last Edit: July 23, 2018, 06:40:56 PM by SafariJohn »
Logged

MesoTroniK

  • Admiral
  • *****
  • Posts: 1731
  • I am going to destroy your ships
    • View Profile
Re: Hyperspace Routes
« Reply #1 on: July 23, 2018, 07:01:14 PM »

I think this idea has a good number of merits (AI being less stupid for one), and also a few issues. I want to think about this more but the main issue I see is this.



Locations like that, which are important singular routes between two large scale points of interest would end up as never ending warzones / death traps.

Igncom1

  • Admiral
  • *****
  • Posts: 1496
    • View Profile
Re: Hyperspace Routes
« Reply #2 on: July 23, 2018, 08:14:26 PM »

But hyperspace is already a never ending warzone? I constantly find it stuffed full of pirates attacking everything in sight. I am 80% sure that they are allowed to spawn out there.

Cool idea also.
Logged
Sunders are the best ship in the game.

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Hyperspace Routes
« Reply #3 on: July 23, 2018, 08:42:23 PM »

Locations like that, which are important singular routes between two large scale points of interest would end up as never ending warzones / death traps.

I don't think this would happen in more than one or two spots per game, and even then it seems like more of a feature than a bug, but if it is a problem there's already the built in counter of secondary and tertiary paths.

If that's not enough I think it would be easy enough to implement a "warzone" event to alert the player and force new AI fleets to use different paths.
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Hyperspace Routes
« Reply #4 on: July 23, 2018, 11:39:31 PM »

I tried to suggest something somewhat similar here:
http://fractalsoftworks.com/forum/index.php?topic=13377.0
Although in this case it was as a mean to connect hubs deep in hyperspace to the core worlds, but Alex didn't seemed too enthousiastic about that part sadly...

Also to me "death alleys" are very interesting gameplay wise, with new missions becoming possible, the like of: "intercept a convoy", "escort a convoy", "blocade that route for X faction", "clear pirate from Y tradelane" etc.
Logged
 

MesoTroniK

  • Admiral
  • *****
  • Posts: 1731
  • I am going to destroy your ships
    • View Profile
Re: Hyperspace Routes
« Reply #5 on: July 24, 2018, 02:03:11 AM »

Well, I agree a Death Alley is in fact interesting.

But the problem is more that I see that such a location would have virtually zero chance of a NPC fleet passing through without being intercepted every single time. I think that would be too binary.

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Hyperspace Routes
« Reply #6 on: July 24, 2018, 02:14:05 AM »

I don't know, following fleets would be able to pass while the pirates are busy fighting the first one.
Logged
 

Lorant

  • Ensign
  • *
  • Posts: 26
    • View Profile
Re: Hyperspace Routes
« Reply #7 on: July 29, 2018, 11:17:23 PM »

definitely into adding more geography to hyperspace!
Logged