Jump to content

[WIP] Infernal Robotics - Next


Rudolf Meier

Recommended Posts

And, here it is MM patch to increase joint strenght, for anyone else who wants to fool around with it:

@PART[*]:HAS[@MODULE[ModuleIRServo_v3]]:NEEDS[MagicSmokeIndustries]:FINAL
{
	//@title ^= :$: *Modified Joint*:
	@factorForce *= 2
}

You can uncomment "@title" line, I have modified it on first run to see in game if I have changed anything at all. But, you may want to know if you have modified parts or default ones if you change things back and forth.
 

Link to comment
Share on other sites

we are working on a little update right now (small bug fixes, little improvements... things like that) and we will in the next version also support the newly introduced "axis action groups" (or what's the name of them?) of 1.7.1

right now the biggest effort goes into our new docking system for canadarm-like constructions

Link to comment
Share on other sites

Small request for next update. Mentioned this before, but noticed now again, while designing craft with FAR. Usually, whenever you reposition something in SPH/VAB, FAR recongnize it and re-do voxelization process for calculating lift, drag and volume cross section, whatever it need for proper work. Event is trigered automaticaly when it recognize animation change.

It work properly in flight, but in SPH/VAB it does not recognize movement of parts trough IR GUI groups. Every time you reposition something trough IR GUI, you need also to re-attach some other part on craft or move it slightly to re-trigger FAR voxel calculation. Would be nice it that FAR event is also called after IR GUI movement button is released after movement.

@dkavolis might have better info what FAR method should be apropriate to call for this.

Link to comment
Share on other sites

1 hour ago, kcs123 said:

Small request for next update. Mentioned this before, but noticed now again, while designing craft with FAR. Usually, whenever you reposition something in SPH/VAB, FAR recongnize it and re-do voxelization process for calculating lift, drag and volume cross section, whatever it need for proper work. Event is trigered automaticaly when it recognize animation change.

It work properly in flight, but in SPH/VAB it does not recognize movement of parts trough IR GUI groups. Every time you reposition something trough IR GUI, you need also to re-attach some other part on craft or move it slightly to re-trigger FAR voxel calculation. Would be nice it that FAR event is also called after IR GUI movement button is released after movement.

@dkavolis might have better info what FAR method should be apropriate to call for this.

it does call the same code like in flight... every 60 frames it does send an update command to FAR... that's how it always did it.

Link to comment
Share on other sites

26 minutes ago, Rudolf Meier said:

it does call the same code like in flight... every 60 frames it does send an update command to FAR... that's how it always did it.

Hmm, something does not work as intended then. I have attached wing on hinge and FAR properly updated COL (blue ball in SPH). Moved it trough IR GUI and COL didn't moved at all. Only when I grabed root part and moved whole craft around in SPH it updated it. It does not happen on latest WIP craft, it happening on all crafts.

Link to comment
Share on other sites

9 minutes ago, kcs123 said:

Hmm, something does not work as intended then. I have attached wing on hinge and FAR properly updated COL (blue ball in SPH). Moved it trough IR GUI and COL didn't moved at all. Only when I grabed root part and moved whole craft around in SPH it updated it. It does not happen on latest WIP craft, it happening on all crafts.

nope... I'm doing what they wanted... -> part.SendMessage("UpdateShapeWithAnims"); for every part that is affected... and it is called whenever a joint moves (by which command ever)... I've tested it right now

but I don't know what FAR does with this... that's something I didn't test

Link to comment
Share on other sites

5 hours ago, Rudolf Meier said:

nope... I'm doing what they wanted... -> part.SendMessage("UpdateShapeWithAnims"); for every part that is affected... and it is called whenever a joint moves (by which command ever)... I've tested it right now

but I don't know what FAR does with this... that's something I didn't test

Presumably nothing much happens when you call UpdateShapeWithAnims as it only modifies the mesh transforms based on root transform

Matrix4x4 transformMatrix = HighLogic.LoadedSceneIsFlight
  				? vessel.vesselTransform.worldToLocalMatrix
  				: EditorLogic.RootPart.partTransform.worldToLocalMatrix;

You probably want to call RebuildAllMeshData which will correctly redo any part, such as the inflatable heat shield that does not change mesh transforms for its animation. In the editor, you could fire GameEvents.onEditorPartEvent(ConstructionEventType, Part) which FAR subscribes to with

private void UpdateGeometryEvent(ConstructionEventType type, Part pEvent)
{
  if (type != ConstructionEventType.PartRotated &&
      type != ConstructionEventType.PartOffset &&
      type != ConstructionEventType.PartAttached &&
      type != ConstructionEventType.PartDetached &&
      type != ConstructionEventType.PartRootSelected &&
      type != ConstructionEventType.Unknown)
    return;
  if (EditorLogic.SortedShipList.Count > 0)
    UpdateGeometryModule(type, pEvent);
  RequestUpdateVoxel();

  if (type != ConstructionEventType.Unknown)
    partMovement = true;
}

 

Link to comment
Share on other sites

5 hours ago, dkavolis said:

Presumably nothing much happens when you call UpdateShapeWithAnims as it only modifies the mesh transforms based on root transform

You probably want to call RebuildAllMeshData which will correctly redo any part, such as the inflatable heat shield that does not change mesh transforms for its animation. In the editor, you could fire GameEvents.onEditorPartEvent(ConstructionEventType, Part) which FAR subscribes to with

Maybe FAR could somewhere describe what to do? Like what I did for KJR Next for developers? [ I have to write it more clearly, I know... I had to modify it and now I should rewrite it again. ] All I know about FAR is what I found in the old IR code and this is pretty old.

Oh and... what do I have to call in flight? And how? And how often?

And what does FAR with the DLC robotic parts now?

Edited by Rudolf Meier
Link to comment
Share on other sites

2 hours ago, Rudolf Meier said:

Maybe FAR could somewhere describe what to do? Like what I did for KJR Next for developers? [ I have to write it more clearly, I know... I had to modify it and now I should rewrite it again. ] All I know about FAR is what I found in the old IR code and this is pretty old.

Oh and... what do I have to call in flight? And how? And how often?

FAR voxelization code is a bit of a mess so I can't help much at the moment. Need to clean it up first and then understand the entire logic flow.

FAR only tracks animations with specific field names unless they are ignore by FARAnimOverrides:

FindAnimStatesInModule(animations, m, "animationName");
FindAnimStatesInModule(animations, m, "animationStateName");
FindAnimStatesInModule(animations, m, "animName");
FindAnimStatesInModule(animations, m, "deployAnimationName");

It's a bit dodgy way of tracking animations and by default if it detects any running/ended animations it calls UpdateShapeWithAnims which may not work for all parts. This is done every 30 physics ticks to reduce performance impact. I've also added rebuildOnAnimation config value that will call RebuildAllMeshData on animation since default behaviour didn't work for inflatable heat shield when I changed its voxelization to mesh.

So you would call part.SendMessage("GeometryPartModuleRebuildMeshData") if FAR doesn't know about your animations how often you need to but with performance in mind. If your animations are tracked, try modifying GeometryPartModule on your part to have rebuildOnAnimation = true.

2 hours ago, Rudolf Meier said:

And what does FAR with the DLC robotic parts now? 

No idea, haven't had time to check, either it works as with animations and has to do many voxelizations every second or it doesn't. Either way, calculated cross section should be wrong since the animations are continuous and looping.

 

Link to comment
Share on other sites

2 hours ago, dkavolis said:

FAR only tracks animations with specific field names unless they are ignore by FARAnimOverrides:


FindAnimStatesInModule(animations, m, "animationName");
FindAnimStatesInModule(animations, m, "animationStateName");
FindAnimStatesInModule(animations, m, "animName");
FindAnimStatesInModule(animations, m, "deployAnimationName");

It's a bit dodgy way of tracking animations and by default if it detects any running/ended animations it calls UpdateShapeWithAnims which may not work for all parts.

I'm jumping a bit ahead with it and it may be a bit off-topic. But, could similar methods be used for parts with specific module name ?
What crossed trough my mind is, to if it is possible to detect DLC robotic parts when it started/doing/finished animation ? Trough methods above or similar ?

New API for KSP 1.7.1. is published, but haven't being able to investigate those, what is available in API for mod developers on methotds to check and call.
There should be some kind of API that either, provide some stock events or contain some placeholder for methods: OnBeofreMovement, OnMovement and OnAfterMovement.

Now, some other plugin can detect and override those methods, for example for FAR to do voxelization update, or for KJR, to release autostrut joints before movement and to regenerate autostruts after movement.

There is another issue that arise from this, though. How, to avoid for multiple mods/plugins to not step on each other toe ? Meaning, if both plugins, for example FAR and KJR override stock method and inject it's own piece of code there method from other plugin may not be executed at all. I belive that is one of reasons for developing MFI mod. It might be necessary to update MFI with additional features if something like that does not already exist.

So, instead of overriding stock methods directly, each plugin should send it's own piece of code that need to be executed to MFI, instead of direct override. MFI should then take care that it execute all pieces of code from different plugins before stock methods, or after stock method, whatever is requested. Could something like that work, considering unity game engine restrictions and provided API from KSP ?

Link to comment
Share on other sites

2 hours ago, kcs123 said:

I'm jumping a bit ahead with it and it may be a bit off-topic. But, could similar methods be used for parts with specific module name ?
What crossed trough my mind is, to if it is possible to detect DLC robotic parts when it started/doing/finished animation ? Trough methods above or similar ?

New API for KSP 1.7.1. is published, but haven't being able to investigate those, what is available in API for mod developers on methotds to check and call.
There should be some kind of API that either, provide some stock events or contain some placeholder for methods: OnBeofreMovement, OnMovement and OnAfterMovement.

Now, some other plugin can detect and override those methods, for example for FAR to do voxelization update, or for KJR, to release autostrut joints before movement and to regenerate autostruts after movement.

There is another issue that arise from this, though. How, to avoid for multiple mods/plugins to not step on each other toe ? Meaning, if both plugins, for example FAR and KJR override stock method and inject it's own piece of code there method from other plugin may not be executed at all. I belive that is one of reasons for developing MFI mod. It might be necessary to update MFI with additional features if something like that does not already exist.

So, instead of overriding stock methods directly, each plugin should send it's own piece of code that need to be executed to MFI, instead of direct override. MFI should then take care that it execute all pieces of code from different plugins before stock methods, or after stock method, whatever is requested. Could something like that work, considering unity game engine restrictions and provided API from KSP ?

I haven't found anything that would let modders hook into robotics events. Also, it looks like robotic parts do not use animations and instead modify mesh transforms in a loop so FAR is oblivious to start/stop of those parts.

Link to comment
Share on other sites

26 minutes ago, dkavolis said:

I haven't found anything that would let modders hook into robotics events. Also, it looks like robotic parts do not use animations and instead modify mesh transforms in a loop so FAR is oblivious to start/stop of those parts. 

That is a bummer then. We should ask for feature request from SQUAD to provide some kind of API hooks to robotic parts. Doubt that be happend any time soon though.

So, only hacky option remains, to convert stock robotic parts to use IR plugin instead. And then to call from IR plugin FAR methods on apropriate events if it does not trigger well trough old animation start/stop events.

Link to comment
Share on other sites

1 hour ago, kcs123 said:

That is a bummer then. We should ask for feature request from SQUAD to provide some kind of API hooks to robotic parts. Doubt that be happend any time soon though.

So, only hacky option remains, to convert stock robotic parts to use IR plugin instead. And then to call from IR plugin FAR methods on apropriate events if it does not trigger well trough old animation start/stop events.

Why even use the stock parts then? If your using the IR.dll might as well just use those parts. Does stock have anything IR doesn't? Squad is the king of half ass implentation. I knew this would be a modder headache. Only when Nathankell and the like were working for squad did anything get implemented fully and properly.

Link to comment
Share on other sites

1 minute ago, Svm420 said:

Why even use the stock parts then? If your using the IR.dll might as well just use those parts. Does stock have anything IR doesn't? Squad is the king of half ass implentation. I knew this would be a modder headache. Only when Nathankell and the like were working for squad did anything get implemented fully and properly.

Could not agree more. Converting stock parts to use IR already started and also possible usage of stock robotic controler over IR parts is already in development. Like other moders around Rudolf will have a lot of things to re-do, so have to be patient when mentioned things will be available.

Link to comment
Share on other sites

57 minutes ago, kcs123 said:

so have to be patient when mentioned things will be available.

I think I was misunderstood. I am saying why waste time "fixing" stock parts. Why not just pretend they don't exist and use the IR parts that already work. Do they offer anything IR part don't? I know the interface for setting up sequences in stock  is different. Do the stock  parts offer anything new? If not, then who needs them... :)

Link to comment
Share on other sites

3 minutes ago, Svm420 said:

Do they offer anything IR part don't? I know the interface for setting up sequences in stock  is different. Do the stock  parts offer anything new? If not, then who needs them... :)

thanks :) I thought the same... I think IR offers more and the integration into their "sequencer" or new action groups, that works in first tests (action groups is tested, sequencer not, but I think they use the same commands behind the scene, so I guess it should also work)

Link to comment
Share on other sites

1 minute ago, Svm420 said:

I think I was misunderstood. I am saying why waste time "fixing" stock parts. Why not just pretend they don't exist and use the IR parts that already work. Do they offer anything IR part don't? I know the interface for setting up sequences in stock  is different. Do the stock  parts offer anything new? If not, then who needs them... :)

Well, when you add bunch of parts from various mods and stock parts on top of those, people would probably forget what parts comes from stock and what from mod. They would place it on craft and started to report bugs that those does not show in IR GUI or similar bugs.

Easiest way would be to hide stock robotics parts in SPH/VAB, but then it would be complains where parts from "expencive" DLC disapeared and why.
But, yes, I agree that stock does not offer anything new that does not already exist in IR.

Overall, stock robotic parts works as expected(disapointing).

Link to comment
Share on other sites

They have a telescopic piston that's a single part and a physically larger rotatron than IR but that's all I can think of. For their parts they went in the direction of "make them fit with our existing trusses and I beam" rather than develop a nicer set of structural parts for robotics. That and the fact the science arms are one piece rather than multiple robotics joints seems like a missed opportunity to me.

18 minutes ago, kcs123 said:

Easiest way would be to hide stock robotics parts in SPH/VAB, but then it would be complains where parts from "expencive" DLC disapeared and why.

This is why I am glad IR creates its own robotics tab separate from the now stock one. Easily distinguishes the two sets, plus the colour schemes make it more obvious that they're different.

Link to comment
Share on other sites

9 minutes ago, kcs123 said:

Well, when you add bunch of parts from various mods and stock parts on top of those, people would probably forget what parts comes from stock and what from mod. They would place it on craft and started to report bugs that those does not show in IR GUI or similar bugs.

Easiest way would be to hide stock robotics parts in SPH/VAB, but then it would be complains where parts from "expencive" DLC disapeared and why.
But, yes, I agree that stock does not offer anything new that does not already exist in IR.

Overall, stock robotic parts works as expected(disapointing).

I totally can see the bad reports being an issue. With the wide market of KSP many false or not useful reports come from inexperienced users. That I don't have a easy solution for. It has burned many good modders in our community. I have seen the more experienced/veteran users of particular mod try to help save the actual creators time by helping resolve those reports, but that's seems rarer as time goes on in these forums. Just wanted to say if modders feel they are wasting time fixing squad oversight then don't or make it a secondary/tertiary issue resolved at leisure. Rant in spoiler :)
 

Spoiler

I would never call KSP a game because games have goals and an end. KSP is a loose collection of ideas that just has more ideas added without any clear goal/plan. Hell most of the ideas don't even get finished or even acknowledged after initial implementation career mode. Modders have been doing squads work for them for years. Only now is squad even "attempting" to add things people have been asking for for years things to KSP. Each time they do they create more issues for themselves and modders which they patch just enough to get by. Only when they took some of the veteran creators from the community did anything get implemented properly, and the end result of that seemed to be a mass exodus from the KSP community by some of the best creators. At least from the looks of the forum. Maybe that was just people having busier lives IDK, but I do know that the modding scene look more like maintenance than creation, that's not to belittle those who still are creating or are just starting, or the actual effort of those maintaining the vast mod history. Just that the forum doesn't feel the same.

 

 

Link to comment
Share on other sites

With using only one hinge, with both, stock and IR parts, even lightweight wing would oscilate. Tried to increase IR joint strength for absurde 100000 times without noticable improvement. Most probably due to mentioned unity engine limitation. Haven't yet tried to increase IR part mass, to see if that would help.

What can help is to lock IR part after moving part to desired position. It helps with both, IR parts and stock robotic parts.
But, yes, while IR parts are weak on some mechanizm designs, stock parts are even worse thousen of times on same craft design.

In conclusinon, it might be necessary to use two or more connections to movable wing to make whole construction stronger, not just using single hinge or similar.

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