Jump to content

[0.25] ATC - Alternative Tree Configurator [15.10. - V0.5.1]


SirJodelstein

Recommended Posts

Hello. I wanted to drop in and say I have released the TechManager mod. It has the ability to add new tech nodes and is licensed MIT, so you can use it any way you like. There appears to be a lot of interest in adding this functionality to ATC (and I mention you guys by name in my initial posting), so I hope to hear back. Thanks.

TechManager

This worked perfectly for me! Thank you.

Link to comment
Share on other sites

I think I'm about | | this close to getting this scat working, bare with me...

Edit 1: I'm still getting this exception the first time the tech tree loads,



Exception in NEWNODE processing - System.NullReferenceException: Object reference not set to an instance of an object

at RDNode.Setup () [0x00000] in <filename unknown>:0

at RDNode.DrawArrow (UnityEngine.Material mat) [0x00000] in <filename unknown>:0

at RDNode.ShowArrows (Boolean show, UnityEngine.Material mat, .Parent[] list) [0x00000] in <filename unknown>:0

at RDNode.InitializeArrows () [0x00000] in <filename unknown>:0

at RDNode.Setup () [0x00000] in <filename unknown>:0

at ATC.TechChanger.processNewNodes (.ConfigNode tree) [0x00000] in <filename unknown>:0

And there are a couple weird rendering issues that I have to iron out, but I am able to create a proper looking node right now...

Edited by Ixonal
Link to comment
Share on other sites

I think I'm about | | this close to getting this cat working, bare with me...

I'd be happy to answer questions if you have any, assuming you are trying to roll TechManager into ATC. Not sure which cat you are working on.

Edit 1: I'm still getting this exception the first time the tech tree loads,

The simplicity of tm can be a little misleading. Things have to happen at certain times to work out correctly. For example, when and how exactly you pick a node to gen prefabNode from. The allocated GameObject must be deactivated before adding RDNode and RDTech components, RDTech must invoke Start() before activation, etc.

EDIT: nvm, that's not Setup.

Got something I can look at?

Edited by anonish
Link to comment
Share on other sites

I'd be happy to answer questions if you have any, assuming you are trying to roll TechManager into ATC. Not sure which cat you are working on.

The simplicity of tm can be a little misleading. Things have to happen at certain times to work out correctly. For example, when and how exactly you pick a node to gen prefabNode from. The allocated GameObject must be deactivated before adding RDNode and RDTech components, RDTech must invoke Start() before activation, etc.

EDIT: nvm, that's not Setup.

Got something I can look at?

I'm mainly trying to follow the process flow in TM and compare that to the flow in ATC to see what may need to be done differently. I'll post what I have to Github tomorrow, I'm right about to hit the hay here.

Edit 1: Here's my random techyness, just because.

http://imgur.com/bjfPSlC

Edited by Ixonal
Link to comment
Share on other sites

Well, here's a couple observations on the process differences compared to what is in gitHub at the moment.

nodePrefab = new GameObject("newnode", typeof(RDNode), typeof(RDTech));

That is right out. It will create an *active* GameObject and the RDNode and RDTech unity script init functions Awake and Start will get called. But those functions expect the correct values to already be set.

You have to new GameObject("newnode"), then inactivate it, then AddComponent<RDNode> and AddComponent<RDTech>. Then set at least the prefab field. Now you have a working mostly blank GameObject to instantiate off of for your new nodes and you are free to setup those classes before calling setActive(true) on the instantiated objects. Also, because the RDNode init relies on RDTech being initialized first (a ksp bug, imo), you have to call the RDTech's start function before activating the GameObjects.

Again, the classes are *clean* if you follow this procedure. You don't have to worry about what is hiding behind a half used object. All that is set is what you set, and you get to set it before unity inits the object. This is a major departure between TechManager and TreeLoader and is a big part of why my code is short and to the point.

return Array.Find<RDNode> (AssetBase.RnDTechTree.GetTreeNodes(), x => x.gameObject.name == "node0_start");

This never worked for me. Had to switch to

stockNodes = GameObject.FindObjectsOfType<RDNode>();

RDNode startNode = Array.Find<RDNode>(stockNodes, x => x.gameObject.name == "node0_start");

KSP wipes and re instantiates the nodes each time you enter the RD building, so this has to be redone each time as well. I don't remember if I made that change before or after figuring out the clean node creation procedure, it might not be necessary. The start node (or any stock node) is really only needed for the prefab and transform fields. If those have the same value both ways, then either way would be fine.

Consider extending TechManager to derive the relevant properties from your ConfigNode system rather than extending ATC to create new nodes. I know I had a lot of 'almost works' moments until everything fell in place.

Link to comment
Share on other sites

Hey everyone,

this is just a short notice to let you all know that I am still very interested in this project, and that i am following the current developments regarding the new nodes from afar. Unfortunately, real life constraints prevent me from doing more (haven't played KSP for over a month now). Anonish, Ixonal, i am really impressed by your continued efforts and wish you all the best. You rock! I'll gladly assist with integration/branch merging when you are ready.

Link to comment
Share on other sites

Consider extending TechManager to derive the relevant properties from your ConfigNode system rather than extending ATC to create new nodes. I know I had a lot of 'almost works' moments until everything fell in place.

Not really my call, as it's not my project. I'm just helping figure this part out.

Got rid of the exception, but it's still not acting right. The node won't show up the first time I load the research center, but it will the second time.

Also, if I use GameObject.FindObjectsOfType<RDNode>(); to find nodes, my new node doesn't show up at all, but it does if I use AssetBase.RnDTechTree.GetTreeNodes()

Edit: There's also this weird issue that has to do with zooming. The node and half the arrow to it start hidden, but then become visible as I zoom out...

Edit 2: Also, seen this error before?



ATC: Error Loading tree - System.NullReferenceException:

at (wrapper managed-to-native) UnityEngine.Component:InternalGetTransform ()

at UnityEngine.Component.get_transform () [0x00000] in <filename unknown>:0

at ATC.TechChanger.setupAnchors (.RDNode target, .Parent& connection) [0x00000] in <filename unknown>:0

at ATC.TechChanger.LoadTree () [0x00000] in <filename unknown>:0

at ATC.TechChanger.Update () [0x00000] in <filename unknown>:0

Edited by Ixonal
Link to comment
Share on other sites

The two calls to render properly i've seen, the zooming and exception i have not. But those all sound like what i would expect when starting with dirty GameObjects. Did you switch to the clean instantiation i suggested?

Link to comment
Share on other sites

The two calls to render properly i've seen, the zooming and exception i have not. But those all sound like what i would expect when starting with dirty GameObjects. Did you switch to the clean instantiation i suggested?

I updated my repo, here's what I'm currently using to spawn new tech nodes (I separated it from the main class) https://github.com/Ixonal/KSPAlternativeTechConfigurator/blob/master/RDNodeFactory.cs

Link to comment
Share on other sites

hmmmm.... anonish, why do you deactivate all of the stock nodes when prepping for creation?

I like clean breaks. If you are going to create one node, might as well make them all. Keeps the logic simpler as I don't have to determine what is new and what is a rewrite. Also I don't have to implement a REMOVENODE cfg entry type if someone *doesn't* want a stock node -- in that case, they just don't put it in the file.

Link to comment
Share on other sites

I like clean breaks. If you are going to create one node, might as well make them all. Keeps the logic simpler as I don't have to determine what is new and what is a rewrite. Also I don't have to implement a REMOVENODE cfg entry type if someone *doesn't* want a stock node -- in that case, they just don't put it in the file.

ahh, well spoot... I'm having a hell of a time finding out why the new nodes don't load the first time, but they do subsequent times. Thought that might have something to do with it.

Edit 1: seems like that null reference exception is stemming from obtaining the new node's parent node using "RDNode source = connection.parent.node;" and then trying to reference the transform. If I try to access an RDNode with the same name as the node it's looking for, it seems to be able to access the transform, but the anchors go screwy. This seems to suggest there are two versions of the new node somehow, even though the creation process has only run once... ehh, I'll keep lookin at it this weekend I guess...

Edited by Ixonal
Edit 1
Link to comment
Share on other sites

This mod/plugin looks very cool, and I downloaded it, but I was just wondering. How the hell does it work :P. I'm a bit of an idiot when it comes to working out what I'm actually looking at and meant to be doing. I would really like to help except I only just started learning code so I don't really think I can but if you need any testing or the suchlike, I'd be happy to help as I'm using this for my "Modpack" of sorts. Hope that this thing comes together soon. Oh, and that GUI looks really cool! I'd be happy to alpha test that too!

Link to comment
Share on other sites

How do you get this to work? There's no GUI for me.

Tested this on a fresh install and it just doesn't work for me, can't change the tree or even get any GUI. What am I doing wrong?

as in the RnD tree isn't showing up, or what?

Link to comment
Share on other sites

Yes, even started with a fresh install with only this mod.

That sounds like a bug I'm getting with my fork (though, only with new nodes, as far as I've seen). As far as I know of, nobody else using the official release version is having this issue. At least, I haven't seen it reported. Did you build the mod from source or just download the zip?

Link to comment
Share on other sites

That sounds like a bug I'm getting with my fork (though, only with new nodes, as far as I've seen). As far as I know of, nobody else using the official release version is having this issue. At least, I haven't seen it reported. Did you build the mod from source or just download the zip?

Downloaded from ZIP.

Link to comment
Share on other sites

Here you go. As I said, I have to run the game in OpenGL because of all the mods I run. Will be installing Linux this weekend.

http://www./view/4hfxnwdvsgh9f9n/output_log.txt

I don't suppose you have one from an install with only ATC in it? not sure which messages are from ATC and which are from other mods. Also, do you have a copy of the cfg file that's being used to alter the tech tree?

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