[Tool] (A16) Research Tree Generator

Started by klassekatze, February 13, 2017, 04:59:24 AM

Previous topic - Next topic

klassekatze

I couldn't get anything done in A16, so I grabbed the old style list from this very forum. (https://ludeon.com/forums/index.php?topic=28609.0)

Still, that was pretty troublesome too. I googled and found RimSearch, except... it was gone.

So I wrote a node.js+dagre-3d thing to generate my own graph.

This program takes your active mods in appropriate order and scans all their research, then it updates the data rendered by the html document included.

image

Instructions in the README.txt in brief are
1) Install node. It needs to be in your path. Node can be found at https://nodejs.org/en/.
2) Run genResearch.bat on Windows (or the command "node research.js" if you aren't).
3) Drag the file dagre.html onto a browser window, or otherwise open it in your browser. Enjoy readable research tree.

Warranty void if you are using Steam or anything else - hopefully it works for you, there are instructions to make it easy to either hardcode the paths or bring the mods to it. As with RimSearch, it can be placed in the application directory if nothing else, and this is covered in the readme.

If you want to distribute only the generated graph without the ability to regenerate, you can remove everything except dagre.html and the js folder.

Modpack authors or anyone else can feel free to do so - in fact, consider it under the CC0 license, public domain.

Download: https://www.dropbox.com/s/vx1apanq21ldi0f/ResearchDiagram.zip?dl=0

Fluffy (l2032)

pwetty :D

I was really hoping you had coded the Sugiyama algorithm used here (I think) yourself, but it looks like you're using a 3rd party library (which is the smart thing to do).

Anyhow, back to my point, I've been unsuccessfully trying to do this in-game. I don't suppose you're any good with graph drawing algorithms and willing to lend a helping hand?

klassekatze

#2
Unfortunately I'm not. I have not investigated Rimworld modding more directly - is it flexible enough you could do the obnoxious-but-effective solution of simply embedding a Javascript engine?  :P

Or C# graph libraries, for that matter. But I'm guessing since you said using such a library was the smart thing yet are still stymied that mods cannot do that?

If you are forced to implement one yourself the author of dagre (which I used here) has some 'recommended reading' listed at the bottom of https://github.com/cpettitt/dagre/wiki

Edit:

As obnoxious as it may be, I suggest using something like http://www.awesomium.com/ or otherwise embedding a browser, then using dagre, and appropriate javascript bindings back into your mod. That is the path with the least trial-and-error, I think - assuming of course that the output I've demonstrated is what you are aiming for. Otherwise, you will have to do a lot of suffering to implement various algorithms, or be forced to use another library blindly with no assurance it will come out the way you want until you are stuck in (at which point if it isn't what you want you've wasted a lot of time).

If done appropriately, the browser can be shut down completely when the user is not in the Research page, so it would not otherwise impact play.



Fluffy (l2032)

I've wrestled with including existing C# libraries that do this, but they are either built on C#4.0 (Unity runs 3.5), or just not good enough.

I've also implemented an efficient sugiyama algorithm, which works great but I'm getting stuck on the final placement of the nodes (creating and compressing a block graph).

I haven't yet looked into embedding a JavaScript solution, but that's actually not a terrible idea. The recommended reading list might also be useful, thanks for the link!

Sixdd

#4
So I tried this tool and it only generated a blank white page.

To clarify what I've done. I installed node.js and made sure it was added to path. I have the ResearchDiagram folder in my RimWorld folder, I ran the npminstall.bat and then ran the genResearch.bat. I got a blank page from this. I then opened the research.js file and made the changes recommended in the readme (setting a specific location for the ModsConfig.xml and setting the mod folder locations) and re-ran the genResearch.bat. In this case I did see that all of the research was being registered when running the .bat but the resulting file was still blank.

Any help is appreciated, I'd really like to be able to see the research tree without loading the whole game over and over.