1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Getting Civ 4 Units into Civ 5

Discussion in 'Civ5 - Modding Tutorials & Reference' started by Deliverator, Oct 24, 2010.

  1. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
    The Redcoats are done. I'll try and release the skeleton and my custom FBX export script and do a write-up within the next 7 days.
     
  2. ambrox62

    ambrox62 Emperor

    Joined:
    Mar 24, 2005
    Messages:
    1,294
    :goodjob:

    Reading your comments, it seems that using C5 anims is better than importing C4 ones in order to produce new 100% working units. Right?
     
  3. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
    Well the units with the animations ported from Civ 4 work, but they are not very smooth. The Redcoat (using Civ 5 anims) has a much more professional feel than the Housecarls (using converted Civ 4 anims) that I released earlier. Download them both and have a play - you'll see what I mean.

    The thing is for a particular Civ 5 animation set to be used we need to have a skeleton corresponding to that animation. So far I have the American Minuteman skeleton done which is used for the Redcoat. Fortunately, the skeleton layouts are pretty similar so it shouldn't be too bad to get other non-mounted skeleton templates done. I've already started rigging the Zulu Impi to the Aztec animations using the Minuteman skeleton as a start point - it looks like I only need to fix the rotation on a few bones to have it looking pretty decent.

     

    Attached Files:

  4. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
    By the way, I stumbled across the fact that ALT + SHIFT + LMB-Drag can be used to rotate the camera in Nexus 3D Viewer. Quite useful for copying and fixing skeletons in particular.
     
  5. Jaythekiller

    Jaythekiller Warlord

    Joined:
    Sep 15, 2006
    Messages:
    185
    Location:
    Ajaccio,Corsica,france (Europe)
    That's a great news :)
     
  6. GeoModder

    GeoModder Deity

    Joined:
    Nov 29, 2005
    Messages:
    7,512
    With my mouse its ALT + pressing the scroll wheel of the mouse and moving it around.
     
  7. WarKirby

    WarKirby Arty person

    Joined:
    Jul 13, 2006
    Messages:
    5,317
    Location:
    Glasgow, Scotland
    Just starting on this, but I instantly notice something disappointing. The requirement to join the weapon and shield to the mesh. Is this really a requirement, or just how you found that it works?

    Units made like this in Civ IV were more of a pain to modify later, and it doesn't bode well for certain animation possibilities. nifs for Civ IV allowed several meshes to be in one nif and function perfectly together.
     
  8. WarKirby

    WarKirby Arty person

    Joined:
    Jul 13, 2006
    Messages:
    5,317
    Location:
    Glasgow, Scotland
    Is this because of some problem in the conversion, or are you saying that the Civ V animations are just better in general.

    To put it another way, are the Civ IV animations converted perfectly, or not ?
     
  9. WarKirby

    WarKirby Arty person

    Joined:
    Jul 13, 2006
    Messages:
    5,317
    Location:
    Glasgow, Scotland
    Whatever happened to this underlined part?

    I'm looking at both nifs now, and they're so fundamentally different I don't know where to begin. some things seem to be removed or renamed too, which doesn't help matters. And I can't tell what was necessary to make it work, and what was just for neatness. And will the resulting unit still work in Civ IV afterwards too?

    These things could all be figured out with lots of experimentation, but I'm guessing you've already done that part, so it would be more efficient to share what you know rather than duplicating the effort :D
     
  10. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
    What is a requirement is that weapon meshes need to be rigged to the skeleton. Taken from the Blender FBX page : "Do not used skinned meshes as children of other objects (except their own armature) This doesnt work reliably".

    Theoretically, you should be able to just rig the weapon mesh to the armature to fulfil this requirement but still leave it using its own separate material and texture. The problem I found from trial and error testing is that if I don't combine the materials and textures into one then the resulting GR2 file often has missing vertices and faces. Once I did manage to export an FBX using multiple materials and textures without it coming out of the GR2 conversion corrupted so I know it is possible, but that was only once out of many attempts.

    The other problem with rigging the weapons to the skeletons but leaving them as separate objects is that the rotation and position of them will need to be adjusted. Combining them into a single object means that their rotation and position can be fixed in place correctly. So, having weapons combined into the mesh is less pain IMO, than having to fix the positions of weapons each time I do a conversion.

    When I'm trying to develop a conversion process for others to use, reliability is something that is really important. If I post a process that only works in 5% of cases, then there'll be a lot of frustrated people around posting "This doesn't work!". Combining and materials and textures into one has always yielded a clean uncorrupted GR2 which is why I recommend this for the time being.

    I encourage you to experiment. If we can find a reliable and repeatable technique where there is no need to combine materials and textures into one, then would definitely be better.

    Bear in mind that components of a single mesh object can be disjoint and rigged independently. See this mounted unit conversion. The rider and horse are the same mesh but are rigged so that they move independently. There really is no limitation in this with regards to animation - if I wanted to make a unit that was three independently moving creatures say - then I can do still that no problem with a single mesh object. What animation possibility are you concerned about?

    Civ 4 animations convert perfectly. That is not the problem.

    The issue is that animations do not map one-to-one between Civ 4 and Civ 5. See the difference between the FXSXML files for the Housecarls (using converted Civ 4 anims) and the Redcoat (using Civ 5 anims):

    Spoiler :
    Housecarl:
    Code:
      <Mesh file="housecarl_a.gr2" source="Tool" />
      <Animation file="civ4swordsman_idle.gr2" ec="1000, 1020, 1450, 1800, 2000, 2020" />
      <Animation file="civ4swordsman_run.gr2" ec="1120, 1140, 1400, 1440, 2440" />
      <Animation file="civ4swordsman_fidget.gr2" ec="1040, 2040" />
      <Animation file="civ4swordsman_fortifya.gr2" ec="1500" />
      <Animation file="civ4swordsman_fortidlea.gr2" ec="1520, 1540, 1560, 1580, 1600, 1620, 1640, 1285, 1290" />
      <Animation file="civ4swordsman_strikea.gr2" ec="1100, 1160, 1180" />
      <Animation file="civ4swordsman_strikeb.gr2" ec="2100" />
      <Animation file="civ4swordsman_dieb.gr2" ec="1200, 2200" />
      <Animation file="civ4swordsman_diefadeb.gr2" ec="1220, 2220" />
      <Animation file="civ4swordsman_hurta.gr2" ec="1280" />
    Redcoat:
    Code:
    	<Mesh file="redcoat.gr2" source="Tool"/>
    	<Animation file="U_American_Minuteman_IdleA.gr2" ec="1000"/>
    	<Animation file="U_American_Minuteman_FidgetA.gr2" ec="1040"/>
    	<Animation file="U_American_Minuteman_IdleA_Trans_IdleB.gr2" ec="1020"/>
    	<Animation file="U_American_Minuteman_IdleB.gr2" ec="2000"/>
    	<Animation file="U_American_Minuteman_FidgetB.gr2" ec="2040"/>
    	<Animation file="U_American_Minuteman_IdleB_Trans_IdleA.gr2" ec="2020"/>
    	<Animation file="U_American_Minuteman_Fortify.gr2" ec="1500"/>
    	<Animation file="U_American_Minuteman_Fortify_Idle.gr2" ec="1520"/>
    	<Animation file="U_American_Minuteman_Fortify_Idle_Fidget.gr2" ec="1540"/>
    	<Animation file="U_American_Minuteman_Fortify_Idle_Trans_Combat_Ready_Idle.gr2" ec="1560"/>
    	<Animation file="U_American_Minuteman_Fortify_Idle_Trans_IdleA.gr2" ec="1580"/>
    	<Animation file="U_American_Minuteman_Combat_Ready.gr2" ec="1600"/>
    	<Animation file="U_American_Minuteman_Shuffle.gr2" ec="1450"/>
    	<Animation file="U_American_Minuteman_Combat_Ready_Idle.gr2" ec="1620"/>
    	<Animation file="U_American_Minuteman_Combat_Ready_Idle_Trans_IdleA.gr2" ec="1640"/>
    	<Animation file="U_American_Minuteman_Run.gr2" ec="1400"/>
    	<Animation file="U_American_Minuteman_Stop_Run.gr2" ec="1440"/>
    	<Animation file="U_American_Minuteman_Stop_Run_IdleB.gr2" ec="2440"/>
    	<Animation file="U_American_Minuteman_Charge_Run.gr2" ec="1120"/>
    	<Animation file="U_American_Minuteman_Charge_Attack.gr2" ec="1140"/>
    	<Animation file="U_American_Minuteman_AttackA.gr2" ec="1100"/>
    	<Animation file="U_American_Minuteman_AttackB.gr2" ec="2100"/>
    	<Animation file="U_American_Minuteman_Attack_City.gr2" ec="1160"/>
    	<Animation file="U_American_Minuteman_Bombardment.gr2" ec="1180"/>
    	<Animation file="U_American_Minuteman_Victory.gr2" ec="1800"/>
    	<Animation file="U_American_Minuteman_Bombard_Defense.gr2" ec="1280"/>
    	<Animation file="U_American_Minuteman_Bombard_Defense_Idle.gr2" ec="1285"/>
    	<Animation file="U_American_Minuteman_Bombard_Defense_Idle_Trans_IdleA.gr2" ec="1290"/>
    	<Animation file="U_American_Minuteman_DeathA.gr2" ec="1200"/>
    	<Animation file="U_American_Minuteman_DeathA_Idle.gr2" ec="1220"/>
    	<Animation file="U_American_Minuteman_DeathB.gr2" ec="2200"/>
    	<Animation file="U_American_Minuteman_DeathB_Idle.gr2" ec="2220"/>


    Take for example the Stop Run animation in Civ 5. This has no equivalent in Civ 4. I chose to re-use the Run animation, but this means that the units run on the spot without moving for a split-second when they move into a tile - looks a bit silly. I could use the Civ4 Idle animation for Stop Run and that might look better - but it still wont look as smooth as a unit rigged to Civ 5 animations will.

    Also, if you use Civ 5 animations you won't need to worry about the timing of the animations being out, or where sounds and effects need to be hooked up - everything comes "for free". It looks like you can hook up sounds and effects using the Animation Triggers section of Nexus - but I really haven't explored that yet.

    Obviously, for Dragons and other units for which no suitable Civ 5 animation exists there is no choice but to use the converted Civ 4 animations which is fine. You can always create new animations for Stop Run and other new Civ 5 animations using Blender (if you know how to create new animations using Blender that is).

    I've not forgotten about that. Bear in mind that writing up a tutorial takes several hours usually. I have limited time for modding and writing to tutorials so I carefully prioritise things. Right now, I consider the tutorial on rigging to Civ 5 animations a greater priority for the following reasons:

    1) As I said, you only need to clean up the NIF in Nifskope if it wont import into Blender properly or there is some other problem that screws up the NIF->FBX->GR2 conversion. In the majority of cases you can skip to Stage 2.
    2) The majority of community created units in Civ 4 used the vanilla animations rather than homemade ones and I'm sure that the same will be true with Civ 5 which is why I have applied myself to cracking that problem.

    I will try and give some more pointers on Stage 1 soon. I do want to share what I know, but it takes time to communicate knowledge effectively so that's why I have to prioritise.

    Overall, you should put to one side what was possible in Civ 4, you'll just get frustrated. Civ 5 is a completely new game using a completely different graphics engine. We are making rapid progress considering that only a few weeks ago it didn't seem that even reskinning was going to be possible. It is better to be creative with what is possible currently and experiment rather than getting frustrated at what is harder or impossible to do in Civ 5.

    Anyway, I should be able to post something on rigging to Civ 5 anims by the end of Sunday.
     
  11. WarKirby

    WarKirby Arty person

    Joined:
    Jul 13, 2006
    Messages:
    5,317
    Location:
    Glasgow, Scotland
    Perhaps I'm misunderstanding here. If skinned meshes are not to be parented, then surely you would NOT want to rig them. With .nif at least, I seem to recall that rigged meshes had skins. And the way to do them without skins was not to rig them, but instead to parent them to a particular bone.
    Perhaps my knowledge reaches a limit there, I don't quite understand howit's possible without multiple skeletons in there too. I shall have to have a look and see what I can find, although I'm guessing your knowledge succeeeds mine in this regard.

    The specific possibilites that come to mind are two examples from Civ IV:

    1. The short spearman from charlemagne - The spear's position in the hand moves during the attack animation

    2. The ancient Great General/Warlord from warlords and BTS. He has an idle animation which tosses his sword in the air, and another which digs it into the ground, leaves it embedded for a second, and draws it out again. In both cases it leaves the hand.

    If I'm understanding correctly, the problem is that Civ V merely has "more" animations for different situations. In that case, would it perhaps be possible to use Civ V animations for cases where there is no appropriate IV animation, and use the IV animations in other cases?
    Something I've been meaning to do for ages. I'm well versed in character animation in poser so it should be just a matter of learning that aspect of the blender interface. Do you know if blender supports IK ?

    Understood. Perhaps it's just my personal experience, I ran into this problem with disporportionate frequency in modding Civ IV. I think this was mainly because Sezereth was such a trailblazer, and did plenty of graphic modding before it was really possible or supported, resulting in a lot of messed up nifs later when we knew how to do it. Nothing against him of course, one works with the tools they have.

    As long as it's still on your to-do list, I'm cool, just worrying that you had forgotten about it, or perhaps thought that noone cared much about fixing Civ IV nifs.
     
  12. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
    Yes, that's how Civ 4 weapons are done in most cases, but my interpretation of "Do not used skinned meshes as children of other objects (except their own armature) This doesnt work reliably" is that having unrigged meshes that are child nodes of bones is something that causes the outputted FBX to be corrupted or be missing data. That's what I found by trial and error, but have a go yourself see how you get on.

    Both these things are entirely possible with a single skeleton. If you look at the Redcoat that I rigged to the American Minuteman animations it is a similar case to (2) above. The musket is rigged to it's own bone that is a child of the Scene Root - the musket is held in two different positions if you look and falls out the hands when the unit is killed.

    The only difference from Civ4 is that (due to the FBX export script) all meshes need to be rigged to something. For the short spearman I've just looked and there is a bone called LightSpearman_Spear already so the job isn't too bad.

    Needing everything to be rigged isn't really a limitation on what you can do animation-wise. If I wanted to I could have a root bone have two child bones DogRoot and CatRoot that could have two independently moving sub-skeletons.

    That could be pretty fiddly. To use the Civ 5 animations you need to rig the unit to a new skeleton with specific bone names. It might be possible to use some Civ 4 anims with the same unit but it would be a bit hard I think.

    Yes, there is an Auto IK button. Making alterations to an existing Civ 4 animation is something I could do another tutorial on at some point. IPO Curves are really useful.

    Yeah, there are plenty of great looking units that are a bit messed up internally due to their early, experimental origins. They can all be fixed up with some effort, although sometimes, for example, where they have been made using the old "headswapping" technique where the new head is unrigged you need to do some mesh-merging in Blender.
     
  13. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
  14. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
    I've done some more investigation into exporting meshes with multiple objects and textures via the FBX script.

    I exported this Swordsman with a separate sword and shield 7 times from Blender without changing anything (other than closing a few other programs). The first six exports were corrupted in various different ways when looked at in Granny Viewer...





    ... but the seventh came out perfect.



    The fact that the same model comes out differently each time you run the FBX export shows how flaky the export script is. But it does mean multiple objects and textures units can be exported successfully, but not reliably so. If you are will to repeatedly run the FBX export until it comes out clean then you don't have to mess around combine your textures into one as described in the tutorial, but you'll still need to rig your weapons a bone. Possibly closing other programs increases the chance of a clean export - not sure.
     

    Attached Files:

    • f1.jpg
      f1.jpg
      File size:
      11 KB
      Views:
      603
    • f2.jpg
      f2.jpg
      File size:
      7.5 KB
      Views:
      612
    • f3.jpg
      f3.jpg
      File size:
      101.6 KB
      Views:
      585
  15. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,055
    Location:
    San Diego, California
    ouch. does anyone know python well enough to fix the script?
     
  16. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
    Could be too much for my limited knowledge. Fixing intermittent bugs is always harder as well. That said, since FBX is human readable it might be possible to use a compare tool to spot the difference between the FBXs that came out corrupted and the FBX that came out OK. If there is a clear structural difference between the two that might point to solution.
     
  17. lemmy101

    lemmy101 Emperor

    Joined:
    Apr 10, 2006
    Messages:
    1,064
    Yeah we get the same thing with our leaderhead tests with the Max exporter. Our solution was to export it about a 1000 times until the gaps and errors were in a hard to notice place. ;D
     
  18. WarKirby

    WarKirby Arty person

    Joined:
    Jul 13, 2006
    Messages:
    5,317
    Location:
    Glasgow, Scotland
    Who wrote the script ? Poke them about it
     
  19. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,681
    Location:
    London, UK
    I've realized it's not the FBX export script. I compared all the files exported from Blender and they were identical apart from the timestamps. It's the FBX -> GR2 conversion that gives random results. You can load the same FBX into NexusBuddy and when you save the GR2 the result can be different everytime.
     
  20. lemmy101

    lemmy101 Emperor

    Joined:
    Apr 10, 2006
    Messages:
    1,064
    Sorry yeah that was what I was getting at. I didn't make that clear I apologise. I meant export the gr2 in Nexus Buddy. :S

    FWIW I'm planning on adding functionality to import multiple FBX files into the same granny. This would mean you would be able to save out the seperate meshes in seperate FBX files and combine them in Nexus Buddy, which should mean they will come out right each time if it is indeed multiple meshes that cause the problem.
     

Share This Page