Ludeon Forums

Ludeon Forums

  • April 21, 2019, 12:42:11 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 4

Author Topic: [TOOL A8-15] RimSearch (Updated 11.07.2016) - The Research Tree Graph Generator  (Read 17917 times)

1000101

  • Super Modder
  • Planetologist
  • ***
  • Posts: 1344
  • RimFortress Builder
    • View Profile

Currently compatible with RimWorld Alpha 8 through Alpha 15 (A8-A15).



RimSearch is a tool for creating a nice neat png of your research tree based on your current set of mods.

This tool looks at your active mod list and generates a research tree graph.  Once the tree is generated, you have the option to move nodes around within their own level, the level is determined by the research prerequisites.  After you are satisfied with the changes, press [enter] to export to a png (RimSearch.png) or [escape] to exit without exporting.  Currently does not save node placement changes except as the finalized bitmap.

There are two small windows which will give you information while editing the tree.  One is the control window which simply lets you know the editors controls and the other is the info window which will tell you about a selected research tech.  This window also includes a list of the files which define the research and you can load the xml directly by clicking on the file in the info window.

Place RimSearch in the same directory as your RimWorld application directory (where RimWorld[Version][Platform][.exe] is located) and launch it from there.

changelog
Code: [Select]
Updated 11.07.2016

Adds support for A14.  ("totalCost" is now "baseCost")
Backwards compatible with older versions (looks for "totalCost" (A8-13) then "baseCost" (A14) if it's not found).

Updated 20.04.2016

The program will now check for abstract parents within a single file, no bad-xml cross-file-cross-references for abstract parents.  Would need to completely re-write the tool for this to happen.  Tested against RimWorld Alpha 13 (build 1135).

Updated 14.08.2015

Adds child high-lighting to show where a tech will lead to.  Helpful for users when deciding what branch of a complex tree they want to research next.
Added full source and project file of RimSearch.  This will probably be the last update of this version of the program.

Updated 28.07.2015

Fix so xml files will open properly.  I derped in some of my code changes.

Updated 28.07.2015

Added support for full directory structure transversal. (/MyMod/Defs/ResearchDefs/Some/Weird/Path/ToMy/File.xml)
Info window now truncates the displayed xml file path so the window doesn't become huge. (MyMod...File.xml)
Fixed small bug with selected/highlighted research being exported with the selection highlights.
Directly exports a png instead of a bmp.
Control window will move itself to a different corner of the screen if the mouse gets too close.
No longer opens a console window and by default does not log.  Logging can be enabled by the /lF[:Filename] command-line switch.

Updated 09.06.2015

Changed colour scheme (still hard-coded), improved UI (highlights tech tree on selected/hovered tech).

F5 reloading of all xml!

New Info Window!  Tells you:
Cost of research
Total Research to Tech (cost of all parent research plus itself)
xml files which define the research, click on a file to load it in your xml editor!

Updated 09.06.2015

Bug-fix for research with no prerequities tag.  Code was correct, compiler generated bugged output.

Updated 08.06.2015

Program now properly prunes extraneous branches which could be shared between techs with the same children.

Updated sample pic to show a heavily modified research tree.

Updated 08.05.2015

Added UI which allows final editing of bitmap before exporting or discarding changes.

Updated 14.04.2015

Now loads BOM encoded files properly!  No need to convert, should work out of the box.

Place RimSearch.exe in your RimWorld directory.
Execute it.
It will dump a log to the console and RimSearch.log.
When it says "Done", press any key to close the window.
It will now write RimSearch.bmp.

Outputs RimSearch.log and RimSearch.bmp

Updated 10.04.2015

Provides a much cleaner output.  See attached.  Sorry still about UTF-8 w/o BOM, I'll port the sources now that I have the "dirty" logic done.

[attachment undeleted due to age not being too old as I had uploaded replacements but the SQL query is too limited to get access modifiers]

[attachment deleted by admin - too old]
« Last Edit: November 18, 2016, 08:19:46 AM by 1000101 »
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mrofa

  • Planetologist
  • ****
  • Posts: 1666
  • Squirrel Hunter
    • View Profile

Nice idea, but it hangs on core research
Logged
All i do is clutter all around.

1000101

  • Super Modder
  • Planetologist
  • ***
  • Posts: 1344
  • RimFortress Builder
    • View Profile

Nice idea, but it hangs on core research

Quote
Crappy xml library I used (this was done quick'n'dirty in *cough*).

If your XML file is encoded differently, it will let you know by crashing.

Yeah, you need to convert your xml encoding from UTF8 to UTF8 without BOM.  I plan on re-writing this in a better language which will obviate this need.  I coded it in freeBASIC using the ext library and freeBASIC has limited support for UTF (read: virtually non-existant).

Now that I have the logic complete I plan on re-coding it in C# (both to make it so it can read the xml and to improve my C# skills).

Anyway, if you take the 30 seconds to convert the encoding (RimWorld doesn't care/need about BOM in the mod xml files), it's actually a powerful tool for validating your mods research tree.  After convering EPOE I noticed it had redundant research links (if C needs B and B need A, C doesn't explicitly need A), see the bottom of the first posts RimSearch.png (simple prosthetics).

Now that I have the bridges properly joining I will hopefully get this converted "soon" but there are some major language differences.

Lastest update (bridges join properly) and sample output from mod I am working on (which completely redefines the tech-tree):

[attachment deleted due to age]
« Last Edit: April 14, 2015, 05:03:07 AM by 1000101 »
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mrofa

  • Planetologist
  • ****
  • Posts: 1666
  • Squirrel Hunter
    • View Profile

Soo whats a Bom in this <?xml version="1.0" encoding="utf-8" ?> :P ?
Logged
All i do is clutter all around.

bvierra

  • Muffalo
  • *
  • Posts: 19
  • Refugee
    • View Profile
    • Planet RimWorld

This should help some.

Download the attached file and extract it to your RimWorld Directory (you can see what it does by editing it in a text editor) along with the RimSearch.exe. Then open up a powershell prompt and run the following (please not this can have security implications, however in order to run a powershell script you have downloaded you need to):

Code: [Select]
Set-ExecutionPolicy -scope currentuser bypass
All this does is allow the current user to execute downloaded powershell scripts.

You then need to change the directory to where RimWorld is located, on my machine it is at ""

Code: [Select]
cd D:\Games\RimWorld\RimWorld727Win
Then you want to run the script, which will remove any XML BOM encodings from your ModsConfig.xml in your profile as well as all xml files in your RimWorld directory.

Code: [Select]
.\removebom.ps1
you should see the following output:

Code: [Select]
Removing UTF8BOM from ModsConfig.xml
Removing UTF8BOM from all xml files in current directory recursively
...
Building research links...
 Building relationship tree...
 Building node reference list...
 Adding bridges...
 Sorting nodes...
 Assigning node render placement...
 Done

If you press any key it will export the image to RimSearch.bmp

I do not take credit for the removal of the BOM script, all due credit is in the script itself.

[attachment deleted due to age]
« Last Edit: April 14, 2015, 03:49:17 AM by bvierra »
Logged
Planet RimWorld Mods - http://mods.planetrimworld.com

1000101

  • Super Modder
  • Planetologist
  • ***
  • Posts: 1344
  • RimFortress Builder
    • View Profile

Soo whats a Bom in this <?xml version="1.0" encoding="utf-8" ?> :P ?

The BOM is the first three (hidden) bytes of the file - 0xEF, 0xBB, 0xBF.  It's the Byte Order Mark.

Updated, now I manually load the xml, check for BOM and just skip those bytes when passing the zstring to the xml parser.  Seems to work fine.
« Last Edit: April 14, 2015, 04:58:19 AM by 1000101 »
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mrofa

  • Planetologist
  • ****
  • Posts: 1666
  • Squirrel Hunter
    • View Profile

So one more thing, throw some message "Press button to export to bmp", since if i wouldnt read  bvierra post i wouldnt know that :D
Apart from that its AWSOME! 

And a question, wont de BOMing break the game or something ?
Logged
All i do is clutter all around.

1000101

  • Super Modder
  • Planetologist
  • ***
  • Posts: 1344
  • RimFortress Builder
    • View Profile

It doesn't deBOM the file and it no longer requires the files to be deBOMed.

When RimSearch says it's "DeBOM...", it's just doing some pointer math to skip the 3 BOM bytes at the start before passing the memory block to the xml parser.  No actual conversion takes place.

And RimWorld itself doesn't care if the Research.xml's are marked BOM or not since the BO they are encoded in is the native machine endian (x86 uses little-endian which is what RimWorld wants).
« Last Edit: April 14, 2015, 06:15:17 AM by 1000101 »
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mrofa

  • Planetologist
  • ****
  • Posts: 1666
  • Squirrel Hunter
    • View Profile

I wonder would it be to much work to be able to put custom templates for backgroud, research fonts, research box and the connetion lines ?
Logged
All i do is clutter all around.

1000101

  • Super Modder
  • Planetologist
  • ***
  • Posts: 1344
  • RimFortress Builder
    • View Profile

heh, after I convert the source, sure.

Right now it's kind of hard-coded and uses the standard 8x8 bitmap console font with a 200x48 "exclusive zone" per node.  Connection line colours are just randomly picked, however bridges always use their parents colour.  I also want to make it so you can move nodes up and down in a level group, etc, etc.

But, I do appreciate your feedback since you are one of the "veterans" of RimWorld modding.  I hope you find some small use for this (and I know I did while designing my tech-tree).
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mrofa

  • Planetologist
  • ****
  • Posts: 1666
  • Squirrel Hunter
    • View Profile

Well im thinkering a research for clutter atm and even with its current fuction i would say its a must have for research :)
Logged
All i do is clutter all around.

1000101

  • Super Modder
  • Planetologist
  • ***
  • Posts: 1344
  • RimFortress Builder
    • View Profile

Updated to be "more" user friendly.  Now 0.000000000001% easier to use.
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mrofa

  • Planetologist
  • ****
  • Posts: 1666
  • Squirrel Hunter
    • View Profile

Its crashing now on reading modconfig.xml
Logged
All i do is clutter all around.

1000101

  • Super Modder
  • Planetologist
  • ***
  • Posts: 1344
  • RimFortress Builder
    • View Profile

What the derp...?

Can you send me the log file?  Perhaps I've borked something which doesn't show up for me...
Logged
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

mrofa

  • Planetologist
  • ****
  • Posts: 1666
  • Squirrel Hunter
    • View Profile

Code: [Select]
RimSearch

Mod directory: Mods\

Building library...

Locating ModsConfig.xml...
xml: C:\Users\Mrowa\AppData\LocalLow\Ludeon Studios\RimWorld\Config\ModsConfig.xml...

It shows this and i get good old windows error that application crashed.

old versions work thrugh :P
Logged
All i do is clutter all around.
Pages: [1] 2 3 4