Jump to content

[Plugin] RasterPropMonitor v0.4 -- a prop monitor for capsule internals


Mihara

Recommended Posts

Great work!

I'm pretty sure this will be more efficient than my implementation with all those gameObjects, since code is so much faster to run than rendering.

I'll definitely want to use your raster technique to un-lag my monitors!

Interesting note about bracket replacement, since you said you are used to archaic programming languages. Since many keyboards had a hard time of making { and [ in the old days, in Turbo Pascal, you could use (* and *) as { and }, and (. and .) as [ and ].

(You only used { or (* for comments)

Link to comment
Share on other sites

Interesting note about bracket replacement, since you said you are used to archaic programming languages. Since many keyboards had a hard time of making { and [ in the old days, in Turbo Pascal, you could use (* and *) as { and }, and (. and .) as [ and ].

(You only used { or (* for comments)

Not so much archaic as arcane. The kind where


[if(setr(4,match(%0,[setr(2,ucstr(%1))]:*)),replace(%0,%q4,%q2:%2),setunion(%0,%q2:%2))]
[if(strlen(setr(1,after(grab(%0,[ucstr(%1)]:*),)),%q1,0)]

means something and is probably the most important piece of code I have ever written. :)

Thankfully, I've already found how to load a text file directly, so {} no longer get mangled and you don't have to replace brackets unless you need to squeeze the screen definition into the part config. :)

Link to comment
Share on other sites

Bumpage for great justice, version 0.2 posted, see OP. New in this version:

  • Screen display mechanism rewritten, now much faster. Multiple copies of the plugin within the same capsule use only one instance of calculator to further improve performance.
  • Configuration file syntax changed. A lot, now much more readable.
  • I lost count of the new variables it handles.
  • Full documentation.

I'm going to package it into a useful screen for a stock pod, call that version 0.3 and say it's done until bug reports start coming in.

Link to comment
Share on other sites

Sorry I posted this in the pod thread:

And I think I got it to the point where it will work with bolt-on cameras smoothly, see source. :) I won't update the binary for a while yet, though, since I want to package it with a bolt-on camera.

Which bolt on cameras? Would it work with a transform name of dockingNode (if using a docking port).

I compiled from source, tried it and I'm just getting a gray screen and the buttons don't function. Logfile is spamming:

RasterPropMonitor: Turning camera off...

NullReferenceException: Object reference not set to an instance of an object

at RasterPropMonitor.RasterPropMonitor.destroyCameraObjects () [0x00000] in <filename unknown>:0

Link to comment
Share on other sites

Not sure, I'll recompile it again when I get home. This solves everything for me. The PTK NP (http://forum.kerbalspaceprogram.com/threads/47765-Space-Factory-Ind-%28PPTS-release%21%29) for example is an awesome craft, the only downside is the IVA contains just one little window that you can look out of. Your plugin solves this issue. I now can hang flatscreen monitors and create as many viewports as I want via the screens.

Here's a screenshot of that IVA (The wierd object you see on screen is it's own dockingport part that has the dockingNode transform):

li8u46iiu4rbu1wfg.jpg?size_id=5

Link to comment
Share on other sites

I created 8 cameras each with their own unique transform names of cameraX where X is a number 1-8. Works wonderfully! I noticed something interesting when I tested the monitor out. The number of the buttons go, which I'm sure knew but just in case. This is in the top 10 mods ever in my opinion.

1 - 2

3 - 4

7 - 5

8 - 6

Other than that I'm

Link to comment
Share on other sites

Wow... looks closer and closer to Orbiter... hmmm... will there be all kinds of MFDs in the future?

Was that a rhetorical question or a question to me? :)

As a side note, once SCANsat is more mature, I'll check if it's feasible to integrate with it and ask it for a map...

Link to comment
Share on other sites

Was that a rhetorical question or a question to me? :)

As a side note, once SCANsat is more mature, I'll check if it's feasible to integrate with it and ask it for a map...

That is a question to you. :)

These HUD/instruments/MFD pictures remind me of Orbiter's so i just want to ask.

Link to comment
Share on other sites

Every page is fully modder-configurable in a text file, see docs. You get up to 8 per prop (and you would get an infinite number if IConfigNode worked for InternalModule), each page can have it's own camera in the background.

In theory, something other than the camera could be there. :)

Link to comment
Share on other sites

Bump for great justice, I'm calling that version 0.3. :)

  1. Cameras work. The cameras on the included example monitor latch onto the nearest docking node they can find and show in the page marked Docking.
  2. A little more variables.
  3. ModuleManager config patches included to stick the prop into stock Mk1, Cupola, Mk1 Cockpit, and Mk1-2 Pod.

Be sure to keep the DLL in the canonical location as exemplified by this distribution, or it'll try to conflict with itself.

The only thing I still want to do to it is keeping track of currently active pages between IVA initializations, (I need to get that to work for ALCOR light switches as well...) which involves storing persistent variables from inside an InternalModule. That's proving pretty tricky. :)

Link to comment
Share on other sites

How did you get the proper sky colour in the camera? I've tried CameraClearFlag.Depth, Skybox etc, but it all comes out with no sky.

I don't see any reference to that stuff in the code, so I assume you set it up correctly in Unity.

Link to comment
Share on other sites

How did you get the proper sky colour in the camera? I've tried CameraClearFlag.Depth, Skybox etc, but it all comes out with no sky.

I don't see any reference to that stuff in the code, so I assume you set it up correctly in Unity.

KSP flight scene camera is actually three different cameras. You can see them in Camera.allCameras list: "Camera ScaledSpace", "Camera 01" and "Camera 00". The only one that sees the skybox is the ScaledSpace one, 01 and 00 are near and far ranges -- not sure why they did it this way, though they probably had their reasons. In the end it's much easier to copy all three and render in three passes like they do instead of trying to work out a single camera that gives a good result. :)

For added inconvenience, you can't move the ScaledSpace camera - apparently it's position is tied to the Krakensbane or something, so if you move it, you get planetary atmosphere halos.

Link to comment
Share on other sites

Right, I knew about 00 and 01 for different distances, but not the last one. So if you can't use it, how do you add it to your camera on the monitor rendering?

I have done multiple overlaid cams in unity, but in that case I am free to copy or move them around. Can you point me to the magic code? Couldn't see it in the source at first glance.

Link to comment
Share on other sites

Right, I knew about 00 and 01 for different distances, but not the last one. So if you can't use it, how do you add it to your camera on the monitor rendering?

I do render it. I just don't move it. :)


// ScaledSpace camera is special.
cameraObject [0].transform.rotation = cameraTransform.transform.rotation;
cameraObject [0].fieldOfView = fov;
cameraObject [0].Render ();
for (int i=1; i<3; i++) {
cameraObject [i].transform.position = cameraTransform.transform.position;
cameraObject [i].transform.rotation = cameraTransform.transform.rotation;
cameraObject [i].fieldOfView = fov;

cameraObject [i].Render ();
}

They're stacked up in an array, initially I was hoping to get away with looping through it in all cases. That is the one exception, it needs to be rotated, but not moved. :)

Link to comment
Share on other sites

will kOS be able to integrate with this?

While I thought of that as a possibility, I am not up to doing that myself for at least some time.

There are several angles here - show data sent by kOS, show the entire kOS terminal, let kOS switch pages... Some are easy, others not so much, but all should be possible.

What I do want to do next, though, is try to get at SCANsat's map. :)

Link to comment
Share on other sites

While I thought of that as a possibility, I am not up to doing that myself for at least some time.

There are several angles here - show data sent by kOS, show the entire kOS terminal, let kOS switch pages... Some are easy, others not so much, but all should be possible.

What I do want to do next, though, is try to get at SCANsat's map. :)

Yes. SCANsat map indeed! I love this mod so if you ever need anything to test just let me know. Have you figured out how to handle multiple docking ports?

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