Jump to content

Help with making a tech tree


Recommended Posts

I am thinking of making my own tech tree mod, as I am not fully satisfied with any currently-available tech trees. However, I have no idea where to even begin, short of looking at the config files of existing tech tree mods to get some vague idea of how the formatting works. Are there any guides which already exist that can point me in the right direction?

Link to comment
Share on other sites

  • 5 weeks later...

That's how I got into this.  I just finishing making one where I moved every node many times until I got it set up the way I wanted, so it's all still fresh.  As far as modding goes, I think it's one of the easier things to do.   Take a look at the stock tech tree file in Kerbal Space Program\GameData\Squad\Resources\ TechTree.cfg to get an idea of how it's set up.  Looking at other tech tree mods is a big help too.  I'd recommend you look at mine linked in my siggy since I think it is better organized than some.

The structure is:

TechTree
{
	RDNode
	{
		id = 
		title = 
		description = 
		cost = 
		hideEmpty = 
		nodeName = 
		anyToUnlock = 
		icon = 
		pos = 
		scale = 
		Parent
		{
			parentID = 
			lineFrom = 
			lineTo = 
		}
	}
}

Changes are made with Module Manager config. You can only have one TechTree. You can either modify the exisiting one or delete it and make a new one.  Most trees are modified stock so they start @TechTree{}.  The '@' is a modify symbol. The Module Manager Handbook has lots of good info on syntax. To delete and start a new one, use !TechTree{} to delete it and TechTree{} to make your new one.  I chose to modify the existing one but added some custom nodes. 

A simple edit to change the position of the start node is:

@TechTree
{
	@RDNode:HAS[#id[start]]
	{
		@pos = -3800,1407,0
	}
}

 We start with @TechTree because we're modifying the existing tree.  We also use @RDNode to modify an existing node, in this case the node with id start.  If you look in the stock techtree cfg, you'll find a node defined with id = start.  Since it already has a data element 'pos' we again use @pos to modify that value to whatever we want. We can similarly change any other data element in the node. You only need to include the data elements you want to change. The others will be left at the whatever value they were set at when the node was defined. 

Links between nodes are done with the Parent{} structure.  It has three elements - parentID, lineFrom, and lineTo.  ParentID corresponds to the id of the node you're linking from.  Here's a more complex example with changing a parent node. In this case I didn't need to change lineFrom or lineTo (oh and case matters, so watch your capital letters)  

@TechTree{
	@RDNode:HAS[#id[advRocketry]]
	{
		@cost = 45
		@anyToUnlock = False
		@pos = -3200,2155,0
		@Parent
		{
			@parentID = generalRocketry
		}
	}
}

You can use -Parent{} to remove a link or just Parent{} to add one.   Anyway, that's the basics. I'll be happy to answer any questions you might have.

Oh, you only need to do @TechTree{} once and put all your @RDNode{} edits in it.

Edited by SpinkAkron
Link to comment
Share on other sites

Thank you @SpinkAkron, though since making this thread I have actually learned a lot more about how to do this kind of thing properly, and have been directed to some Module Manager documentation which should hopefully save me from having to build up my understanding of patch writing solely from studying other mods' patches. Still, it is always helpful to see detailed examples like this.

I do have one additional question about writing a tech tree: are the "lineFrom" and "lineTo" parameters required, or will the lines be added automatically if I leave those parameters out?

Edited by septemberWaves
Link to comment
Share on other sites

5 hours ago, septemberWaves said:

Thank you @SpinkAkron, though since making this thread I have actually learned a lot more about how to do this kind of thing properly, and have been directed to some Module Manager documentation which should hopefully save me from having to build up my understanding of patch writing solely from studying other mods' patches. Still, it is always helpful to see detailed examples like this.

I do have one additional question about writing a tech tree: are the "lineFrom" and "lineTo" parameters required, or will the lines be added automatically if I leave those parameters out?

They are not automatic. If you don't include them there will be no visible lines.  They're not strictly required in the sense the node will still have the Parent as a prerequisite and will display the parent names on the right hand panel when selected. 

Link to comment
Share on other sites

On 2/19/2019 at 2:12 AM, septemberWaves said:

I do have one additional question about writing a tech tree: are the "lineFrom" and "lineTo" parameters required, or will the lines be added automatically if I leave those parameters out?

I was wrong. I just learned that lineFrom and lineTo have defaults of RIGHT and LEFT respectively. If you leave them off, there will still be lines.

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