Space Engineers

Space Engineers

Torpedo Turret
andersenman 15 Aug, 2024 @ 1:43pm
Quick & dirty walkthrough on how to add Vanilla+ homing
This walkthrough describes the creation of a local complementary mod, providing you with the function right now rather than for you having to wait for a mod to exist, finding it in the WS, downloading, etc.

Corollary, out of scope for this guide: How to create and publish a proper mod out of this, what values to tweak to meet gameplay expectations, how to add other weapon effects provided by Vanilla+, how to add this to a local or server-hosted multiplayer world, and so on.

This walkthrough is based on what I learned about V+ from Harbinger Ace's "Guided Vanilla Rockets (Vanilla+)" and from the mod code's comments.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3155672714
… and since HA also included very generous terms of use, I'll be using it as part of this guide. I'm sure there's a "proper" way as the Vanilla+ framework intended, but this walkthrough is meant to be quick and dirty, not proper, which is also why I'm posting it here rather than writing up an actual Guides-type guide.

Finally, this guide covers both the torpedo (for both the turret and the fixed launcher as this modifies the ammo, not the weapon) and the Hailstorm.

Disclaimer: I assume you know how to navigate within a Windows file system, how to deal with hidden folders, and how to avoid or rectify mistakes copying or editing text files. No backup, no pity. If you screw up, it's solely your fault. Whatever the outcome, given you are reading this, following this guide serves, if nothing else, as a learning experience.

That said, while it may look more daunting than it is if you're not used to modding or coding, it's really not complicated at all, especially if you can follow simple instructions. You're not expected to code the whole thing yourself, people like Nerd e1 have already done that for you. Just read and follow the steps.

Rundown
  1. Subscribe to Harbinger Ace's mod if you haven't already.
  2. Find the downloaded mod on your local storage. Take a copy and make it an "offline mod".
  3. Modify AmmoDefinitions.cs.
  4. Add mod to game.

1. Subscribe to mod
No comment.

2. Find the mod locally
  1. Find folder named 3155672714 in <your Steam Library folder>\steamapps\workshop\content\244850\ and copy it to %APPDATA%\SpaceEngineers\Mods.
  2. Rename the copy to something recognizable, like "For Elindis".
This leaves Harbinger Ace's mod still available for adding to a world, even in parallel with the one you are about to create.

3. Edit code
  1. Within the local copy, navigate to Data\Scripts\AAA_Vanilla+.
  2. Open AmmoDefinitions.cs with a plaintext editor of choice.

There are clear markers in this file what you may touch and what you may not touch.

Changes to make for the torpedo
Find text
namespace Ace_ScriptConfig_VanillaPlus_MissileGuided
Change to
namespace ForElindis_ScriptConfig_VanillaPlus_MissileGuided

Find text
// 200mm Guided Missile
Change to
// Elindis torpedo
(This is just a comment and does nothing except remind you what this code section is about. Comments are good, so, do it anyway.)

Find text
subtypeName = "Missile",
Change to
subtypeName = "ElindisTorpedo",
Exactly like that.

Changes to make for the Hailstorm missile
Prerequisite: What you did for the torpedo. Skip at your own responsibility. Or peril, whichever comes first.

Find text
// Elindis torpedo new VPFAmmoDefinition
(You edited this earlier.)

Also find text
}, // copy everything from 'new VPFAmmoDefinition' to
(Not reproducing the whole comment text here.)

Copy the whole section within and including these two text segments and paste what you copied into the next line, right before
/* * DON'T MODIFY ANYTHING BELOW THIS LINE */

In the pasted block find text
// Elindis torpedo
Change to
// Elindis Hailstorm
(Again, comments are good.)

In the pasted section find text
subtypeName = "ElindisTorpedo"
Change to
subtypeName = "HailstormMissile"
Exactly like that.

Finish the changes
Finally, save the file.

Do not touch any of the other files. No user-serviceable parts inside.

4. Add mod to game
  1. Launch game, create new game or load existing to edit its settings.
  2. Open Mods page, find mod "For Elindis". It'll have a house for an icon, rather than a Steam icon. Add this mod like any other.
  3. Also add Vanilla+ and the respective weapon mod(s) of Elindis', obviously. As for the load order: Didn't seem to matter for me.
  4. Save and enjoy.

Tuning
Without further adjustment, both the torpedo and the Hailstorm rockets turn as nimbly or sluggishly, respectively, as per Harbinger Ace's mod definition for the default vanilla rocket. Thankfully, the original author of the code or code template provided exemplary explanatory comments to the various knobs and dials to tune the performance to what you would expect of guided ammunition worth their names, so, use your skull pudding and figure it out. And if you break something: see disclaimer.


There, learned something today. I got it to work, so can you. Now go forth and blow ♥♥♥♥ up.


(Spotted a factual error or important oversight? Let me know.)
Last edited by andersenman; 31 Oct, 2024 @ 5:11am