Jump to content

Mother Development Thread


Bonus Eventus

Recommended Posts

Started my first steps into plugin development. Wanted to check my assumptions about IVA animations so posted this question in the plugin dev forum here:

If anyone has any insights please let me know.

 

@Table not at this time. I have ideas about Habs but nothing I'm ready to share. Been thinking about space hangars and factories a lot. I'm trying to decide whether the hangars should be modular or not. What I mean is, should the hangars be assembled in LKO or dependent on one building a factory in LKO first that can manufacture a huge part like the hangar. There's a third option where the hangar is designed as an all in one part that self deploys, allowing it to be shipped via a rocket in one go. (this option would not allow anything to be surface attached in the VAB. It would have to include docking ports, rcs, etc, because of it being animated)

EDIT:

Can't sleep, so I thought I'd post this update.

I learned a lot about the Part system in KSP this week, while I took my first steps into plugin dev. I have discovered that my assumptions were almost right. I need to do some testing, but module centrifuge looks possible at this point. 

A module in KSP is defined by the class in C# called PartModule. For instance a light in ksp has a module called ModuleLight which is derived from the PartModule class. In programing, this is called Inheritance. C# is an Object Oriented programing language that implements a style of inheritance called Classical Inheritance unlike say javascript which employs Pseudo-classical Inheritance. Inheritance is a deep subject, so I'm not going to go into detail here, but what's important to understand, in terms of modding KSP, is that Classes are Objects. Objects can have parents and children. Objects can also have Instances. Instances are basically clones of an Object. Still with me? Good.

The class Part defines what we all know and love parts. All parts in ksp are derived from the Part class. In C# the Part class defines an Object called Part. The Part object has a variable (variables hold data) called Modules. Modules is a child of Part. Part also has a method called AddModule. Methods are like subclasses. The AddModule method takes an argument, moduleName (which takes a datatype of string), defines a way to search for modules by name, and defines how to add modules to the Modules object (Modules is like a list of PartModule objects). Similarly to Modules there's another child object of the Part class called internalModel. And just like with AddModule there is a method of the Part class called AddInternalPart. The hierarchy looks like this:

Part

  • AddInternalPart
  • AddModule
  • internalModel
  • Modules

I want to write a custom PartModule called ModuleCentrifuge. This is how it looks in C# 

public class ModuleCentrifuge : PartModule
{
}

ModuleCentrifuge is a PartModule, so we know it will be eventually added to an instance of the Part class. The config file (cfg) which defines our instance of the Part class will also define an instance of ModuleCentrifuge, like so:

PART
{
	name = AwesomeCentrifugePart
	(lots of variables like mass and cost are defined here...)
	INTERNAL
	{
	  name = AwesomeCentrifugeInternalSpace
	}
	MODULE
	{
		name = ModuleCentrifuge
		(custom variables for our centrifuge module are defined here...)
	}
}

I already know I can rotate a part with a PartModule. We do this by accessing the Part class FindModelTransform class.

part.FindModelTransform(centrifugeTransformName).Rotate(0, rpm, 0);

What I'd like to do is rotate the internalModel at the same time. And it looks like we can! Remember, both PartModule and internalModel are children of the Part class object. I rotate the model transform by using the parent Part method FindModelTransform. As luck would have it Squad has given the internalModel class the same method!

part.internalModel.FindModelTransform(internalCentrifugeTransformName).Rotate(0, rpm , 0);

However, though i'm confidant I can find and rotate a gameobject transform from within the internalModel object, I have yet to test this hypothesis. It's very possible that this will do something undesired like rotate the mesh of the internalModel, but not the Kerbals in their seats or the internal camera you see out of. It's too early to tell. At least I've proven to myself that internalModel can be accessed by a PartModule. That would have been a huge setback otherwise. 

Edited by Bonus Eventus
Link to comment
Share on other sites

Looks like my assumptions were correct, I'm now able to rotate the exterior of the centrifuge test part and it's iva. Only problem is that the seat is not rotating in the same direction as internalModel. One way I think I could get around this is to define a separate parent transform for all of the kerbal seats. However, it's possible I don't have the transforms facing the correct direction. The procedural animation works in the vab and in flight. 

TODO: 

  • add resource consumption
  • add deployment animation
  • add context awareness so rotations don't happen when deploy animation is playing

Lnqn4zm.jpg

Edited by Bonus Eventus
Link to comment
Share on other sites

This is great. I want that centrifuge! There is a unexploited niche for massive ship in this game, without massive habitat there is no point for them at all. I will follow your stuff closely.

PS: If you want to name it Mother, then you have to make the Nostromo computer room, you have no choice realy.

Link to comment
Share on other sites

16 hours ago, RedParadize said:

Does it work with the overlay ?

Yep!

EDIT: Here's the latest test. Timewarp actually works really well. So far, so good. On to the deploy animation. Hopefully that will be pretty straight forward (yeah right).

 

Edited by Bonus Eventus
Link to comment
Share on other sites

Thats realy nice! Do you plan on having depoyable rigid centrifuge? 

Ever heard about the pilgrim observer? By the way, the one you have on display could be a Polygon Centrifuge. Yes, I do read atomic rocket!

Link to comment
Share on other sites

It's getting there. The reverse animation needs some work, for some reason it's not playing the animation in reverse but rather going to the first frame. Still I'm happy that I actually can animate the IVA, wasn't sure it would work. I was surprised to see that even the kerbal was scaled as a child of internal model. Since this is just a part made to test the code I didn't do a proper animation. Only thing left now is resource consumption, then more refinement and optimization.

 

Link to comment
Share on other sites

1 minute ago, Table said:

What do you think the centrifuge should look like?

IMO- I like the Hermes style centrifuge, also great work with that plugin man!

Thanks Man :D

I think I should mention that I plan on releasing the centrifuge plugin separately so that modders like @Badsector can make sweet IVAs for their mods. Mother will require the plugin, and include it with the install. As far as Mother's centrifuge, I'm partial to this one:

 Hegagonal_inflatable_space_station_1962.

However, I don't haven't really formed much of an opinion about it :wink:

 

Link to comment
Share on other sites

53 minutes ago, Bonus Eventus said:

Thanks Man :D

I think I should mention that I plan on releasing the centrifuge plugin separately so that modders like @Badsector can make sweet IVAs for their mods. Mother will require the plugin, and include it with the install. As far as Mother's centrifuge, I'm partial to this one:

 Hegagonal_inflatable_space_station_1962.

However, I don't haven't really formed much of an opinion about it :wink:

 

Well, I can help with that!

I think you can make the centrifuge a lot like the Hermes, which has an undeniably awesome centrifuge. So it can be identical to that, but the whole structure can fold up to fit within 3.75m fairings - each of the four sections expand out, and a flexible, pressurized tube extends out and unfolds rather like an oversized accordion from each section, and links to a transfer hole on each section, the structure of the centrifuge-shape-making tubes supported by a thin but incredibly strong collapsible frame. You can also include windows on the back, but they should be small, so as not to increase the risk of micrometeorites impacting the glass as the centrifuge spins, or they can be whatever size you see fit. There is also a counter-rotating flywheel section which has six boxy sections jutting out that section, each one containing tanks full of fuel for the rotation-engaging engine located on one of the centrifuge's sections which activates when it finishes deploying. Essentially, every time you reverse the rotation, this engine spins around and fires in the opposite direction.

So basically, I, for one, think the centrifuge should REALLY be like the one on the Hermes.

And I agree with @Table, Mr. Eventus, you really should make the centrifuge like the Hermes'!

Edited by Siphonophore
Link to comment
Share on other sites

It can be like the Hermes centrifuge, but way larger.

I don't think it should be inflatable, we're talking about motherships here man.

We can divide the centrifuge up into segments

Link to comment
Share on other sites

17 minutes ago, Bonus Eventus said:

The module doesn't allow that, and although I've thought about ways to achieve this, I'm not convinced that there's a performant way to achieve it.

Then that's fine, it's your mod anyways.

Hmm, the Hermes mod achieved this, how about just making it expand with hydraulics, like it extending out

Link to comment
Share on other sites

9 minutes ago, Table said:

Then that's fine, it's your mod anyways.

Hmm, the Hermes mod achieved this, how about just making it expand with hydraulics, like it extending out

That's an option. My point was to not get your hopes up, as far as putting a habitat together in orbit. Hermes mod does this with infernal robotics, however, you can of course make a centrifuge with infernal robotics right now with stock parts. Apparently infernal robotics replaces the physics joints between parts, stock physics joints don't allow rotation. However that's not a very performant way to make a centrifuge, considering how many physics calculations would have to be done per frame. If I were to do this, I would assign a unique node id to each attachment node of the parts which would attach to the centrifuge fly wheel, similar to how docking ports work. And when you dock these nodes together, instead of the parts attaching through physics joints, as in a normal docking situation, each part would have its main transform parented to the fly wheel. That way what was a collection of parts becomes one part. Only problem is, you would need a pretty robust persistence system to track all the possible types of combinations of parenting, and to make sure that when a game is loaded the part is parented correctly. However, I might be misunderstanding something, seeing as I'm very new to plugin development.

Link to comment
Share on other sites

21 hours ago, Bonus Eventus said:

That's an option. My point was to not get your hopes up, as far as putting a habitat together in orbit. Hermes mod does this with infernal robotics, however, you can of course make a centrifuge with infernal robotics right now with stock parts. Apparently infernal robotics replaces the physics joints between parts, stock physics joints don't allow rotation. However that's not a very performant way to make a centrifuge, considering how many physics calculations would have to be done per frame. If I were to do this, I would assign a unique node id to each attachment node of the parts which would attach to the centrifuge fly wheel, similar to how docking ports work. And when you dock these nodes together, instead of the parts attaching through physics joints, as in a normal docking situation, each part would have its main transform parented to the fly wheel. That way what was a collection of parts becomes one part. Only problem is, you would need a pretty robust persistence system to track all the possible types of combinations of parenting, and to make sure that when a game is loaded the part is parented correctly. However, I might be misunderstanding something, seeing as I'm very new to plugin development.

Thanks for the answer man, but keep up the good work! 

Link to comment
Share on other sites

Still working on resource consumption. This has ended up being the trickiest part, because the resource system is obscured as part of the core Squad code. There are methods exposed to the public for resource consumption, but I'm forced to develop my own module for this. I want this to feel like a stock part, and that means that when ec (or whichever resource a modder uses) runs out the part can't rotate. And when ec is present, the part can start turning again. I also want players to be able to see the resource requirements for the part in the vab/sph. But, whilst messing with code, I'm also doing research on rotating habitats. I plan on making several, so they progress in functionality as the tech tree progresses. 

Below are some neat rotating habitat designs I've found.

dnIBVeM.jpg

(Fig. 1) 1960's NASA design for a single launch centrifugal habitat.

 

 

 

52gr4Fx.jpg

(Fig. 2) NASA diagram explaining the problem with hexagonal centrifugal habitats and floorplans.

 

 

p5HvfXE.jpg

(Fig. 3) NASA 1969 rotating craft artificial gravity habitat concept.

 

 

0VOddhG.jpg

(Fig. 4) NASA space station concept model, 1966 (Notice the docked Gemini capsules)

 

 

gm7fpbP.jpg

(Fig. 5) 1980s NASA tethered artificial gravity hab concept.

 

 

 

Link to comment
Share on other sites

On 5/22/2016 at 0:33 PM, Bonus Eventus said:

Aerobraking / Aerocapture is a very useful maneuver when trying to get to planetary systems like Jool. I like using the new 5m heat shield for that very purpose. However, I think having a 9m and 18m variant would be really useful. Not sure it should inflate. Folding like an umbrella might be better.

http://orig02.deviantart.net/901a/f/2015/288/b/c/kronos_1___wip_4_by_macrebisz-d9d84j9.jpg

kronos_1___wip_4_by_macrebisz-d9d84j9.jp

 

Nasa folding heat shield concept

 

Looks a lot like what I've been cooking up for an Interstellar mission:

LKMH2pq.png

I'm very interested in seeing what this mod cooks up that I can redesign this ship to incorporate. (I've already used Kerbodyne Plus parts to get some of this into orbit)

Link to comment
Share on other sites

On 6/8/2016 at 4:27 PM, panarchist said:

Looks a lot like what I've been cooking up for an Interstellar mission:

LKMH2pq.png

I'm very interested in seeing what this mod cooks up that I can redesign this ship to incorporate. (I've already used Kerbodyne Plus parts to get some of this into orbit)

Awesome craft! Thanks for your interest :wink:

25 minutes ago, njmksr said:

Lookin' awesome! Can't wait for a release!

Happy to hear it, I'll do my best :)

Does anyone have any requests for specific fuel types they would like to see included, Argon or liquid Hydrogen for example? Post your needs here! I can't guarantee it will be in the first release, but if enough people want it I'll make it a priority!

Link to comment
Share on other sites

1 minute ago, Bonus Eventus said:

Does anyone have any requests for specific fuel types they would like to see included, Argon or liquid Hydrogen for example? Post your needs here! I can't guarantee it will be in the first release, but if enough people want it I'll make it a priority!

I find that sticking to LFO or Xenon works best, but Argon would be good if you don't want to do that.

Link to comment
Share on other sites

1 minute ago, njmksr said:

I find that sticking to LFO or Xenon works best, but Argon would be good if you don't want to do that.

LFO, Xenon, Monoprop will all be included, but I'll be using interstellar fuel switch to change tank setups using module manager. So, if you use real fuels or tac life support, my module manager patch will detect those mods and adjust the tank setups (that's the theory anyway).

So really what I'm wondering is what's lacking for people in terms of tanks and fuel types that are under represented? 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...