Jump to content

[WIP] (1.9.1 - 1.11) TrekDrive by ShadowWorks v0.6w Phoenix


Recommended Posts

Introducing...

f65YQtF.png

yGj06ac.png (Source code is included in the download)
License:  Code and Configs are licensed under the GPL v3 license.

Change Log:
v0.6w - Phoenix Initial release:
--------------------------------
* Updated Code:
    * Added nacelle glow animation capability, giving a visual indicator of coil charge.
    * Fixed coil charge logic to allow charging a partially discharged coil
    * Fixed a logic issue with the Warp Field Generator code.  Now the "not enough charge" warning will only occur if the warp drive is active.
* Moved to LqdDeuterium and Antimatter from Community Resource Pack
* Added Phoenix Parts:
    * Phoenix Crew Cabin (no IVA currently, built-in RCS, no effects yet)
    * Phoenix SAS (contains Monopropellant and Electric Charge)
    * Phoenix Fuselage (contains LqdDeuterium and Antimatter)
    * Phoenix Nacelle (deployable warp nacelle)
    * Phoenix Warp Core/Warp Field Generator
    * Phoenix Main Thruster (matter-antimatter rocket engine)
    * Phoenix Vernier Thruster (matter-antimatter rocket engine)
    * Phoenix Fairing (to conceal the warp nacelles during launch)
    * Phoenix Interstage Decoupler
    * Phoenix Launcher First Stage
    * Phoenix Launcher Main Engine (Liquid Fuel Oxidizer engine)
* Added Phoenix Warp Ship Test craft.
* Added Community Resource Pack and Waterfall as hard dependencies (bundled)

Inspired by RoverDude's Standalone Alcubierre Warp Drive, this warp drive aspires to operate in a Star Trek-like manner requiring at least two types of parts to operate:  warp coils/nacelles and the heart of the drive, the warp core and warp field generator.  I have seen in other threads here where people were trying to figure out how to require the use of warp nacelles to get that Star Trek feel to their KSP warp drives, and that's what I set out to do with this, my first plugin mod.  Maybe a bit ambitious, but I think it turned out well.  Now, on to the details.

Technical Aspects:
The plugin includes three Part Modules:  SW_ModuleWarpCoil, SW_ModuleWarpCore, and SW_ModuleWarpGenerator.

SW_ModuleWarpCoil:  This module would typically be attached to a warp nacelle part, but could be added to any part for a design that perhaps doesn't use a nacelle, or similar structure.  Requires: Warp plasma, which is generated by a warp core part using SW_ModuleWarpCore.  Restrictions:  Cannot be added to the same part as the SW_ModuleWarpGenerator.  This is the restriction that requires at least two types of parts.

Example Config:
 

MODULE
	{
		name = SW_ModuleWarpCoil
		minWarpPlasma = 400		// Not used
		warpPlasmaConsumed = 5		// Amount of warp plasma consumed per second during charging and operation
		warpPlasmaNeeded = 250		// Amount of warp plasma needed to fully charge the warp coil
		cutoffThreshold = 2.000		// When the charge percentage drops below this percentage, the coil and drive cut off (1 - 100)
		coilEfficiency = 0.01		// Thermal efficiency of the coil (0 - 1)
		maxWarp = 2			// Maximum warp factor this coil can safely achieve
	}

SW_ModuleWarpCore:  A simple generator module that takes in deuterium (matter) and anti-deuterium (antimatter) to generate warp plasma and electric charge.  (Could be replaced with a stock ModuleGenerator I suppose, but it's included all the same).  Requires:  Deuterium and Anti-Deuterium.  Restrictions:  None hardcoded.

Example Config:
 

MODULE
	{
		name = SW_ModuleWarpCore
		minAntimatter = 0.05		// Minimum amount of anti-deuterium required to operate
		minMatter = 0.05			// Minimum amount of deuterium required to operate
		warpPlasmaProdRate = 10		// Amount of warp plasma generated per second
		ecProdRate = 100			// Amount of electric charge generated per second
	}

SW_ModuleWarpGenerator:  The heart of the warp drive that actually moves the ship at warp speeds.  Just like RoverDude's Standalone Alcubierre Warp Drive, the drive uses translation, not acceleration, to move the ship through space.  Also, like RoverDude's drive, I used a slightly modified version of his gravity braking code (RoverDude's source code including the GravityBrakes() function) so that ships will slow down when they near gravitational bodies.  Requires:  At least one part implementing SW_ModuleWarpCoil that cannot be the same part implementing SW_ModuleWarpGenerator.  This is what forces the requirement of multiple parts.  Restrictions:  All warp coils must be charged before the drive can be activated, and enough electric charge to run the drive is also necessary.  If either of these is not true the drive cannot activate, or will automatically disengage.

Example Config:
 

MODULE
	{
		name = SW_ModuleWarpGenerator
		maxWarp = 2			// Maximum warp factor this drive can attain
		minNacelles = 2			// Minimum number of nacelles required by the drive to operate (must be at least 1)
		electricityReq = 50.000		// Amount of electric charge that is required per second of warp operation
	}

NOTE:  Some part on the vessel should have a container for warp plasma.  In the included test parts the nacelles have their own warp plasma containers, but it can be on any part of the vessel.

Warp Speed:
The ship's warp velocity is computed using a simple cubic function, which was used for the original series and in Star Trek: Enterprise.  So,
velocity = (warp factor^3) * c

In my initial testing, I find that Warp 2 is  a good speed for traveling to the edge of the Kerbol System in a comfortable amount of time.  I haven't tested higher warp factors, but will install appropriate mods on my end to further test travel times with increasing warp factors before final release.

How to Use:
I have kept the operation of the drive entirely within the Part Action Windows (PAW) of each part.  Follow these steps to activate the drive.
Step 1:  Activate the Warp Core by clicking the "Warp Core Status" toggle
Step 2:  Charge the Warp Coil(s) by clicking "Charge Warp Coils" in the coil PAW
Step 3:  Once the coils are charged click "Check Ready Status" on the Warp Generator (combined with the Warp Core Test Article here).  The drive will not enter the "Ready" status until all the coils are charged, and will not do so if there are any other active Warp Generators.
Step 4:  Once the "Ready Status" reads "Ready", click "Engage Warp Drive" on the Warp Generator.  This will change from "Drive Inactive" to "Drive Engaged"

Once the drive is engaged, any throttle input will move the ship at warp speeds.  To return to non-warp operation, simply click the "Engage Warp Drive" toggle in the PAW to disengage the drive.  Current warp factor is determined as a percentage of the drive's maximum warp rating, based on the amount of throttle:  50% throttle is half of the maximum warp, 100% throttle is maximum warp.  E.g.  for a drive with a maximum warp of 2, 50% throttle will be Warp 1, and 100% throttle will be Warp 2.  The current warp factor is displayed in the Warp Generator's PAW

Step 5:  Once you have reached your target destination simply throttle to 0%, or use "x" to cut the throttle.  There is an "Orbit Mode" option in the Warp Generator PAW that defaults to "Easy", this places the vessel in as close to a circular orbit as possible when the throttle hits 0 after having been non-zero.  That is, it doesn't continually change the orbit while the drive is active, only if it had been moving the ship and then stopped.  If the Orbit Mode is toggled to "Realistic", it will simply use the vessel's velocity vector to determine the current orbit, in the same manner as RoverDude's Alcubierre drive.

Limitations:
I tried to implement some limitations to make the drive less "cheaty".  I took cues from Star Trek, particularly Star Trek: Enterprise, which dealt repeatedly with the limitations of the ship's warp drive.  In the show, most problems occurred with the plasma injectors, but I though trying to code some kind of simulation of the injectors would be cumbersome and place unnecessary computational overhead.  Other limitations that come to mind are the stability of the warp field, and the warp coil temperature.  I opted for warp coil temperature to place a limitation on time at maximum warp.

Warp Coil Temperature:  While the drive is active, and moving at warp speeds, to emulate the warp plasma cycling through the coils I have implemented an exponential function that increases the temperature of the warp coil part.  The smallest amount of heating occurs at low warp, while the maximum heating occurs at maximum warp. There is a built-in warp coil efficiency that can be used to aid in cooling.  The value in the config file is between 0 and 1, and the upper limit is enforced in the code to prevent config editing to make the coils cool themselves at high warp.  If a value greater than 1 is used in the config, the plugin randomly chooses an efficiency in the correct range.  So, you may get a decently efficient coil, or a really inefficient one.  This is also done per coil, so you could have one coil that is really efficient and one that is terrible, which could hamper your warp travel to keep one coil from overheating and exploding (the stock behavior).  The maxWarp parameter of the warp coil also plays a role in temperature calculation.  A ratio is taken of the active drive's maxWarp to the warp coil's maxWarp to further scale the exponential function.  If the warp coil's maxWarp is equal to the drive's, there is not scaling, if it is less, there is more heating, if it is greater it is less.  The reasoning is that if you have a warp coil rated for Warp 1, and try to push it to Warp 2, it would burn out much faster, but if it's the other way around, it would be able to handle the temperature better.

Warp Coil Discharged:  If the source of warp plasma runs out, or is shut off, the coils may completely discharge, if the user doesn't notice that warp plasma production has stopped.  If the coils completely discharge (or their charge goes below the threshold set in their config) the drive will automatically disengage and either be automatically placed in a nearly circular orbit (Easy orbit mode), or be in a realistic orbit based on the vessel velocity vector.

Running out of Electricity:  If there is not enough electric charge to run the Warp Field Generator, the drive will automatically disengage and enter an orbit based on the selected orbit mode.

Multiple Warp Generators?:  If there are multiple parts on the vessel that implement SW_ModuleWarpGenerator, only one may be active at a time.  If you try to activate a second warp generator when one is already active, it will not activate.  If you disengage the active drive, you may then activate another.

Current State:

The Phoenix warp ship is now playable (no IVA yet). The launcher is included.

The balance may not be the greatest, but it's playable.

Community Resource Pack and Waterfall are now hard dependencies.

Warp Coil charge animation is now implemented.

cwcax19.png

doC3C5G.png

UQsfwst.png

nBNu0aH.png

Edited by TheShadow1138
Updated for version 0.6w
Link to post
Share on other sites
6 minutes ago, TheShadow1138 said:

I added a link to RoverDude's source code, and the source code for my plugin is included in the download.

Thanks!

Link to post
Share on other sites
13 hours ago, lilnihilo said:

Hi! Very excited about this but how do I install it, and get it plugged in (files wise) so it show up in the game? 

After you download the .zip file, unpack it, if it didn't unpack automatically.  This will create a folder called "TrekDrive_by_ShadowWorks".  Inside folder there is a folder labeled "TrekDrive".  Copying this folder into your GameData folder is all you need to do to install the mod.  If you want to use the included Falcon warpship craft, it is in the folder labeled "Craft".  Simply copy the file "Falcon Warpship.craft" to one of your "Ships -> VAB" folders.  If you put it in the one in your main KSP install directory it will be available in all of your saves.  If you have a particular save (I would recommend a sandbox save), you can copy it into "saves -> (name of your save) -> Ships -> VAB".

That should get you up and running.

Link to post
Share on other sites
2 hours ago, TheShadow1138 said:

After you download the .zip file, unpack it, if it didn't unpack automatically.  This will create a folder called "TrekDrive_by_ShadowWorks".  Inside folder there is a folder labeled "TrekDrive".  Copying this folder into your GameData folder is all you need to do to install the mod.  If you want to use the included Falcon warpship craft, it is in the folder labeled "Craft".  Simply copy the file "Falcon Warpship.craft" to one of your "Ships -> VAB" folders.  If you put it in the one in your main KSP install directory it will be available in all of your saves.  If you have a particular save (I would recommend a sandbox save), you can copy it into "saves -> (name of your save) -> Ships -> VAB".

That should get you up and running.

Hey thanks for getting back to me! I've followed your advise to the letter but I'm still not seeing any new parts and the Falcon Warpship.craft can't load because it says the necessary parts are missing, Are there any dependancies or mods that it needs to work? 

Link to post
Share on other sites
4 hours ago, lilnihilo said:

Hey thanks for getting back to me! I've followed your advise to the letter but I'm still not seeing any new parts and the Falcon Warpship.craft can't load because it says the necessary parts are missing, Are there any dependancies or mods that it needs to work? 

The parts are copies, more or less, of stock parts:  FL-T200 Fuel Tank (warp coil/nacelle) and the Rockomax X200-16 Fuel Tank (warp core & warp generator).  As long as you have not removed the stock parts, then it should work.  Make sure that your directory structure looks like this:

KSP
    GameData
        Squad
        TrekDrive
             Parts
                 WarpCoilTest.cfg
                 WarpCoreTest.cfg
             Resources
                 Resrouces.cfg
             TrekDrive.dll
    KSP (.exe or .app)
    saves

Link to post
Share on other sites

nice warp drive....it is not as complicated and expensive as Intersteller and Roverdude one....Rovedude is harder than intersteller one in my opionion..this is much more balaced...Good work..Keep pit up! 

Link to post
Share on other sites
12 hours ago, kennyc222 said:

also ..how do i produce Anti Deuterium>? 

I don't currently have a way to produce deuterium or anti-deuterium, at least not as part of the plugin.  Since Star Trek was the guide, I didn't think about including a generator since most of the matter and anti-matter would be loaded on the ships when docked for resupply.  It shouldn't be difficult to use the stock generator module to generate anti-deuterium.

Link to post
Share on other sites
1 hour ago, TheShadow1138 said:

I don't currently have a way to produce deuterium or anti-deuterium, at least not as part of the plugin.  Since Star Trek was the guide, I didn't think about including a generator since most of the matter and anti-matter would be loaded on the ships when docked for resupply.  It shouldn't be difficult to use the stock generator module to generate anti-deuterium.

Would you make an RTG style generator i.e. always on filling up the tanks, or as part of the ISRU?

Peace.

Link to post
Share on other sites

yeah just using stock ISRU to produce  Anti Deuterium and  Deuterium as i have the tank for Deuterium from stock or Intersteller extended. 

May you jujst modify ISRU or make an RTG style generator?  What is the stock generator called? so I can find it myslef

thanks 

Kenny

Link to post
Share on other sites
2 hours ago, theJesuit said:

Would you make an RTG style generator i.e. always on filling up the tanks, or as part of the ISRU?

Peace.

 

25 minutes ago, kennyc222 said:

yeah just using stock ISRU to produce  Anti Deuterium and  Deuterium as i have the tank for Deuterium from stock or Intersteller extended. 

May you jujst modify ISRU or make an RTG style generator?  What is the stock generator called? so I can find it myslef

thanks 

Kenny

What I could do is introduce a new resource to go along with the Deuterium, Anti-Deuterium, and Warp Plasma called Interstellar Gas.  Then code into the warp coil code a collection function so that while the ship is moving outside atmosphere the nacelles collect interstellar gas, and then add a ModuleGenerator node to the config of one of the parts to convert Interstellar Gas to Anti-Deuterium.  This could sort of emulate the bussard collectors of the warp nacelles in Star Trek, although those are stated to be used to collect Deuterium.

Thinking about it some more, I guess I could just have them collect Deuterium and then convert Deuterium to Anti-Deuterium, or even just add a further electric charge requirement by simply adding the ModuleGenerator to use electric charge to create Anti-Deuterium.  I'll have to think about it and decide which is better.

Link to post
Share on other sites

thanks and take your time..otherwise there will be  no way to generate Anti- Deuterium (epecially for long-Haul Journey)

You may use a stock ISRU to convert  Interstellar Gas to Anti-Deuterium, which is essential for the warp.  just using some electricity to convert the gas. 

 

 

Link to post
Share on other sites
1 hour ago, kennyc222 said:

thanks and take your time..otherwise there will be  no way to generate Anti- Deuterium (epecially for long-Haul Journey)

You may use a stock ISRU to convert  Interstellar Gas to Anti-Deuterium, which is essential for the warp.  just using some electricity to convert the gas. 

 

 

You've definitely given me something to think about.  I hadn't considered the need for resource generation for long-haul travel, probably because of my testing within the Kerbol System, and thinking more in terms of Star Trek, where they're not stopping to collect fuel resources all that often.  But, it will definitely be something we'd have to think about for KSP, so I'll see what I settle on, but there'll be something there for sure.  Thanks for bringing this to my attention, 'cause it is pretty important.

Link to post
Share on other sites

Quick progress update on the Phoenix.  I have completed the UV unwrap and have begun the texturing progress with the basic color scheme of the crew cabin.  Still need to do the panel lines and other accents.  I'm not going for film accuracy, but more of a "what if the Phoenix had been built as part of an official, fully funded, program.

bGmPvwZ.png

I forgot to hide the untextured version of the RCS blocks, so ignore those untextured RCS.

Link to post
Share on other sites

@TheShadow1138 Impressive little operation you got going on here. :) Where resources are concerned, if I may, I'd highly recommend you simply use Antimatter (and preferrably LqdDeuterium, not Deuterium (gas)) for your propellant mix. These are defined in the CRP (Community Resource Pack).

"Anti-Deuterium" is basically a form of Hydrogen, which is, by my observation, typically the form of the Antimatter that gets used by anyone, so the need to define this new resource is actually very small. And by using CRP's Antimatter, ISRU doesn't need to get any more complicated, that is: You can quickly hop onto the backs of established ISRU and tank standards including:

  • Antimatter (and Deuterium) are made abundant at every fitting celestial (mainly gas giants and stars) in supported planet mods, by Rational Resources, a resource placement mod that uses stock mechanics.
  • Antimatter (and Deuterium) are also placed at several locations that make sense in the home system (by Space Dust for its own resource placement system, and which includes its own harvesting mechanics) and Space Dust is being adopted by planet packs as well.
  • Antimatter is already very widely used in KSP Interstellar, though, being placed by KSPI is an unknown to me. Soon enough, KSPI users will come knocking at your door and asking about compatibility. That's how things go.
  • With FFT or KSPI installed, you can add the tank behaviors where magnetic confinent EC cost must be paid or the tanks will explode.

Once you make this change, you need only arrange for an antimatter scoop (if and where this makes sense to you) and 1 or more large Antimatter tanks (I've heard that the ones in FFT are too small). You won't need to do a crazy thing like patch the stock RTG to trickle it out.

Edited by JadeOfMaar
Link to post
Share on other sites
3 hours ago, JadeOfMaar said:

@TheShadow1138 Impressive little operation you got going on here. :) Where resources are concerned, if I may, I'd highly recommend you simply use Antimatter (and preferrably LqdDeuterium, not Deuterium (gas)) for your propellant mix. These are defined in the CRP (Community Resource Pack).

"Anti-Deuterium" is basically a form of Hydrogen, which is, by my observation, typically the form of the Antimatter that gets used by anyone, so the need to define this new resource is actually very small. And by using CRP's Antimatter, ISRU doesn't need to get any more complicated, that is: You can quickly hop onto the backs of established ISRU and tank standards including:

  • Antimatter (and Deuterium) are made abundant at every fitting celestial (mainly gas giants and stars) in supported planet mods, by Rational Resources, a resource placement mod that uses stock mechanics.
  • Antimatter (and Deuterium) are also placed at several locations that make sense in the home system (by Space Dust for its own resource placement system, and which includes its own harvesting mechanics) and Space Dust is being adopted by planet packs as well.
  • Antimatter is already very widely used in KSP Interstellar, though, being placed by KSPI is an unknown to me. Soon enough, KSPI users will come knocking at your door and asking about compatibility. That's how things go.
  • With FFT or KSPI installed, you can add the tank behaviors where magnetic confinent EC cost must be paid or the tanks will explode.

Once you make this change, you need only arrange for an antimatter scoop (if and where this makes sense to you) and 1 or more large Antimatter tanks (I've heard that the ones in FFT are too small). You won't need to do a crazy thing like patch the stock RTG to trickle it out.

You make a lot of good points @JadeOfMaar.  I was doing my testing in a clean install and so needed to define them, and wasn't even thinking about the other mods which already add Deuterium and Antimatter to the game.  It does make far more sense to just bundle CRP with my mod instead of adding what will likely be a redundant resource definition for many users.  As you pointed out, this also allows for other implemented mechanics to be used for ISRU instead of reinventing the wheel

For gathering antimatter and deuterium I was planning on a simple (unrealistic) continuous trickle of deuterium as long as the ship is moving outside of atmosphere and just adding a ModuleResourceConverter to one of the parts to convert deuterium to antimatter.  I believe it's possible for my code to check if another mod is installed, though I'd imagine this would need to be done after all assemblies were loaded to ensure it doesn't miss one.  I could then allow or disallow this simple and unrealistic solution for those that don't have a mod which places deuterium and antimatter.  Though I suppose that may be a moot point since most users that will find good use for a warp drive probably have interstellar system packs installed and at least one of the mods you mentioned.

I really like the idea of being able to implement the scoop, which I assume is just a part module that could be added to a nacelle part, and the EC cost for antimatter confinement.  I will definitely look into this to simplify things for me, and add support for other mods that, as you said, some will come asking about in the future.  Thanks for the advice and information!

Link to post
Share on other sites

UPDATE:  I have gotten the Phoenix in-game, and gotten the plug-in to animate the glow of the nacelles to help give a visual indicator of warp coil charge levels.

Screenshots:
OhJhC8t.png
4W7GQhc.png

Once I get the Phoenix in a state where I feel it's balanced enough I'll do a development release so y'all can start playing around with the ship.

Going Forward:  Prior to full 1.0 release I would like to do the following:

Definite:

  • Change resources over to using LqdDeuterium and Antimatter from Community Resource Pack (Warp Plasma will be the only new resource added by TrekDrive)
  • Add support for KSPI-E to utilize the module added by that mod for antimatter storage tanks, requiring electric charge to contain the antimatter, else the tanks will detonate.  This also allows the use of the charged particle collector module to emulate the Bussard collectors.  Through a ModuleManager patch.
  • Complete IVA for the Phoenix
  • Waterfall plumes for the Phoenix's main and vernier thrusters
  • Pointers for part modders on the setup for nacelles for the charging animation to work properly.

Possible:

  • ModuleManager patch to add support for Far Future Technology antimatter tanks and collectors.
  • Transparent mesh to scroll a streaked star texture while at warp.  This isn't essential to me, and I want the mod to be easy for others to make parts for; so if I feel like it would be too complex to get to work well and be easily scalable I'm not gonna mess with it.
  • NX-01 Enterprise parts (maybe)
  • NCC-1701 USS Enterprise (outside chance) - If I do this it will likely be the version from Star Trek: Discovery, but I may change my mind on that.  As a side note, I know how some people feel about Discovery, but I really like the update to the Enterprise, bringing it more in line with the progression to the film version of the Enterprise.
Edited by TheShadow1138
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...