Visualizing the tech tree

A forum for chatting about in-development game features.
Post Reply
User avatar
SirDamnALot
Posts: 228
Joined: Thu Mar 10, 2016 5:10 pm
Location: Germany

Visualizing the tech tree

Post by SirDamnALot »

I was playing around with the tech tree file and wrote a little knick knack to make an actual tree out of the lists.
Written in Delphi, because I don't know squat about Lua ;)
7-Zip
http://www.fastshare.org/download/SiS_TechTree_Visu_01..7z
Alternate zip
http://www.fastshare.org/download/SiS_TechTree_Visu.zip

Unzip the file in your SiS directory (where sis.exe is) and run it. It should find the tech tree file from there on its own.
You can snoop around the techs and see their descendands and requirements, but that is not the actual purpose.
Untitled.png
Untitled.png (20.01 KiB) Viewed 14164 times


The real work is the TechTree.png it should have written in your game directory:
(Zoomed out)
Untitled2.png
Untitled2.png (169.22 KiB) Viewed 14164 times


It is not very easy to read (many cross dependencies between science fields) but I had fun writing the thing :mrgreen:
User avatar
sven
Site Admin
Posts: 1621
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Visualizing the tech tree

Post by sven »

SirDamnALot wrote:I was playing around with the tech tree file and wrote a little knick knack to make an actual tree out of the lists.
Written in Delphi, because I don't know squat about Lua ;)
http://www.fastshare.org/download/SiS_TechTree_Visu_01..7z


Very cool! My version of 7zip is having trouble with that archive, so I can't actually test out the program. But, as I developer, having players who are excited enough about the game to build these kinds of mods and addons suggests that we are indeed on the right track :)

edited by sven: Got it working! I think the problem may have actually had to do with an interaction between fastshare.org and chrome.

From the screenshot, it looks like your Delphi script may be having some trouble parsing the @TECHNOLOGY.lua file (there is no tech in the game called 'haduir' ;)). I could write a little hack to output the core tech tree directed acyclic graph (DAG) to some kind of easily digestible format. I actually already have one such hack written up -- as I was exporting to graphviz's DOT format for the alpha-version tech tree visualizations. We could use something other than DOT though. Is delphi happy parsing JSON?
User avatar
SirDamnALot
Posts: 228
Joined: Thu Mar 10, 2016 5:10 pm
Location: Germany

Re: Visualizing the tech tree

Post by SirDamnALot »

sven wrote:
SirDamnALot wrote:I was playing around with the tech tree file and wrote a little knick knack to make an actual tree out of the lists.
Written in Delphi, because I don't know squat about Lua ;)
http://www.fastshare.org/download/SiS_TechTree_Visu_01..7z


Very cool! My version of 7zip is having trouble with that archive, so I can't actually test out the program. But, as I developer, having players who are excited enough about the game to build these kinds of mods and addons suggests that we are indeed on the right track :)

From the screenshot, it looks like your Delphi script may be having some trouble parsing the @TECHNOLOGY.lua file (there is no tech in the game called 'haduir' ;)). I could write a little hack to output the core tech tree directed acyclic graph (DAG) to some kind of easily digestible format. I actually already have one such hack written up -- as I was exporting to graphviz's DOT format of the core DAG for some of the easly alpha-version tech tree visualizations. We could use something other than DOT though. Is delphi happy parsing JSON?

Yeah, it stumbles a bit with the race specialities like

Code: Select all

tech "Ancient Control Systems" | race_specific {'haduir'}  {

The parser is very very simple, I scan line-wise for key words like typelist or tech and go from there with the single quotes for the name.
So the haduir are a false positive.

There should be a JSON unit for Delphi, but I never used it so far.
User avatar
sven
Site Admin
Posts: 1621
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Visualizing the tech tree

Post by sven »

SirDamnALot wrote:The parser is very very simple, I scan line-wise for key words like typelist or tech and go from there with the single quotes for the name.
So the haduir are a false positive.

There should be a JSON unit for Delphi, but I never used it so far.


Ok, I'll think a little more about this. The fastest and easiest output format for me would probably be very simple pretty-printed Lua tables -- something where rolling a quick parser in whatever language would be easy. At a minimum, any export format would need arrays and associative tables though -- so maybe JSON is the most universally compatible option. I've written Lua\JSON table conversions before. That wouldn't be a big deal. Um, check back tomorrow. I may write up something quick before I go to bed, provided I can get all my more urgent TODOs dealt with :)
User avatar
sven
Site Admin
Posts: 1621
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Visualizing the tech tree

Post by sven »

SirDamnALot wrote:It is not very easy to read (many cross dependencies between science fields) but I had fun writing the thing :mrgreen:


Oh, and also, just because I didn't say so loudly before -- very nice work with the graph formatting. Fully automated graph visualization is hard to do well, and the outputs you're getting look way nicer than the graph-viz images I was generating back in the day. So kudos :)
User avatar
SirDamnALot
Posts: 228
Joined: Thu Mar 10, 2016 5:10 pm
Location: Germany

Re: Visualizing the tech tree

Post by SirDamnALot »

sven wrote:
SirDamnALot wrote:The parser is very very simple, I scan line-wise for key words like typelist or tech and go from there with the single quotes for the name.
So the haduir are a false positive.

There should be a JSON unit for Delphi, but I never used it so far.


Ok, I'll think a little more about this. The fastest and easiest output format for me would probably be very simple pretty-printed Lua tables -- something where rolling a quick parser in whatever language would be easy. At a minimum, any export format would need arrays and associative tables though -- so maybe JSON is the most universally compatible option. I've written Lua\JSON table conversions before. That wouldn't be a big deal. Um, check back tomorrow. I may write up something quick before I go to bed, provided I can get all my more urgent TODOs dealt with :)


Oh thats cool :D I hope I am not distracting you too much, I can update the parsing part from my side too.
(e.g. reading parts & hulls and other tech upgrades from the tech tree file)

sven wrote:
SirDamnALot wrote:It is not very easy to read (many cross dependencies between science fields) but I had fun writing the thing :mrgreen:


Oh, and also, just because I didn't say so loudly before -- very nice work with the graph formatting. Fully automated graph visualization is hard to do well, and the outputs you're getting look way nicer than the graph-viz images I was generating back in the day. So kudos :)

Thanks! As a "tool" guy, my visual stuff looks mostly terrible :mrgreen:
(I've written an unit editor for the game Naval Warfare: Arctic Circle and a combat helper tool for the pen & paper RPG shadowrun 5.
And they all look terrible :lol: )
User avatar
sven
Site Admin
Posts: 1621
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Visualizing the tech tree

Post by sven »

SirDamnALot wrote:
sven wrote:Ok, I'll think a little more about this. The fastest and easiest output format for me would probably be very simple pretty-printed Lua tables -- something where rolling a quick parser in whatever language would be easy. At a minimum, any export format would need arrays and associative tables though -- so maybe JSON is the most universally compatible option. I've written Lua\JSON table conversions before. That wouldn't be a big deal. Um, check back tomorrow. I may write up something quick before I go to bed, provided I can get all my more urgent TODOs dealt with :)


Oh thats cool :D I hope I am not distracting you too much, I can update the parsing part from my side too.
(e.g. reading parts & hulls and other tech upgrades from the tech tree file)


Ok, here's a super-simple pretty-printed version of the internal TECHNOLOGY table. It takes out all the shorthand and functional programming tricks in ~TECHNOLOGY.lua, and just gives you the raw data. (This takes about 10 seconds for me to export.)

Let me know how Delphi feels about parsing that. If I can get 20 minutes to mess around, I can output a JSON version of the same table. Also, if there are other internal tables you'd like access to, I could write a little hack that would tell sis.exe to dump arbitrary internal data table to JSON/Lua, if given certain command line-options, potentially opening up a whole world of unix-style utility hacks, for those of you inclined to write such things :)
User avatar
sven
Site Admin
Posts: 1621
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Visualizing the tech tree

Post by sven »

sven wrote:Ok, here's a super-simple pretty-printed version of the internal TECHNOLOGY table. It takes out all the shorthand and functional programming tricks in ~TECHNOLOGY.lua, and just gives you the raw data. (This takes about 10 seconds for me to export.)


And here's a JSON encoding. It's worth being aware that JSON only supports string keys in its assosiative arrays, while Lua allows you to mix integer keys with other key types, bluring the line between "arrays" and more general "tables". There are a few places where the TECHNOLOGY table includes mixed integer and string keys, specifically, the "prereq" tables, which may include a list of other tech prereqs, plus a "type" field that will be either "all_of" or "one_of", depending on the nature of the prereq.

In these cases, I've told my JSON exporter to convert the integer keys to strings, so the lua table:

Code: Select all

  {
      "Hadron Cohesion",
      "Plasma Focusing",
      "Zero-Point Energy",
      type = "all_of"
  }


Is converted to JSON as:

Code: Select all

  {
   "1": "Hadron Cohesion",
   "2": "Plasma Focusing",
   "3": "Zero-Point Energy",
   "type": "all_of"
  }


Which is a little weird. But working around that may well be easier than trying to find a parser that can handle generic Lua tables. Um, in any case, happy coding :)
User avatar
SirDamnALot
Posts: 228
Joined: Thu Mar 10, 2016 5:10 pm
Location: Germany

Re: Visualizing the tech tree

Post by SirDamnALot »

sven wrote:Ok, here's a super-simple pretty-printed version of the internal TECHNOLOGY table. It takes out all the shorthand and functional programming tricks in ~TECHNOLOGY.lua, and just gives you the raw data. (This takes about 10 seconds for me to export.)

Let me know how Delphi feels about parsing that. If I can get 20 minutes to mess around, I can output a JSON version of the same table. Also, if there are other internal tables you'd like access to, I could write a little hack that would tell sis.exe to dump arbitrary internal data table to JSON/Lua, if given certain command line-options, potentially opening up a whole world of unix-style utility hacks, for those of you inclined to write such things :)

Thanks! The TECHNOLOGY.table looks super easy to read for a line parser :)
Happy to hear that this can be an easy by-product for the engine =)
Maybe I can do an update to my tool this weekend.
User avatar
SirDamnALot
Posts: 228
Joined: Thu Mar 10, 2016 5:10 pm
Location: Germany

Re: Visualizing the tech tree

Post by SirDamnALot »

Sorry for my late reply, I've been quite busy with work and stuff.

But at least I can give a little update:
http://www.fastshare.org/download/SiS_TechTree_Visu_02..7z
Unlocked Designs, Parts, etc are shown in the diagram.

TechTree.jpg
TechTree.jpg (122.05 KiB) Viewed 14070 times
User avatar
Captainspire
Posts: 153
Joined: Mon Mar 30, 2015 8:30 pm

Re: Visualizing the tech tree

Post by Captainspire »

Would it be alright if I tried to make it all pretty and graphical?
User avatar
SirDamnALot
Posts: 228
Joined: Thu Mar 10, 2016 5:10 pm
Location: Germany

Re: Visualizing the tech tree

Post by SirDamnALot »

Captainspire wrote:Would it be alright if I tried to make it all pretty and graphical?

By all means, go nuts =)

Here is my project folder in case that helps:
http://www.fastshare.org/download/SiS.zip
Post Reply