IndieStone - Visual Tech Tree Editor

I just used Dragon Unpacker and loaded a barbarian archer using Photoshop with a DDS extension and got this:
 

Attachments

  • barbarcher.jpg
    barbarcher.jpg
    279.4 KB · Views: 113
I just used Dragon Unpacker and loaded a barbarian archer using Photoshop with a DDS extension and got this:

The unit textures are working fine for me, it's just the portrait atlases that don't load correctly. Very strange.
 
Yeah, I've used the GIMP DDS extension to successfully create a couple of icons that load properly as part of a mod, so I think it's working correctly. Do the unit portrait atlases in the ...\Resource\DX9\ folder open properly for you?

You need this tool to unpack some of the textures.
 
You need this tool to unpack some of the textures.

Awesome! I'll use this to make the pngs and should be able to get them into the Tech Tree Editor then.

It's the gr2 files I can't seem to get figured out. They clearly have to be converted to work with something like Blender, but I can't find anything that converts them. Even though the format (nicknamed Granny) was/is pretty common. Frustrating.

Working with gr2s is an odyssey of epic proportions. The most recent developments are from Deliverator and co. in this thread. I believe it is possible, if difficult and confusing, to import completely new models into the game.

Basic stuff like reskinning is a bit easier using NexusBuddy. I've managed to reskin a unit thanks to Deliverator's tutorial here.
 
Progress. Progress is good. I've got a lot more the expansion and DLC content displaying properly in the Tech Tree Editor now, but I'm having a lot of problems with "Unit Actions" (the whole, build a road, construct a holy site, that kind of stuff). For some reason lemmy and Captain Blinky hard coded the original build actions into a separate image file and I'm not sure why. (My attempts to work around this so far lead to crashes.) It also doesn't pick up some entries and mismatches others. (The shrine looks like a pagoda, or at least I think that's the pagoda art. It certainly isn't the shrine one.) Some images still aren't picked up even though they're definitely in the new atlases I've included. (Great admiral) And some expansion content has introduced variety where previously there was none, so the Editor didn't account for it originally. ("RESOURCE_ATLAS" was the only icon atlas that contained resources originally, and the Editor had that string hard coded in places, but there are now 4 resource atlases.) I'll keep looking around to see if I can find where the mapping of texture atlas coordinates is going wrong.

EDIT: Ok, I've fixed the texture atlas mapping coordinates. I think the decompiler had a bit of a hiccup on a specific line because the atlas reader was assuming there were 8 icons in each row of every atlas. (It did call the function to query the DB how many icons there actually were, but then didn't assign the value to anything, which makes me think it was a decompiler error.) That assumption worked for the base game atlases but DLCs and G&K added a lot of smaller ones which didn't like that much.

The only issue left now is new builds, which aren't showing up correctly because of the way builds are handled differently for some reason. (Eg. Moai and Terrace Farm don't display.)
 
I think TIs don't show up because it wasn't until the DLCs came out that we had civs with unique Tile Imps IIRC. So Lemmy and Binky didn't mess with those

Lemmy and CaptainBinky hard coded some things that were constant in the vanilla game but have since changed, and those have generally been simple fixes. But for some reason, instead of using the built in atlas like they have for every other art asset in the tech editor, for builds they seem to have built their own atlas and made this great function to deal with it:

Code:
		private KeyValuePair<Image, string> GetInfoForBuildIcons()
		{
			string value = this.row.GetProperty("Type").Value;
			string value2;
			if (value == "BUILD_RAILROAD")
			{
				value2 = "25";
			}
			else
			{
				if (value == "BUILD_ROAD")
				{
					value2 = "24";
				}
				else
				{
					if (value == "BUILD_FARM")
					{
						value2 = "21";
					}
					else
					{
						if (value == "BUILD_MINE")
						{
							value2 = "22";
						}
						else
						{
							if (value == "BUILD_TRADING_POST")
							{
								value2 = "41";
							}
							else
							{
								if (value == "BUILD_LUMBERMILL")
								{
									value2 = "28";
								}
								else
								{
									if (value == "BUILD_PASTURE")
									{
										value2 = "29";
									}
									else
									{
										if (value == "BUILD_CAMP")
										{
											value2 = "32";
										}
										else
										{
											if (value == "BUILD_PLANTATION")
											{
												value2 = "27";
											}
											else
											{
												if (value == "BUILD_QUARRY")
												{
													value2 = "26";
												}
												else
												{
													if (value == "BUILD_WELL")
													{
														value2 = "33";
													}
													else
													{
														if (value == "BUILD_OFFSHORE_PLATFORM")
														{
															value2 = "34";
														}
														else
														{
															if (value == "BUILD_FISHING_BOATS")
															{
																value2 = "35";
															}
															else
															{
																if (value == "BUILD_FORT")
																{
																	value2 = "30";
																}
																else
																{
																	if (value == "BUILD_REMOVE_JUNGLE")
																	{
																		value2 = "31";
																	}
																	else
																	{
																		if (value == "BUILD_REMOVE_FOREST")
																		{
																			value2 = "31";
																		}
																		else
																		{
																			if (value == "BUILD_REMOVE_MARSH")
																			{
																				value2 = "38";
																			}
																			else
																			{
																				if (value == "BUILD_SCRUB_FALLOUT")
																				{
																					value2 = "57";
																				}
																				else
																				{
																					if (value == "BUILD_REPAIR")
																					{
																						value2 = "36";
																					}
																					else
																					{
																						if (value == "BUILD_REMOVE_ROUTE")
																						{
																							value2 = "42";
																						}
																						else
																						{
																							if (value == "BUILD_LANDMARK")
																							{
																								value2 = "52";
																							}
																							else
																							{
																								if (value == "BUILD_ACADEMY")
																								{
																									value2 = "50";
																								}
																								else
																								{
																									if (value == "BUILD_CUSTOMS_HOUSE")
																									{
																										value2 = "55";
																									}
																									else
																									{
																										if (value == "BUILD_MANUFACTORY")
																										{
																											value2 = "54";
																										}
																										else
																										{
																											if (value == "BUILD_CITADEL")
																											{
																												value2 = "51";
																											}
																											else
																											{
																												if (value == "BUILD_CITADEL")
																												{
																													value2 = "51";
																												}
																												else
																												{
																													value2 = "0";
																												}
																											}
																										}
																									}
																								}
																							}
																						}
																					}
																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			return new KeyValuePair<Image, string>(this.im, value2);
		}

For some reason I've yet to understand, the base atlas seems to crash the editor. :(
 
Ok, the above issue, though annoying, is arguably only cosmetic. The new builds do show up, just with a "cancel" icon instead of their actual icon, and they still appear to be editable.

So, without further ado, I present the Visual Tech Tree Editor, updated for Gods & Kings! I haven't yet done thorough testing of the XML generated by the newly decompiled and fixed program, so if anyone finds any fun errors, then let me know and I'll look into them.

I've only made one 'feature tweak' aside from making the Editor cooperate with G&K. The Editor used to flag units/techs that came from DLC files with a "DLC" logo. Because G&K is technically DLC (in terms of file structure), it flagged basically everything as DLC at first, so I've simply removed that label.

Also, in the event that I disappear off into the sunset, I've attached the source code for the Tech Tree Editor to this post if anyone wants to pick it up at some later date.

EDIT: In the event that you're seeing an error when you start up the tech tree editor similar to this one, this may be a simple configuration error that you can fix! If you haven't got the SDK installed then install the SDK and run ModBuddy. When prompted for an asset path, you want to point it at the base of your CivV install (not at the Asset folder). That's usually something like this:

C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\

If you have the SDK installed and have used ModBuddy before but the tech editor still crashes when you open it, your asset path may be set incorrectly. Run regedit and check the following registry keys are set to your base CivV directory:

ToolAssetPath in HKEY_CURRENT_USER\Software\Firaxis\Tools
GameBuild in HKEY_CURRENT_USER\Software\Firaxis\Nexus\Civ5Settings
InstallPath in HKEY_CURRENT_USER\Software\Wow6432Node\Firaxis\Civilization5
InstallPath in HKEY_CURRENT_USER\Software\Firaxis\Civilization5
 

Attachments

Spoiler :

************** Exception Text **************
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at IndieStoneTechEditor.Form1.clearAllTechsToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Crashes on load for me :(
 
Spoiler :

************** Exception Text **************
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at IndieStoneTechEditor.Form1.clearAllTechsToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Crashes on load for me :(

My mistake, I'd left an absolute file path in one of the assembly references. I've uploaded a new version, which works on another machine for me. (I really should've checked that first.) Does it work for you now?
 
Another error :(

Spoiler :

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\Assets\Assets\DLC\Expansion'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.CommonInit()
at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
at System.IO.Directory.GetFiles(String path)
at IndieStoneCiv5XMLTools.Civ5XmlDatabase.LoadDir(String s)
at IndieStoneCiv5XMLTools.Civ5XmlDatabase.Load()
at IndieStoneTechEditor.TechTree.FirstUpdate()
at IndieStoneTechEditor.TechTree.panel1_Paint(Object sender, PaintEventArgs e)
at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 
Another error :(

Spoiler :

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\Assets\Assets\DLC\Expansion'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.CommonInit()
at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
at System.IO.Directory.GetFiles(String path)
at IndieStoneCiv5XMLTools.Civ5XmlDatabase.LoadDir(String s)
at IndieStoneCiv5XMLTools.Civ5XmlDatabase.Load()
at IndieStoneTechEditor.TechTree.FirstUpdate()
at IndieStoneTechEditor.TechTree.panel1_Paint(Object sender, PaintEventArgs e)
at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

That looks like your asset path for Civ on your machine is incorrect. (Or at least I think it's incorrect. It isn't what the tech editor is expecting.) Have you used Nexus or NexusBuddy or any of the art related tools before? If so, they all work correctly?

Otherwise, can you use regedit to check HKEY_CURRENT_USER\Software\Firaxis\Tools and then change ToolAssetPath to the base of your Civ directory (for me this is: E:\Games\SteamApps\common\Sid Meier's Civilization V ) instead of directly into the Asset folder. That should hopefully fix it.

As far as I know, having the asset path set directly into the Asset folder (confusingly) stops Nexus and NexusBuddy from working correctly. (Well, in Nexus's case, more incorrectly than normal.)
 
That worked. That is a pretty powerful tool.

Awesome! :D Glad it's working. I'm amazed by what lemmy and CaptainBinky did, I only really had to tweak a few files to adapt it to G&K, they'd written an amazing amount of code to actually get it working in the first place.
 
When I ran the Tech Tree Editor for G&K it said this: (in attachments)

ERROR that came up:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Deborah\Desktop\Assets\DLC\Expansion'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.CommonInit()
at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
at System.IO.Directory.GetFiles(String path)
at IndieStoneCiv5XMLTools.Civ5XmlDatabase.LoadDir(String s)
at IndieStoneCiv5XMLTools.Civ5XmlDatabase.Load()
at IndieStoneTechEditor.TechTree.FirstUpdate()
at IndieStoneTechEditor.TechTree.panel1_Paint(Object sender, PaintEventArgs e)
at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
IndieStoneTechEditor
Assembly Version: 0.0.0.0
Win32 Version: 0.0.0.0
CodeBase: file:///C:/Users/Deborah/Downloads/indiestonetecheditor/IndieStoneTechEditor/IndieStoneTechEditor.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
IndieStoneTools
Assembly Version: 0.0.0.0
Win32 Version: 0.0.0.0
CodeBase: file:///C:/Users/Deborah/Downloads/indiestonetecheditor/IndieStoneTechEditor/IndieStoneTools.DLL
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
 

Attachments

  • Capture.PNG
    Capture.PNG
    153.4 KB · Views: 59
Do you have the SDK installed and have you opened ModBuddy and given it the CivV Asset path? (It should ask for an asset path the first time you open ModBuddy.) The Asset path for your machine is probably C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\

That error looks like the Tech Editor is defaulting to a relative file path, which means it couldn't find the path to your CivV directory in the registry.
 
S3rgeus: you managed to make this mod workable? Amazing, thank you so much! I'd lost hope I would get to easily edit the Tech Tree, and by extension ever be able to make a mod I've been planning (I'm not very good at modding, so any tool making it easier for me is very important ;) ). I stumbled upon this thread again only by accident. I hope the tool will work for me - I'm unable to check that right now, but I will as soon as I can.

Incidentally - when the new expansion comes out, do you think you will try and make the tool workable for that, as well? Because that would be even greater =)
 
Back
Top Bottom