Jump to content

[0.25/0.90] TechManager Version 1.5


anonish

Recommended Posts

** This Mod is now obviated **

KSP version 1.0 now includes the tech tree as a .cfg file, which means you can use module manager to make changes to it an do not need this mod anymore. Furthermore, the changes to version 1.0's tech system are significant enough that I do not think there is any point in continuing support for this mod. There are a couple of features that TechManager had that KSP does not, like multiple trees in one game and the ability to hide entire sub trees, but those were practically unused by anyone and now KSP defaults all nodes to be visible by default anyway. So, I am HAPPY to say, there is no more point to this mod. Thanks SQUAD!

I'll keep it around for download for those of you who like to play old games (I know you are out there). But don't expect any updates. And, as always, anyone is free to use the source code for any reason, if you can think of one.

Happy rocketeering.

***

This is a plugin that will allow you to modify the tech tree, including adding new nodes. It was developed and tested primarily for use with KSP Interstellar, however, other developers are using TechManager to load their own custom trees and you are free to make your own.

Unofficial versions of the KSP Interstellar and Near Futures tech trees are installed by default. When / if they release updates that conform to the (slightly different) TECHNOLOGY_TREE_DEFINITION format, I will likely remove the unofficial trees. Any 'official' tech trees released by modders will work in place, no need to move them to the TechManager directory.

If you expect this to work, be sure to remove / do not install the TreeLoader mod.

One MAJOR way this mod differs from TreeLoader (besides working with .25) is that you must define the ENTIRE tech tree. You can not simply put only the new nodes in the tree definition file. TechManager works by inactivating all of the tech nodes it sees at start up and then loads in what is in the file. As such, there is no REMOVENODE node type. If you don't want a node, just don't define it in the file.

The source is included in the download.

Download TechManager from KerbalStuff.com It will say version .25, but that will also work with .90.

License: MIT

Version 1.5

-changed menu keys from Left-Alt-F7 to Modifier-F7. For windows, this is Alt-F7. For linux and osx, it will be whatever modifier you normally use for KSP.

-fixed bug with 'external' node types introduced in 1.3

-fixed bug where some error messages would generate errors of their own

-any errors while parsing a tree will now prevent that tree from loading at all

Version 1.4

-fixed issue where KSP would request a save while pointing to a non-existent save directory

-added 'hideIfNoBranchParts' config option

-reworked the tree selection dialog again

-added version info to log file on startup

-removed tree selection button from science archives tab of R&D building

Version 1.3

-reworked tree selection dialog to be less confusing.

-fixed bug where experimental parts (parts from techs not yet researched) wouldn't show up in the VAB for a test contract.

Version 1.2

-Refactored code, loading and saving of config files

-added multi tree support

-added new 'external' node type

Version 1.1:

-Added check for more than one part having the same name. This will be noted in the log file and no longer hang the game.

Edited by anonish
Link to comment
Share on other sites

Wow! Would you mind to share your findings about inserting new nodes with ATC developers? They use different approach to TechTree configuration - like MM-based patch-configs, but are still stuck with adding new nodes.

Well, I mentioned SirJodelstein / ATC in my post with exactly that in mind. The source for the mod is included in the download. It might be a good idea to separate tech configs from part configs, where tech tree configs shouldn't mention parts at all, while part configs should explicitly mention the tech they need. Then MM patches can change the parts as needed.

Link to comment
Share on other sites

Lovely bit of coding chap. It's nice to see such a clean, uncluttered, no-nonsense implementation. If I'm understanding correctly, this can handle different trees per save, correct? I didn't immediately click as to how part tech requirements is handled for that. Is it a simple case that if a part has tech requirement for a node that doesn't exist in a save's tree, it just won't be available?

Link to comment
Share on other sites

If I'm understanding correctly, this can handle different trees per save, correct? I didn't immediately click as to how part tech requirements is handled for that.

Yes, different trees per save. What actually gets saved are the ProtoTechNodes in the ResearchAndDevelopment instance, and that is just a string identifying a techID, a state saying the tech is researched or not, and a list of purchased parts. The graphical tree, clicking on buttons, etc is just a way to get that data in there, and I use all stock code for that. I set the fewest number of fields I can get away with and then let the game treat them like normal tech nodes afterwards.

Is it a simple case that if a part has tech requirement for a node that doesn't exist in a save's tree, it just won't be available?

Mostly yes. If that tech isn't in the tree, it won't show up anywhere. But, you can change the tree at any time while at the R&D screen. If you purchase a part then remove that tech, the part will be forgotten. If you then add that tech back in, it will show up again but need to be purchased again as well. At least.. I think that's what would happen. I should probably test that.

Nothing you do in one save, however, should have any impact on any other. That's what the bit about stockTechRequired is for. It remembers the 'stock' part config on the way in, and sets it back on the way out.

Link to comment
Share on other sites

And then there were three...

Att least this one claims to work! Need to try it at soon as I get home. Thanks for supporting the community with the licence and openness to have others learn from your code!

Please report back after you've tried it. At this point I don't know that it has or hasn't worked for anyone.

To test before launching a new career I recommend starting a custom career where you give yourself 5000 science and auto purchase parts. That will get you deep enough into the tree to try out the custom KSPI nodes.

Link to comment
Share on other sites

Please report back after you've tried it. At this point I don't know that it has or hasn't worked for anyone.

To test before launching a new career I recommend starting a custom career where you give yourself 5000 science and auto purchase parts. That will get you deep enough into the tree to try out the custom KSPI nodes.

It works like. a. charm!

Link to comment
Share on other sites

So, my game won't load with TechManager. KSP x86, Windows 7. The game loads all the way through the loading bar, gets to the loading icon in the bottom right and locks up.

When I uninstall TechManager, it loads just fine. Here's the relevant portion of my output log (yes, I see the ATM NullRef as well....):


[IR GUI] destroy

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

UnloadTime: 23.041830 ms
Unloading 7 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)

Unloading 351 unused Assets to reduce memory usage. Loaded Objects now: 148388.
Total: 130.387650 ms (FindLiveObjects: 8.844193 ms CreateObjectMapping: 7.010676 ms MarkObjects: 110.643440 ms DeleteObjects: 3.323917 ms)

AddonLoader: Instantiating addon 'ActiveTextureManagement' from assembly 'ActiveTextureManagement'

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

AddonLoader: Instantiating addon 'MuMechGUI' from assembly 'InfernalRobotics'

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Parsing rect

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Parsing rect

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Parsing rect

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Parsing rect

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Parsing bool

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

[IR GUI] awake

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

AddonLoader: Instantiating addon 'InterstellarToolbar' from assembly 'InterstellarToolbar'

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)



(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Agent: Found 18 agent mentality types

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

AgentList: 27 agents parsed and loaded.

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

NullReferenceException: Object reference not set to an instance of an object
at ActiveTextureManagement.ActiveTextureManagement.SetupLoaders () [0x00000] in <filename unknown>:0

at ActiveTextureManagement.ActiveTextureManagement.Start () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

[CelestialBody]: Kerbin's solar day length is 1d, 0h, 0m long. sidereal day length is 5h, 59m, 59s long

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

[HighLogic]: =========================== Scene Change : From LOADING to MAINMENU =====================

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

ArgumentException: An element with the same key already exists in the dictionary.
at System.Collections.Generic.Dictionary`2[System.String,System.String].Add (System.String key, System.String value) [0x00000] in <filename unknown>:0

at TechManager.TechManager.OnGameSceneLoadRequested (GameScenes scene) [0x00000] in <filename unknown>:0

at EventData`1[GameScenes].Fire (GameScenes data) [0x00000] in <filename unknown>:0

at HighLogic.LoadScene (GameScenes scene) [0x00000] in <filename unknown>:0

at PSystemSetup+ .MoveNext () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

NullReferenceException
at (wrapper managed-to-native) UnityEngine.MonoBehaviour:StopCoroutine (string)

at PQS.ResetSphere () [0x00000] in <filename unknown>:0

at PQS.ResetSphere () [0x00000] in <filename unknown>:0

at PQS.OnDestroy () [0x00000] in <filename unknown>:0

(Filename: Line: -1)

[IR GUI] destroy

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Link to comment
Share on other sites

So, my game won't load with TechManager. KSP x86, Windows 7. The game loads all the way through the loading bar, gets to the loading icon in the bottom right and locks up.

Thank you for the bug report!

Hm. Looks like you have more than one part with the same name. I didn't check for that possibility in the loop that establishes the dictionary stockTechRequired. I'll fix that when I get home, but ... how did you end up with more than one part having the same name? I'll have it print out any duplicate names so we can track this down further.

Link to comment
Share on other sites

Hm. Looks like you have more than one part with the same name. I didn't check for that possibility in the loop that establishes the dictionary stockTechRequired. I'll fix that when I get home, but ... how did you end up with more than one part having the same name? I'll have it print out any duplicate names so we can track this down further

Let me do some digging as well. I've been mucking with some parts, and I THOUGHT I un-did everything I messed with, but I shall dig around. I uninstalled and reinstalled KSPi (without TreeLoader). I'll edit this post if I find something.

Update: I had a working folder where I was playing with various concepts. I removed that folder, and am still having the issue. All my other mods are clean installs (I haven't messed with anything). The only thing I can think of is there's something duplicated in all of my USI mods. That folder is next for scrutiny.

Update: Ok, I've dug through most of my folders. I cannot find any duplicates of anything. Next, it's uninstalling things one at a time, I guess. :(

Update: Ok, it's something in the USI folder family

Edited by Kalloran
Link to comment
Share on other sites

Looks very cool. Two questions:

  • Can the tech tree be edited using ModuleManager? One big disadvantage of TreeLoader IMO was that all changes needed to be made in the tree.cfg file, which made it vulnerable to overwrites, etc.
  • Do we need to declare parts as belonging to new tech nodes, as in TreeLoader, or can we use the stock system of just passing the tech name to the part?

Edited by Starstrider42
Link to comment
Share on other sites

Looks very cool. Two questions:

  • Can the tech tree be edited using ModuleManager? One big disadvantage of TreeLoader IMO was that all changes needed to be made in the tree.cfg file, which made it vulnerable to overwrites, etc.
  • Do we need to declare parts as belonging to new tech nodes, as in TreeLoader, or can we use the stock system of just passing the tech name to the part?

The tech tree is currently totally specified in the config file. I would like to change this, however. Or, really, I'd like ATC to just incorporate TechManager. I named it Tech*Manager* because I saw it as a fitting nicely with Module*Manager*, at least eventually. The main problem with allowing arbitrary mods to add techs, is how do you then determine where every node is physically located? What if two mods try to put a node in the same place?

You do NOT need to declare parts in the tree.cfg file. You can though, and if you do, it will take priority. But if a part's TechRequired field is set, TechManager will assign that part to that tech if no tech in the tree.cfg file claims it.

Link to comment
Share on other sites

Im not seeing any editor features, I know the interstellar tree works as I loaded it. I just cant modify anything, Im running linux x64

The 'editor features' are close to non-existent. Open up notepad / vi and modify the tree.cfg file. The file is loaded every time you go into the R&D Building and every time you press Left-Alt-F7 while in the R&D Building. I've tested the reload shortcut on windows, no idea if it works on linux. Let me know please!

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