Jump to content

[WIP] Mass Driver Parts and Plugin, request for modeling help!


PeterDolan

Recommended Posts

Oh, and GitHub handle Lo-FiOrbitalScience

Great, I added you to the github account. Let me know if you have any trouble, but please feel free to start updating the models and part files there.

I highly recommend the github desktop software, which makes it really easy to copy the repository to your local machine. Then, you can edit the files right where they're downloaded, create a commit with your changes, and upload the commit back to github.

Link to comment
Share on other sites

Sweet, glad you like it! I have some ideas for a base, capacitors, batteries etc. I'll crack on and set a few up. If we can find someone who likes texturing, I'll get all the UVW-unwrapping ready too.

Nice! Do you think it makes sense to introduce a new resource to represent capacitance? It's a little unrealistic to say that the existing batteries both hold charge very well (infinitely well, in fact) and can also discharge instantly. We could introduce capacitors which would be able to hold a huge amount of charge and discharge instantly, but rapidly lose charge if left alone. Then, you would need to include capacitors in the structure, and not just attach an interstellar mod reactor + generator.

The collision mesh is set up like that deliberately, it's to do with the way KSP handles them. They have to be convex, so a U shape is a no-no. If you try to make the rails part of the collider, you end up with a massive cheese wedge shape with the space in between the rails part of the collider and wouldn't be able to dock. However, I can make separate colliders for the rails which will work in game, though we need to be careful the payloads don't hit them! I wonder if this might not be better handled by scripting a force pushing the payload into the center of the rails, though... would work much better, and actually more realistic.

Ok, that makes sense. Let's leave collisions with the rails alone for now, then. We'll see if it starts to feel weird. I'm still just getting my feet wet with the programming in KSP, so I'm not sure if I can apply a force to a ship that's brought near (other than the existing docking port force), but I'll see if I can make that happen.

I'm working on a wheel pack at the moment. I've pretty much solved the weird issues the stock wheels have, but I want to make the suspension spring rates adjustable in-game for different gravity. I know it's possible, as it's just a property of the WheelCollider, but I'm struggling getting my head around Unity scripting. I also have a cunning idea for a levitation platform! If I send you the models and a Unity scene with wheel rigged, could you have a look? Would be brilliant to have it as a tweakable, but a little menu gui or just assigning a couple of keys would be a great start.

I'd be happy to take a look, but I'm just getting my feet wet with KSP and don't know anything about unity scripting either, so no promises :) You're talking about part animation, right? It would be fun to be able to do that both for the wheels and for the mass driver, so by all means send it over!

Link to comment
Share on other sites

I need to take a look at the interstellar mod to see what they're doing. Agreed this this would take a deal more charge than one of the normal batteries! So maybe some kind of battery that can store a whopping charge but loses quickly over time like you say might be a good way to go.

Cheers, I'll put some bits in GitHub. Not quite - the animation is actually really easy. The wheelcollider physics object has various properties which can be set up in inspector or changed via script in game. This is used for running over different surfaces and changing the grip property, for example. Did you not have to write some code for calculations for the relay?

Link to comment
Share on other sites

Ah, I see what you mean now. Yes, I've been writing code in C# to control the properties and actions of the parts, applying forces et al. I thought you meant some kind of animation scripting. Absolutely, can you point me to where you're working on the wheels? Is there a different forum thread for that?

Link to comment
Share on other sites

I've not even started a thread yet, I just got so fed up with having weird behaving wheels I decided to take matters into my own hands! Uploading to git now. if you import the dae and texture, then load the .unity scene, you'll find a tree of parts . expand WheelMed, suspensionNeutralPoint, steering, then you'll find the wheelCollider physics object. Unity docs are here for quick ref: http://docs.unity3d.com/ScriptReference/WheelCollider.html

I'd like to be able to affect the wheelCollider.SuspensionSpring.Spring property. At the moment, I can't even get a script to write "hello world" to the log, so I'm a little miffed. If you can point me in the right direction I'd be most grateful!

Link to comment
Share on other sites

Have you guys seen the capacitors from near future propulsion? Sounds pretty similar to your needs (though they are a bit unrealistic). On that note, would it be much trouble to include a configuration designed to work with the near future reactors instead of interstellar? Near future uses large amounts of electric charge instead of megajoules, and there's a discrepancy between how much energy the two mods assign to electric charge.

And good call on disabling recoil only on landed vessels - who doesn't want mass driver propulsion?

Link to comment
Share on other sites

Ah interesting, yeah, I hadn't looked at the near future pack yet, but it looks like exactly what we're looking for. I'm planning at the moment to change the resources consumed from megajoules to electric charge, and to opportunistically consume megajoules when they're available. Then, if you really wanted to, you could actually set up 10,000 units of electric charge instead of 10 megajoules and be able to use the mass driver without the interstellar pack. Activating the driver would consume megajoules if they were present, but would fall back to electric charge for whatever megajoules didn't supply.

I've updated the code to apply a recoil force when the ship is not landed. Specifically, I calculate the total amount of force that will be applied by the mass driver, then

* if the vessel is landed, apply all of the force to the part connected to the mass driver, or

* if the vessel is not landed, apply half of the force to the part connected to the mass driver, and half of the force in the opposite direction to the mass driver part itself.

lo-fi, I'm getting a warning when the mass driver part is loaded, "[Warning]: [Docking Node Module]: WARNING - No node transform found with name dockingNode". Does that indicate that there is an element missing in the part model that would indicate where the docking port node should be? I think this is preventing docking ports from attaching to the mass driver.

Link to comment
Share on other sites

I've updated the plugin, here are a few changes:

* Consumes ElectricCharge (10,000 units currently) or Megajoules (when present), so this no longer requires the Interstellar plugin to work, but will play nicely with it.

* Applies a recoil force to vessels which are not landed -- when flying or in space, the mass driver will apply half of its force to the payload, and half of its force to the mass driver itself. Now you can use it as a propulsion system! However, note that it very well may just completely destroy your ship. Attach it to a strong part, and use it only on very large vessels!

Link to comment
Share on other sites

Awesome!!! Quick question: How do we "reload" the mass driver? I tried to redock onto it, but no go.

Fun, isn't it! That's an interesting one, though. Because it's based on a docking port, you can stack any part you like on it in the VAB because it has stack nodes defined. However, in-game, you can only 'dock' another port to it. For the moment, if you want to reload, add a port to the part you want to fire. This will require some code wrangling to fix I'm afraid.

Link to comment
Share on other sites

I've updated the plugin, here are a few changes:

* Consumes ElectricCharge (10,000 units currently) or Megajoules (when present), so this no longer requires the Interstellar plugin to work, but will play nicely with it.

* Applies a recoil force to vessels which are not landed -- when flying or in space, the mass driver will apply half of its force to the payload, and half of its force to the mass driver itself. Now you can use it as a propulsion system! However, note that it very well may just completely destroy your ship. Attach it to a strong part, and use it only on very large vessels!

Excellent! :)

I'll try and get some other parts cranked out over the week. Could really do with someone that likes making textures. Applying them to the model I can do, I'm just useless at making the darn things. Will supply unwrap templates! Anyone?

Link to comment
Share on other sites

Fun, isn't it! That's an interesting one, though. Because it's based on a docking port, you can stack any part you like on it in the VAB because it has stack nodes defined. However, in-game, you can only 'dock' another port to it. For the moment, if you want to reload, add a port to the part you want to fire. This will require some code wrangling to fix I'm afraid.

That's how I intend it to work -- can only reattach parts using docking ports. It's more realistic (typically mass driver payloads are loaded into a special container which completes the circuit between the rails) and it's much simpler.

lo-fi, on that topic, can we include the existing docking port models and textures in the mass driver rail model, to make it obvious that they are meant to connect? Ultimately, I would like to have a version of the rails for each version of the stock docking ports.

Link to comment
Share on other sites

Ah, I see! No, but I can recreate enough that it looks recognisable as a docking port type thing. Textures I'm not sure about, have to look into that. Though, again, can be recreated. If you want, I'll set up part.cfg for the three different sizes? I just went with the biggest because, well, Jeb insisted! Just a rescaleFactor = line change in the part.cfg.

I was thinking about the container idea myself, I think that would be really cool!

Link to comment
Share on other sites

I think that rescaling would be convenient, but we actually need different part models for each different size, because the docking ports look different for the different sizes. The docking port module requires a size specification, and will only allow docking ports of that size to dock together. So, if you are using a driver that's sized for 1.25m parts, then you won't be able to dock a .625m docking port to it, nor a 2.5m docking port.

Using a common base model, rescaling it, and slapping a different docking port on it would be fine.

Also, would you mind trimming down the large base? Now that I've changed it to consume ElectricCharge, I think it will make sense to use the driver rails as a part that attaches to the end of a stack of batteries. I think the base would should be about 1/3 or 1/4 its current height. Imagine a stack of ten round 2.5m batteries with the mass driver rail attached to the end. Something like this: https://drive.google.com/file/d/0B0a7PNLYAdzQbGRYT0FxNU5qLVU/edit?usp=sharing

Thanks again so much for your help with the modeling!

Link to comment
Share on other sites

Haven't had a chance to try this out yet and I'm wondering how you control the speed of the projectile. Do you set the desired velocity an it adjusts the force based on mass of the payload, or do you set what force you want to impart on the payload? The ideal method I think is to set what speed you want to give the projectile and the mass driver will calculate if it has enough power, with the option of setting the amount of power you want to use directly. But maybe I'm getting ahead of myself. Anyway, I'm looking forward to playing with this thing!

Edit ^^^

There's a mod somewhere on the forums for a multi-size/universal docking port. It's a senior docking port that can connect to all 3 sizes. Just slap one of those one and you're good to go (assuming it works, haven't tried it.)

Link to comment
Share on other sites

I've been thinking about how to control the driver, and I think I like the idea of changing the amount of power discharged the best. I would display in some info fields a few parameters:

* Resistance of the rails (something that would be different for higher-tech mass drivers and at different temperatures)

* Efficiency of the driver (correlated with resistance, affects the amount of force put into the payload)

* Temperature of the rails (lower would reduce resistance, near absolute-zero they would be superconductive -- you would achieve this by attaching the liquid helium tanks from the interstellar mod)

* m/s^2 acceleration that will be applied to the payload

* estimated m/s delta-v that the payload will experience

and a button to increase and a button to decrease the amount of power the driver will consume. Perhaps a set of four, with which you can increase by +/- 1 Megajoule and +/1 100 Kilojoules (1000 and 100 electric charge units respectively)

What do you think? Anything you would change?

Link to comment
Share on other sites

I think that rescaling would be convenient, but we actually need different part models for each different size, because the docking ports look different for the different sizes. The docking port module requires a size specification, and will only allow docking ports of that size to dock together. So, if you are using a driver that's sized for 1.25m parts, then you won't be able to dock a .625m docking port to it, nor a 2.5m docking port.

Using a common base model, rescaling it, and slapping a different docking port on it would be fine.

Yeah, if you want the extra visual difference other than the size, no major drama.

Also, would you mind trimming down the large base? Now that I've changed it to consume ElectricCharge, I think it will make sense to use the driver rails as a part that attaches to the end of a stack of batteries. I think the base would should be about 1/3 or 1/4 its current height. Imagine a stack of ten round 2.5m batteries with the mass driver rail attached to the end. Something like this: https://drive.google.com/file/d/0B0a7PNLYAdzQbGRYT0FxNU5qLVU/edit?usp=sharing

Thanks again so much for your help with the modeling!

No problem there. I was tempted to use the flat parts as mounts for custom large capacity battery modules and heat sinks with stack nodes to fix them to, but I can lop the bottom off to make it purely vertical stack.

And you're very welcome, it's rather fun! Thanks for the coding pointers, feeling like I might actually get there!

Link to comment
Share on other sites

+/- 1 Megajoule and +/1 100 Kilojoules (1000 and 100 electric charge units respectively)

Herein lies the problem: interstellar has a different definition than near future of how many joules are in an electric charge unit, the last I checked. Interstellar defines 1 EC as 1 kilojoule while near future defines 1 EC as... Something else. I can't find that information for some reason. Forgive me if I'm mistaken and blabbering on about nothing but I remember reading about this incompatibility somewhere. Yeah I was talking nonsense, disregard.

On a happier note, this is what you guys want for the docking port size issue: http://forum.kerbalspaceprogram.com/threads/79128-0-23-5-AdaptiveDockingNode-1-4-Make-Your-Awesome-Docking-Port-Models-Universal!?highlight=universal+docking

Edited by pina_coladas
Link to comment
Share on other sites

I've updated the plugin. New features:

* Can adjust the power of the driver in increments of 1Mj

* Rail temperature affects the conductivity, which affects the force applied to the payload. You'll do best to wait until you're in Kerbin's shadow.

* Estimated payload acceleration and delta-V readouts in the part menu

* Updated model to lo-fi's latest copy, now a 1.25m part.

* Removed electric charge resource from the mass driver itself. Attach batteries yourself, please.

* Now consumes electric charge primarily, and will consume megajoules from the interstellar pack when they're available. So, you can use it without interstellar, just attach a bunch of batteries and some solar panels.

Edited by PeterDolan
Link to comment
Share on other sites

Nice! These models look much better than mine!

Wow, that's a pretty crazy bit of work there! Glad you like the models :)

Cheers for that link, pina_coladas, might well come in handy.

Link to comment
Share on other sites

I've updated the plugin. New features:

* Can adjust the power of the driver in increments of 1Mj

* Rail temperature affects the conductivity, which affects the force applied to the payload. You'll do best to wait until you're in Kerbin's shadow.

* Estimated payload acceleration and delta-V readouts in the part menu

* Updated model to lo-fi's latest copy, now a 1.25m part.

* Removed electric charge resource from the mass driver itself. Attach batteries yourself, please.

* Now consumes electric charge primarily, and will consume megajoules from the interstellar pack when they're available. So, you can use it without interstellar, just attach a bunch of batteries and some solar panels.

Missed this. All sounds good!

Realised I messed up the scale in the export - now fixed. Added docking ring mesh to the rails, split the bottom off. I've done the texture unwrap and made some crude textures, but have to rethink how I apply them. Will post to Git once I'm happier with it all. Any objections to me moving it into utility with all the other worky bits rather than structural? I keep thinking the reload has gone wrong and its not showing up! Of course, I'm looking in the wrong section...

Link to comment
Share on other sites

Oh yeah, it should definitely be in utility. Feel free to go crazy with updates to Github, make parts of different sizes, move them around, etc., anything you like! Just be sure to sync frequently so that we don't run into too many merge conflicts.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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...