Getting Civ 4 Units into Civ 5 - Full Conversion

I can't get the Nexus to work. I followed the instructions in the first page (from Nutty and Deliverator) but I'm still stuck. I either get 'The Viewer application could not attac to Nexus' even with Nexus open; 'The Viewer has closed unexpectedly. Would you like to restart?'; or I get this report when I try to go ahead and open the .fxsxml anyway:

Spoiler :
Application: Nexus
User: Unkown (Not an in-house user.)
Time: Sunday 20/07/2014 02:12:32

Runtime: 64 bit
OS: Windows 2008 (Service Pack 1)
Machine: MAINROOM3

Exception: System.Xml.XmlException
Source: System.Xml
Thread: Main Thread
Description: There are multiple root elements. Line 2, position 2.

Stack Trace:
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at Firaxis.Framework.XmlDoc..ctor(String fileName)
at Firaxis.Framework.XmlDoc.LoadFromVirtualSpace(String file)
at Civ5NexusModes.AssetViewer.AssetViewForm.LoadAsset(String pending_asset)
at Civ5NexusModes.AssetViewer.AssetViewForm.set_Asset(String value)
at Firaxis.Framework.ToolStripOpenButton.ToolStripOpenButton_ButtonClick(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripSplitButton.OnButtonClick(EventArgs e)
at System.Windows.Forms.ToolStripSplitButton.OnMouseUp(MouseEventArgs e)
at Firaxis.Framework.ToolStripOpenButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.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.ToolStrip.WndProc(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)


When I click the Nexus I get Steam running and it offers me to start Civ5 as well. If I do click in one of the two DX options I get Steam trying to run Civ5 AGAIN and it gives me an error telling me how stupid I am to try to get a game running that is already running.

After a while I actually got the Nexus to run the 3D Viewer alone (it was usually greyed-out), but when I go to the Asset Viewer it gives me the aforementioned report 'Thanks for Playing' and closes it all.

If you are using Windows, did you modify the registry?

This is what my regedit looks like (I have the old copy of Nexus in the same directory as the original with "_old" concatenated after it):

[HKEY_CURRENT_USER\Software\Firaxis\Nexus\Viewer]
"Executable"="C:\\Program Files (x86)\\Steam\\steamapps\\common\\sid meier's civilization v sdk_old\\Nexus\\x86"
"AssetPath"="C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sid Meier's Civilization V"

[HKEY_CURRENT_USER\Software\Firaxis\Tools]
"ToolAssetPath"="C:\\Program Files (x86)\\Steam\\steamapps\\common\\Sid Meier's Civilization V"


Your necessary regedit paths may vary if:
-You are not using Windows
-You are not using Steam
-The name of your directory where the old version of Nexus resides differs from above.

Please modify your registry accordingly. If you set the registry settings correctly, the CiV intro panel will still come up but will not give you the error (Nexus needs the CiV engine running in order to work).
 
Yes, I did. :\
I had the same path for Executable and AssetPath, but after modifying accordingly I still get a report and the 'Viewer application could not attach to Nexus'.

This time, though, I tried with 3 different unit's *.fxsxml: whoward's Earth Spirit from the Morindim Civilizations, bouncymisha's Zombie from TouhouMod and ViceVirtuoso's Incubator from Madoka Magica Civilization Pack - which he successfully viewed as seen in page #1, indicating the problem is here with me.


Nope, forget it.
I can see epicss' Aragorn and Elf units. Too bad I can't see my own. :(

The report says it's a "Overflow error":
Spoiler :
Exception: System.OverflowException
Source: System.Drawing
Thread: Main Thread
Description: Overflow error.

Stack Trace:
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
at Firaxis.Framework.DrawingHelper.DrawImage(Graphics g, Image image, Single x, Single y, Int32 width, Int32 height, ColorMatrix m)
at Firaxis.Framework.DrawingHelper.DrawImageCentered(Graphics g, Image image, Single x, Single y, ColorMatrix m)
at Firaxis.Framework.StateGraphControl.PaintNub(Graphics g, IGraphNub nub, StringFormat sf)
at Firaxis.Framework.StateGraphControl.PaintNubs(Graphics g)
at Firaxis.Framework.StateGraphControl.PaintWorkspace(Graphics g, Rectangle rect)
at Firaxis.Framework.WorkspaceControl.WorkspaceControl_Paint(Object sender, PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(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)


The same it did when I tried one of three I mentioned earlier (don't remember which).
 
If my animation doesn't automatically get the 90º rotation fix, how do I manually correct it?
I manually rotated him with "R -> Y" but it still is wrong in-game (his is facing the ground).

When you exported the unit to .fbx, did you have -90 Rotation selected (it is by default). Second, after you completed the export did you see the unit rotate in Blender? If you didn't, you may need to do it manually. Go into edit mode with each object and perform a manual rotation, then export the animation to .fbx. Test it in Granny to make sure it rotates before you do all of them; I have had a problem with some Atlantica Online object that would deform after rotation because the animations do not have a common root point. Hopefully you will not have that problem.
 
When you exported the unit to .fbx, did you have -90 Rotation selected (it is by default).
Yes.
Second, after you completed the export did you see the unit rotate in Blender?
Nope.

Go into edit mode with each object and perform a manual rotation, then export the animation to .fbx.
I manually rotated him with "R -> Y" but it still is wrong in-game.
I tried 90ºY, -90ºY, 90ºX, -90ºX, 180ºY. All of them with the -90 selected and unselected.
There must be some other step I am missing, because doesn't matter which orientation I change, the animation keeps facing the ground.
What if I make the model with the -90Y 'fix', would that change anything?

Test it in Granny to make sure it rotates before you do all of them;
Believe it or not, I wasn't doing this. :blush:
I opened the game to test it each time. :lol:


EDIT:
Also, I swear this one seemed pretty simple at the beginning. Everything worked until now.
 
I manually rotated him with "R -> Y" but it still is wrong in-game.
I tried 90ºY, -90ºY, 90ºX, -90ºX, 180ºY. All of them with the -90 selected and unselected.
There must be some other step I am missing, because doesn't matter which orientation I change, the animation keeps facing the ground.
What if I make the model with the -90Y 'fix', would that change anything?

I think I'm seeing the same issue with civ4 leaderheads
 
Yes.

Nope.


I manually rotated him with "R -> Y" but it still is wrong in-game.
I tried 90ºY, -90ºY, 90ºX, -90ºX, 180ºY. All of them with the -90 selected and unselected.
There must be some other step I am missing, because doesn't matter which orientation I change, the animation keeps facing the ground.
What if I make the model with the -90Y 'fix', would that change anything?


Believe it or not, I wasn't doing this. :blush:
I opened the game to test it each time. :lol:


EDIT:
Also, I swear this one seemed pretty simple at the beginning. Everything worked until now.

I am having the same problem with an Atlantica Online unit that uses custom animations. I haven't figured out why yet.
 
I manually rotated him with "R -> Y" but it still is wrong in-game.
I tried 90ºY, -90ºY, 90ºX, -90ºX, 180ºY. All of them with the -90 selected and unselected.
There must be some other step I am missing, because doesn't matter which orientation I change, the animation keeps facing the ground.
What if I make the model with the -90Y 'fix', would that change anything?

Have you tried Ctrl-A and selecting Scale and Rotation to ObData to make your rotation permanent?
 
If I do it to the skeleton before changing the orientation, nothing happens, if I do it AFTER it goes bat***crazy and gets all weird, upside-down and with the body parts all wrong:
Untitled.gif
Maybe I can get to something from here, though.

I may have done something wrong at some point, so if I can't make it right this time, I'll redo it from the beginning.
 
If I do it to the skeleton before changing the orientation, nothing happens, if I do it AFTER it goes bat***crazy and gets all weird, upside-down and with the body parts all wrong:
View attachment 379354
Maybe I can get to something from here, though.

I may have done something wrong at some point, so if I can't make it right this time, I'll redo it from the beginning.

OK, I have encountered this problem before and this is how I solved it:

In the original .blend file that you imported from a .nif (with no animations), you will have problems with any transforms that you do (move, rotate, scale) if all objects do not have the same point of origin (loc = 0,0,0; scale = 1,1,1; rot = 0,0,0) in object mode. Select on an object and press the N key to see transform properties. For example, if an object has a loc of x=0, y= 1.95, z= 0.5, when you perform a manual rotation at 0,0,0 the transformation for that object will deform with respect to its deviation from the rotation point. Ctrl+A will take care of the scale and rotation - but not the location. So, you need to move the object in object mode accordingly until it is at 0,0,0 (in the example, -1.95 in the y axis and -0.5 in the z axis; you will see a pink dot where the object origin point is located). THEN go into edit mode and move the vertices BACK the same distance as you moved them in each plane (so, 1.95 in the y, 0.5 in the z for the given example). This will place your object at "true" zero but move the mesh back to where it is supposed to be. Use CTRL+A to apply scale+rot and repeat this process for all remaining objects that aren't at true zero. Once this is done you should be able to manually rotate the animations -90 on the global x-axis without any object deformation. Always make sure your pivot is set to "3d Cursor" and that your cursor is snapped to the origin when performing scale or rotation transformations!

Second, the animations are based upon the skeleton in its original formation. That means that any transformations you make to the bones (not the mesh) will impact how the animations respond. So, save the .nif BEFORE you make the -90 rotation (after moving the mesh objects) and use that .nif for each animation. Once the animation is loaded you will need to manually rotate them accordingly and then export to .fbx. This is the only way I have ever been able to successfully get existing custom animations to work properly if they have the problem you are encountering (if someone knows a better way I would love to hear it).
 
Wow.Nomad how did you figure that one out? I'm sure its tedious as it reads so I might have to wait before I try another leader with it.

I figured it out after spending countless days encountering the same problem with this unit. I am still having issues with the scaling; I think it is because I need to add an object modifier to one of the objects (the other objects scale fine). If I figure that out I will let you know....
 
OK, I have encountered this problem before and this is how I solved it:

In the original .blend file that you imported from a .nif (with no animations), you will have problems with any transforms that you do (move, rotate, scale) if all objects do not have the same point of origin (loc = 0,0,0; scale = 1,1,1; rot = 0,0,0) in object mode. Select on an object and press the N key to see transform properties. For example, if an object has a loc of x=0, y= 1.95, z= 0.5, when you perform a manual rotation at 0,0,0 the transformation for that object will deform with respect to its deviation from the rotation point. Ctrl+A will take care of the scale and rotation - but not the location. So, you need to move the object in object mode accordingly until it is at 0,0,0 (in the example, -1.95 in the y axis and -0.5 in the z axis; you will see a pink dot where the object origin point is located). THEN go into edit mode and move the vertices BACK the same distance as you moved them in each plane (so, 1.95 in the y, 0.5 in the z for the given example). This will place your object at "true" zero but move the mesh back to where it is supposed to be. Use CTRL+A to apply scale+rot and repeat this process for all remaining objects that aren't at true zero. Once this is done you should be able to manually rotate the animations -90 on the global x-axis without any object deformation. Always make sure your pivot is set to "3d Cursor" and that your cursor is snapped to the origin when performing scale or rotation transformations!

Second, the animations are based upon the skeleton in its original formation. That means that any transformations you make to the bones (not the mesh) will impact how the animations respond. So, save the .nif BEFORE you make the -90 rotation (after moving the mesh objects) and use that .nif for each animation. Once the animation is loaded you will need to manually rotate them accordingly and then export to .fbx. This is the only way I have ever been able to successfully get existing custom animations to work properly if they have the problem you are encountering (if someone knows a better way I would love to hear it).

I tried this hoping it would fix my problem but no all I get is this. This is not the death animation by the way it is the attack animation and it looks normal in blender.

 

Attachments

  • Disaster.png
    Disaster.png
    425.6 KB · Views: 553
I tried this hoping it would fix my problem but no all I get is this.
Spoiler :

I sympathize with your frustration; I still have so many custom animation units on the back-burner because there is some crazy quirk with them that prevents them from converting properly. The more I learn about animation, the more I (hopefully) might be able to solve some of these problems....
 
YES! YES! I believe it is working! HAH! I couldn't wait until tomorrow. :blush:
This is so exciting!! I started from scrap and when it came time to save the .blend I did as normal then came back to read Nomad's quick-fix-tutorial. It seems to be perfectly aligned to the ground now, and every thing facing the right direction! No leg walking backwards while the body goes forward and one of the arms rotates for no reason - it is a zombie, but even they have standards, dammit!

Damn I need to sleep, this pesky life keeps getting in the way of modding Civ5, *gasp*. :mad:
 
So I'm having a bit of an odd issue with a custom (as in, completely custom) Blender unit I'm trying to get in for civ 5.

Basically, it's a custom unit for this mod: http://steamcommunity.com/sharedfiles/filedetails/?id=235588651

Rendered in Blender, it looks like this:


Not the greatest, but hopefully not too bad looking on a small civ 5 scale.

In Granny, it looks like this:


Again, as far as I can tell, everything checks out.

But in Nexus Viewer, it looks like this monstrosity:


And if I try to make the unit in Civ 5, then, depending on scaling, I either get an invisible unit or a GIAAAANT graphical glitch, which looks like the texture is trying to cover the entire screen.

Everything seems to collapse to a single anomalous point, which I have verified to be the origin (0,0,0). (If I move the object around in Blender and reimport, the "black hole" moves to where the origin would be relative to the original object).

I have checked that this has nothing to do with the texture (If I remove the texture entirely, it still happens) or whether I import the mesh from fbx or br2 (the br2 mesh looks a lot better, but both versions have this weird anomaly). Because the original object was in Blender 2.7, I was obliged to rewrite the blender br2 exporter script (link here), but it works so far as a I can tell, and as I said the anomaly shows up in both fbx and br2. I have manually inspected the br2 file in a text editor, and I can't see any mesh point at (0,0,0)...

So I'm stumped. I feel like I'm missing something obvious.

EDIT: I should say that the armature looks absolutely correct, even in Nexus.
 

Attachments

  • Capture.PNG
    Capture.PNG
    136.2 KB · Views: 498
  • Capture3.PNG
    Capture3.PNG
    84.8 KB · Views: 565
  • Capture10.PNG
    Capture10.PNG
    156.3 KB · Views: 504
So I'm stumped. I feel like I'm missing something obvious.

EDIT: I should say that the armature looks absolutely correct, even in Nexus.

See this post from earlier in the thread (#65). Basically, no single mesh can have more than 32 vertex groups assigned.

EDIT: And if that isn't the issue, it could be this from post #75.
 
See this post from earlier in the thread (#65). Basically, no single mesh can have more than 32 vertex groups assigned.

EDIT: And if that isn't the issue, it could be this from post #75.

Ah, well it's definitely not the first one since I have nowhere near 32 vertex groups (and deliberately avoided that), but the second one looks on the mark. I used the version of the export script from the first post in the thread, which I think is out of date since it clearly doesn't do what he says in the second post (and dates to February). I'll try rewriting to match his new version of the script and report back.

EDIT: Actually, it does look like I had the new version, since I do see something about 255. Doesn't seem to be working though after I rewrote for 2.71. Let me look through it...

EDIT2: Ah! No I didn't. There's several more lines in the new script that enforce the 255 weight that I didn't have before.

EDIT3: Well, progress. The warping is gone. However, something still appears wrong in Nexus:



It looks like the mesh is glitched such that there's a giant part of her back that's missing...but this doesn't show up if I open the gr2 in granny.

And if I try it in civ 5, giant glitch texture is still there:



I've tried playing with the scaling, to no avail, and direct size comparison between this unit and, for example, the antiaircraft gun, shows that she's about 1/2 the size of the gun, so there's no reason she should appear as some sort of full-screen giant.

EDIT4: And just to rule it out, I've tried scaling it down all the way 0.0001, and replacing the current 2048x2048 texture with a more typical 256x256 texture. Neither of those do anything. Having no texture at all just causes a giant red/white texture glitch. I'm going to take a break for now...
 

Attachments

  • Capture4.PNG
    Capture4.PNG
    36.3 KB · Views: 487
  • Civ5Screen0098.jpg
    Civ5Screen0098.jpg
    255.2 KB · Views: 671
Top Bottom