new-frontiers-14 / frontier-station-14

A multiplayer game about paranoia and chaos on a space station. Remake of the cult-classic Space Station 13.
https://spacestation14.io
GNU Affero General Public License v3.0
87 stars 521 forks source link

Expedition FTL: avoid collisions on returning. #1862

Closed whatston3 closed 2 months ago

whatston3 commented 2 months ago

About the PR

Avoid collisions with stations and other grids when returning from expedition. While this should avoid stations without issue, anybody driving into the blue FTL circles will still cause an issue, and asteroid/wreck generation may still cause problems.

This code is mostly copied from the NfAdventureSystem, although changed to consider grids instead of stations. Could probably use a refactor.

With the parameters as-is on the time of writing, assuming 40 ships and shuttles with no overlap, the chance of finding a vacant position is ~86%: 40*pi*200^2 / (pi*3500^2 - pi*750^2). Repeating 20 times, this reduces to a ~5e-18 chance of success on placing a single ship. Feeling lucky?

Why / Balance

Ship collisions are rare, but unfortunate when they happen, and possibly round-ruining without intervention.

How to test

On the 2024-08-14-improve-exped-ftl-janky-testbench (diff here - GitHub), the shipyard console FTLs you to a random location on the map when pressing the "Cruise" button on the shuttle console (for any ship), with reduced spool up and transit time.

  1. Checkout 2024-08-14-improve-exped-ftl-janky-testbench.
  2. Press the Cruise button.
  3. Teleport to a random location.
  4. You should be at least 200 m from everything.
  5. Repeat 3-5 until satisfied.

Media

Breaking changes

Changelog

:cl: