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: How Station Mechanics are Handled  (Read 9519 times)

Inventor Raccoon

  • Captain
  • ****
  • Posts: 451
  • Digging through trash for a hydroflux catalyst
    • View Profile
How Station Mechanics are Handled
« on: April 21, 2017, 10:01:08 AM »

Here's pretty much everything you need to know to code a station that'll function in combat, or make multi-part ships in Starsector 0.8.1:

Station Bases (the main bit where everything else is stuck on)
Spoiler
- The station base is a normal ship with its own .ship file. It'll usually be defined as a capital ship, but you can go smaller.
- The base has its own sprite, where you should make only the base, without any modules.
- It gets its own row in the ship_data.csv, where you can put in values for every column you'd use for a normal movable ship.
- You'll want to put "STATION" in its tags - that's what'll tell the game that it's a station, prevent it from being controlled, and make the AI stop moving.
- The STATION tag also makes it so that a station will already be on the battlefield when combat begins, instead of having to be manually deployed.
- You can put in campaign stats like maintenance, storage capacity and burn speed if you want to have your station be in a campaign fleet, or put them at 0 if you want.
- You can blank out the columns for peak performance time and CR loss per second, which you should probably do to prevent it from being outlasted.
- In the .ship file, put a LARGE HARDPOINT mount with the type as STATION_MODULE. This'll be where your modules will go. Give them normal weapon slot names. Give them an arc of 0, it doesn't matter, doesn't do anything. Changing the angle also changes the angle at which the module is facing, otherwise it'll point straight forwards.
- There are three hullmods made for station bases - Vast Bulk (vastbulk) which makes the station base invincible, Axial Rotation (axialrotation) which makes it spin to the right, and Targetting Supercomputer (supercomputer) which gives it +200% normal weapon range and +60% PD weapon range. Add these as built-in hullmods if you want them, but they aren't necessary.
- If you give your station base Vast Bulk, it'll die when all modules with ordnance points are disabled or destroyed. If it doesn't, the base will also have to be destroyed to kill the station.
- The speed that a station rotates at is dependent on the base's maximum turn speed, which it will always turn at.
- If you want your station base to have weapons that aren't part of a module, put those on as normal. Put on the optional hullmod Targetting Supercomputer (supercomputer) which gives it +200% normal weapon range and +60% PD weapon range, to prevent if from being outranged.
[close]

Station Modules (the extra parts that go onto the base)
Spoiler
- Modules are also their own separate ships. Usually defined as a frigate, but you can go bigger if you want to.
- Setting the size higher than "frigate" can make annoying whiteouts when the module is destroyed.
- Modules have sprites separate to the base. Make them just like normal ship sprites - pointing upwards. You can adjust their angle by changing the angle of the relevant weapon mount in the base's .ship file.
- They get their own row in the .csv, where you can fill out everything as normal.
- Campaign stats don't affect anything when put on a module - put them on the base, instead. Just set them as 0 for the module.
- Modules contribute their mass to the mass of the entire station.
- The module will appear with its center of mass where the relevant STATION_MODULE hardpoint is on the base.
- There are a few hullmods made for modules - Targetting Supercomputer (supercomputer) outlined in the previous section which increases range, Always Detaches (always_detaches) and Never Detaches (never_detaches) which either force a module to pop off the base after being disabled, or force it to stay attached. Otherwise, it'll pick a random option on death.
- Reduced Explosion (reduced_explosion) is a hullmod that reduces a ship's death explosion range and damage greatly, for use on modules where you don't want one module's destruction to damage other modules. Leave it off if you want to have important modules destroy nearby minor modules when disabled.
[close]

Variant Files (and other miscellaneous things)
Spoiler
- Station bases have variant files as normal. Assign weapon groups as you would for a normal ship, but also add in the slots for the modules. Just put in the slot name and instead of a weapon, put in the name of the module's .variant file. They won't appear in the weapon group in-game, so it doesn't matter what group they're in.
- Station modules also have normal variant files. Nothing special.

- Stations can be refit if they make their way into a player's fleet. You can refit any module that has ordnance points. Both the base and each module have separate ordnance point limits, capacitors, vents and hullmods. If the base or any module has a d-mod, the d-mod(s) can be restored separately for each part by selecting it and clicking Restore like you would restore a normal ship.
- Stations can be crewed by an officer, who will grant their bonuses to the base and all of the modules.

- Stations can be assigned roles in a .faction file as normal and they'll spawn as you'd expect, but you can use scripting to call on them when you want. Salvagable objects can have a chance to spawn a station when you try to salvage them - check out data/campaign/procgen/salvage_entity_gen_data.csv for an example.
- If a station is assigned a role in a .faction file, they will appear in markets, with every module that the variant listed would normally have. All the modules will have empty weapon slots except for built-ins.

- In dev mode, you can hold control and click on modules to take control of them.
[close]

Modular Ships (non-stations with station modules)
Spoiler
- You can set up your modular ship as normal.
- The main part of the ship has its own sprite, and each module has its own sprite, just like a station.
- Everything in ship_data.csv can be set up just like a normal ship, but add "SHIP_WITH_MODULES" to its tags, instead of STATION.
- Otherwise, everything is the exact same as making a station. Set up the STATION_MODULE large hardpoints, make modules just like for a normal station, slot them into the .variant file of the ship, and you're good to go!
- While the ship will be able to be controlled as normal, the modules are controlled by the AI.
- Modules can have their own shields. Make an invisible module, give it a shield, set the shield radius slightly higher or lower than the parent ship's radius, and have fun!
- Modules can also have their own ship systems! This isn't terribly useful with most vanilla ship systems, but you can have fun with things like EMP generators, flare launchers, and targetted systems like Interdictor Array. The module will automatically use their systems as it sees fit.
[close]

Hopefully this is useful to modders who want to make their own battlestations and multi-part ships!
« Last Edit: June 05, 2017, 08:22:18 AM by InventorRaccoon »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: How Station Mechanics are Handled
« Reply #1 on: April 21, 2017, 11:10:49 AM »

*thumbs up* This is accurate and pretty comprehensive.
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 451
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: How Station Mechanics are Handled
« Reply #2 on: April 21, 2017, 12:36:02 PM »

*thumbs up* This is accurate and pretty comprehensive.
Thanks! I've actually managed to spawn in a modified Conquest, but with two shield generators attached to the sides. It works! It's cool.

One very important question: Adding the STATION flag to a ship allows it to have modules, but is there any way to do it without it automatically going into autopilot and pretending to be a station?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: How Station Mechanics are Handled
« Reply #3 on: April 21, 2017, 01:11:57 PM »

I'm pretty sure STATION isn't actually required to have modules - iirc, STATION triggers the "always deployed, always on autopilot" behavior.
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 451
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: How Station Mechanics are Handled
« Reply #4 on: April 21, 2017, 02:22:12 PM »

I'm pretty sure STATION isn't actually required to have modules - iirc, STATION triggers the "always deployed, always on autopilot" behavior.
Odd. The modules don't spawn if the tag isn't applied, but they do if it is. Maybe there's something more that has to be done for ships without the tag? I just stuck the module variant names into the module weapon slots in their own weapon group. The modules appear in the refit screen with the tag and without.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: How Station Mechanics are Handled
« Reply #5 on: April 21, 2017, 02:27:43 PM »

This looks like a bug, will take a look at it in the near future.
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 451
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: How Station Mechanics are Handled
« Reply #6 on: April 22, 2017, 04:52:07 PM »

I managed to make a working station myself, one that has campaign stats and could feasibly be used as a player's command ship. Turns out that Storm Needlers become extremely overpowered when you triple their range, however. They chew straight through shields and the AI can't handle the constant stream of fire, and even an Onslaught will die slowly to 1 Storm Needler and 2 Heavy Maulers.

Found another possible bug while doing so. Station modules can be refitted perfectly normally in the campaign and will keep their new weapons, but they will instantly revert to their assigned variant in the refit before doing a mission. Doesn't happen to the station base, that'll always keep any changes.
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 451
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: How Station Mechanics are Handled
« Reply #7 on: April 23, 2017, 01:42:48 PM »

I got non-stations to use modules. Here's 4 different examples of what you can do using only modules that produce frontal shields:

1.
Spoiler
An undershield, protecting your hull from damage if anything sneaks through.

When hit, this particular shield overloads immediately on taking a single hit, emitting long purple arcs to show this (an unintentional effect). After the overload subsides, the shield returns.
[close]
2.
Spoiler
A back-facing shield. Funnily enough, the placement of this invisible module makes Salamanders not even consider trying to hit the engines, they'll go straight for the front of this ship.
[close]
3.
Spoiler
A frontal shield on a phase ship. The shield does block fire while phased, and moves properly with the parent ship. A weird side effect is that it prevents you from normally unphasing - you'll have to vent.
[close]
4.
Spoiler
Broadside shields. Yep.
[close]

Lots of possibilities.
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: How Station Mechanics are Handled
« Reply #8 on: May 12, 2017, 12:09:38 AM »

I really wish broadside shields would be possible without this shenaigans.

How difficult would it be to add a new shield type "BRAODSIDE" that would add "two" (actually one) shields, one on each side.
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: How Station Mechanics are Handled
« Reply #9 on: May 13, 2017, 06:28:41 AM »


- Station spawning is handled like normal spawning, with a special category for each station type (each vanilla station has its own category, with just one entry). Not sure when or how it's used. You can additionally put stations into normal fleet categories, and they will spawn in fleets and markets. However, if a station spawns in a market, it will have no modules.

I don't see where it's defined.
Stations have ship entry, variant entry, but I can't find nothing else that defines them.
I thought there might be something in custom_entities, but I can't find anything there either.

So if I made a faction station, do I have to have a custom spawning script to place it in a system and for it to be interactable?
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 451
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: How Station Mechanics are Handled
« Reply #10 on: May 13, 2017, 08:20:34 AM »

I don't see where it's defined.
Stations have ship entry, variant entry, but I can't find nothing else that defines them.
I thought there might be something in custom_entities, but I can't find anything there either.

So if I made a faction station, do I have to have a custom spawning script to place it in a system and for it to be interactable?
Yes. Stations don't spawn normally, you'll to make a script to call for that category or something, I'm not a scripting expert myself.

You should probably look at how [REDACTED] spawn their station.
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: How Station Mechanics are Handled
« Reply #11 on: May 13, 2017, 12:22:34 PM »

Bummer. I though one could interact with stations that are present on the map. Attack them and stuff.
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 451
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: How Station Mechanics are Handled
« Reply #12 on: June 03, 2017, 12:15:27 PM »

Updated for readability and with the changes with 0.8.1!
Logged