Rescaling Units

DRJ

Hedonist
Joined
Dec 1, 2005
Messages
1,514
Location
Hamburg, Germany
Hi everybody! Yesterday I phantazised about having an option to rescale units, as I hate to have so large ones compared to the city.

In civ5 there have already been attempts to rescale units
Spoiler :

attachment.php

though I want not only to rescale them for C2C but to take it a step further, trying to make them smaller and then to mirror/clone them a few times on the original grid. For example, normal infantry would be 4 times smaller but tanks could be only 2 or 3 times smaller, so no more awful huge inf vs small tank battles^^

After having skimmed through numerous tutorials and loading at least 10 proggies, dlls and stuff (my head is swirling) and I managed to get my hands on example files I was finally able to rescale something^^
I am not knowing yet how to quadruple the unit and set their positions in the grid but hey, it's day one...

If anyone is reading this and can help me getting into the matter (I never worked with 3d models before) it would really be appreciated.

My plan is to convert the most used units first. As Koshling said the plan could get graphics heavy,
I asked him if it would be possible to provide some code for an optional load of the smaller and plethora (*4/*16) unit graphics I was anticipating.

At least I want to make a little demo of it with a nice screenie.

As I already stated: any ideas, suggestions, converted models etc. - any feedback would be great! :)
 

Attachments

  • minime.png
    minime.png
    233.3 KB · Views: 202
  • minime2.png
    minime2.png
    177.9 KB · Views: 175
As far as I can tell, "all" you need to do is scale the unit in the art define unit fscale tag and change the number in the unit infos UnitMeshGroups tag. The fscale controls the size and the UnitMeshGroups controls the number and composition of the displayed units. At least that is the simplistic way. The single unit graphics option will make only one display no matter what you have in UnitMeshGroups. Which may be a problem for you but not for those of us with old graphics cards. ;)
 
If it's part of an attempt to reduce graphics load too you'll need to reduce the polygon or something count in the models too. Simply reducing them in size won't help.
If you aren't doing that anyway then the fScale and MeshGroups tags will be enough to change, like DH states.
I'm all for it though it's a big job either way and I've no know-how of how to help out.

Cheers
 
Thx you guys! Btw Gedemon, who did the rescaling of the units for civ5 answered a PM of mine and what he said matches what you said, DH.

Gedemon said:
There is already civ4 mods that do rescaling of units, R.E.D. for civ5 is based on such a mod I've done at the time, itself based on the mod "regiments"

For the scale you just have to edit a tag in the graphic definition file for the unit (I don't remember the exact name, but it's a xml with maybe "artdefine", "unit" and "member" in it's name.

The tag should be <fScale> it's that value you'll have to edit for each unit. Yep, no quick way here.

There was a console command for civ4 that allowed to reload graphic xml in game so you can tweak the value and see the change without having to restart the game, but I don't remember it's name either (my civ4 modding was some time ago, sorry )

After that you'll have to find and edit the formation xml file to set number of models per unit.

Hope this help.


As I am a nub in actual modding (I am more the theoretician than the practitioner),
this rescaling may be a good point to start to get into the groove. As it is repetetive but you can also see progress...

So... before I will be able to experiment further in the evening, does anyone know which was the console command Gedemon mentioned to tweak the size value without having to restart the game?

Thx for feedback, just warning you that I may bother you some more with beginners questions but after all the conceptioning, now I like to lay hand on something myself, or at least try, for a nice PR screenie.
 
I experimented with the xml and the first time actually was pretty smooth sailing. Upon changing the fscale value to a third of its original size (0,42->0,14) and editing the meshunits from 2 to 8, I had this neat screenie.... Well I suppose it's pretty graphic intense but nevertheless fun to play with for a perfect PR screenie in the future^^

Some follow-up questions: can I also scale the flag item each unit has?

And can I change the xml while staying in game? How you guys handle it when you edit xml?

How do I activate the nomad camp test module? Sry is there a ''//'' I have to delete in a certain file?

Finally, here's some eyecandy preview (not yet the landscape of the planned PR screenie which I already have in the back of my head, though)

EDIT: Another question: is there a xml editor, that can change each fscale tag value to 1/3 of it's original value automatically? Can such code be written somehow? Where could I start for stuff like that?
 

Attachments

  • Civ4ScreenShot0062.JPG
    Civ4ScreenShot0062.JPG
    214.7 KB · Views: 214
I experimented with the xml and the first time actually was pretty smooth sailing. Upon changing the fscale value to a third of its original size (0,42->0,14) and editing the meshunits from 2 to 8, I had this neat screenie.... Well I suppose it's pretty graphic intense but nevertheless fun to play with for a perfect PR screenie in the future^^

Some follow-up questions: can I also scale the flag item each unit has?

And can I change the xml while staying in game? How you guys handle it when you edit xml?

How do I activate the nomad camp test module? Sry is there a ''//'' I have to delete in a certain file?

Finally, here's some eyecandy preview (not yet the landscape of the planned PR screenie which I already have in the back of my head, though)

Looking good, how is it at 6ft on a big screen for oldies like me?:mischief:

Flags - no.

XML changes - not that I know of, they need a restart :(

Nomad - edit MLF file in Modules and change the 0 to 1 for the nomad module, ie last module in the list.
 
And can I change the xml while staying in game? How you guys handle it when you edit xml?

console command should be : Xml.reloadArtDefines

works only with the art defines obviously, but if I remember correctly, it may also reload the formation file.
 
If you do re-size things how big will the Pygmy Warrior be!! Or a pigeon!!

lol actually my recent initiave wanting to rescale (my wife bugged me why the units are so large compared to cities a few years ago in the first place) was given by the pygmy warrior^^

Did some more rescaling today (gazelle, sabretooth, impi, band of homo sampiens)
and created a testing landscape with glacier lobes, rainfronts and some different terrains.

[It's pretty neat when those little Impi rascals do their war dance...wanna see them chase an elephant or mammoth^^)

I'm getting closer to what I expect of the final screenie but it's not perfect yet.
I will need to attach different screenies together to still get the level of detail as well as the broader picture, I guess... :think:

Anyway, here are some recent test-building pics, hope you like it. :)
 

Attachments

  • Civ4ScreenShot0067.JPG
    Civ4ScreenShot0067.JPG
    195.6 KB · Views: 519
  • Civ4ScreenShot0068.JPG
    Civ4ScreenShot0068.JPG
    212.4 KB · Views: 175
  • Civ4ScreenShot0069.JPG
    Civ4ScreenShot0069.JPG
    225.9 KB · Views: 175
Do you apply those changes in a modular way (a separate module that only changes the scaling and numbers)?
 
That's what I plan to do but I could only do it with a little help from my friends (where to start?).
The final idea if it would work out as considered would be a slider or a BUG menu option.

So you could use the rescaled units as long as the world is young and you don't have many units to process and in later ages you could have it the old way. So you could have the best of both.

Regarding the module: I had a look into some xml files and it's pretty intuitive to work with it (hell I remember doing a few scenarios for Civ2 ages ago, which was much like editing xml today^^) but connecting it to UI and stuff is yet a class of its own...

Although I may look into a few more tutorials the coming days, gaining some more knowledge about stuff like that.

Btw when I do want to contribute, I fear the files I edited already are out~/updated at that time with all the new stuff coming in... any way to avoid it or to merge the old with the new? What if two or more contributions are done at the same time? or shortly after so you can't even adjust to the new stuff? I don't want to break anything... well perhaps reading the SVN contributor FAQ will help with this as well^^ still a lot of stuff to do, but I think my progress is alright so far.

At least the #1 goal, the PR screenie is within reach in a short time :banana:
 
Do you apply those changes in a modular way (a separate module that only changes the scaling and numbers)?

I am not sure that the art defines files are WoC able. However it is easy enough to test.

That's what I plan to do but I could only do it with a little help from my friends (where to start?).
The final idea if it would work out as considered would be a slider or a BUG menu option.

So you could use the rescaled units as long as the world is young and you don't have many units to process and in later ages you could have it the old way. So you could have the best of both.

@DRJ Instead of having a UI function on scaling you could just scale the different units for the different ages differently.

Regarding the module: I had a look into some xml files and it's pretty intuitive to work with it (hell I remember doing a few scenarios for Civ2 ages ago, which was much like editing xml today^^) but connecting it to UI and stuff is yet a class of its own...

Although I may look into a few more tutorials the coming days, gaining some more knowledge about stuff like that.

Btw when I do want to contribute, I fear the files I edited already are out~/updated at that time with all the new stuff coming in... any way to avoid it or to merge the old with the new? What if two or more contributions are done at the same time? or shortly after so you can't even adjust to the new stuff? I don't want to break anything... well perhaps reading the SVN contributor FAQ will help with this as well^^ still a lot of stuff to do, but I think my progress is alright so far.

At least the #1 goal, the PR screenie is within reach in a short time :banana:

A module is the solution to keeping in line other changes, usually more units.

1) Probably have a folder in the Assets/Modules folder called DRJ which contains a folder Unit_Scaling. Edit the Modules MLF file to include the DRJ folder.

2) Copy the C2C_CIV4UnitSchema.xml from the XML/Units folder and rename it DRJ_CIV4UnitSchema.xml

3) Copy CIV4ArtDefinesSchema.xml from the XML/Art folder and rename it DRJ_CIV4ArtDefinesSchema.xml

4) Copy your edited art define and unit infos files into here.

5) Edit each of the unit infos files in this new folder

5.1) Change the name of the schema file near the top of the file.

5.2) For each unit you have changed delete all the bits you are not changing
Spoiler :
so you go from something like
Code:
		<UnitInfo>
			<Class>UNITCLASS_SUBDUED_AARDVARK</Class>
			<Type>UNIT_SUBDUED_AARDVARK</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_ANIMAL</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_SUBDUED_ANIMAL</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>TXT_KEY_UNIT_SUBDUED_AARDVARK</Description>
			<Civilopedia>TXT_KEY_CONCEPT_SUBDUED_ANIMALS_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_UNIT_SUBDUED_ANIMAL_STRATEGY</Strategy>
			<Advisor>NONE</Advisor>
			<bAnimal>0</bAnimal>
			<bFood>0</bFood>
			<bNoBadGoodies>0</bNoBadGoodies>
			<bOnlyDefensive>1</bOnlyDefensive>
			<bNoCapture>0</bNoCapture>
			<bQuickCombat>0</bQuickCombat>
			<bRivalTerritory>0</bRivalTerritory>
			<bMilitaryHappiness>0</bMilitaryHappiness>
			<bMilitarySupport>0</bMilitarySupport>
			<bMilitaryProduction>0</bMilitaryProduction>
			<bPillage>0</bPillage>
			<bSpy>0</bSpy>
			<bSabotage>0</bSabotage>
			<bDestroy>0</bDestroy>
			<bStealPlans>0</bStealPlans>
			<bInvestigate>0</bInvestigate>
			<bCounterSpy>0</bCounterSpy>
			<bFound>0</bFound>
			<bGoldenAge>0</bGoldenAge>
			<bInvisible>0</bInvisible>
			<bFirstStrikeImmune>0</bFirstStrikeImmune>
			<bNoDefensiveBonus>1</bNoDefensiveBonus>
			<bIgnoreBuildingDefense>0</bIgnoreBuildingDefense>
			<bCanMoveImpassable>0</bCanMoveImpassable>
			<bCanMoveAllTerrain>0</bCanMoveAllTerrain>
			<bFlatMovementCost>0</bFlatMovementCost>
			<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqBonuses>0</bPrereqBonuses>
			<bPrereqReligion>0</bPrereqReligion>
			<bMechanized>0</bMechanized>
			<bSuicide>0</bSuicide>
			<bHiddenNationality>0</bHiddenNationality>
			<bAlwaysHostile>0</bAlwaysHostile>
			<bWorkerTrade>0</bWorkerTrade>
			<bMilitaryTrade>1</bMilitaryTrade>
			<UnitClassUpgrades/>
			<UnitClassTargets/>
			<UnitCombatTargets/>
			<UnitClassDefenders/>
			<UnitCombatDefenders/>
			<FlankingStrikes/>
			<UnitAIs/>
			<NotUnitAIs/>
			<Builds/>
			<ReligionSpreads/>
			<CorporationSpreads/>
			<GreatPeoples/>
			<Buildings>
				<Building>
                      <BuildingType>BUILDING_GOVENORS_PETS</BuildingType>
                      <bBuilding>1</bBuilding>
                 </Building>
				<Building>
                      <BuildingType>BUILDING_GOVENORS_MENAGERIE</BuildingType>
                      <bBuilding>1</bBuilding>
                 </Building>
				<Building>
                      <BuildingType>BUILDING_ANIMAL_TOTEM</BuildingType>
                      <bBuilding>1</bBuilding>
                 </Building>
 				<Building>
                      <BuildingType>BUILDING_EARTH_MYTH</BuildingType>
                      <bBuilding>1</bBuilding>
                 </Building>
           </Buildings>
			<ForceBuildings/>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqCorporation>NONE</PrereqCorporation>
			<PrereqBuilding>NONE</PrereqBuilding>
			<PrereqTech>NONE</PrereqTech>
			<TechTypes/>
			<BonusType>NONE</BonusType>
			<PrereqBonuses/>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>-1</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iAdvancedStartCost>-1</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iMoves>1</iMoves>
			<bNoRevealMap>1</bNoRevealMap>
			<iAirRange>0</iAirRange>
			<iAirUnitCap>0</iAirUnitCap>
			<iDropRange>0</iDropRange>
			<iNukeRange>-1</iNukeRange>
			<iWorkRate>0</iWorkRate>
			<iBaseDiscover>0</iBaseDiscover>
			<iDiscoverMultiplier>0</iDiscoverMultiplier>
			<iBaseHurry>0</iBaseHurry>
			<iHurryMultiplier>0</iHurryMultiplier>
			<iBaseTrade>0</iBaseTrade>
			<iTradeMultiplier>0</iTradeMultiplier>
			<iGreatWorkCulture>0</iGreatWorkCulture>
			<iEspionagePoints>0</iEspionagePoints>
			<TerrainImpassables/>
			<TerrainPassableTechs/>
			<FeaturePassableTechs/>
			<iCombat>1</iCombat>
			<iCombatLimit>100</iCombatLimit>
			<iAirCombat>0</iAirCombat>
			<iAirCombatLimit>0</iAirCombatLimit>
			<iXPValueAttack>6</iXPValueAttack>
			<iXPValueDefense>3</iXPValueDefense>
			<iFirstStrikes>0</iFirstStrikes>
			<iChanceFirstStrikes>0</iChanceFirstStrikes>
			<iInterceptionProbability>0</iInterceptionProbability>
			<iEvasionProbability>0</iEvasionProbability>
			<iWithdrawalProb>0</iWithdrawalProb>
			<iCollateralDamage>0</iCollateralDamage>
			<iCollateralDamageLimit>0</iCollateralDamageLimit>
			<iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
			<iCityAttack>0</iCityAttack>
			<iCityDefense>0</iCityDefense>
			<iAnimalCombat>0</iAnimalCombat>
			<iHillsAttack>0</iHillsAttack>
			<iHillsDefense>0</iHillsDefense>
			<TerrainNatives/>
			<FeatureNatives/>
			<TerrainAttacks/>
			<TerrainDefenses/>
			<FeatureAttacks/>
			<FeatureDefenses/>
			<UnitClassAttackMods/>
			<UnitClassDefenseMods/>
			<UnitCombatMods/>
			<UnitCombatCollateralImmunes/>
			<DomainMods/>
			<BonusProductionModifiers/>
			<iBombRate>0</iBombRate>
			<iBombardRate>0</iBombardRate>
			<SpecialCargo>NONE</SpecialCargo>
			<DomainCargo>NONE</DomainCargo>
			<iCargo>0</iCargo>
			<iConscription>0</iConscription>
			<iCultureGarrison>0</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>0</iAsset>
			<iPower>0</iPower>
			<UnitMeshGroups>
				<iGroupSize>1</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>1</iMeleeWaveSize>
				<iRangedWaveSize>0</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>1</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_AARDVARK</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<FormationType>FORMATION_TYPE_ANIMAL</FormationType>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<FreePromotions>
				<FreePromotion>
					<PromotionType>PROMOTION_ANIMAL_DESERT</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
				<FreePromotion>
					<PromotionType>PROMOTION_ANIMAL_DUNES</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
				<FreePromotion>
					<PromotionType>PROMOTION_ANIMAL_SALTFLATS</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
				<FreePromotion>
					<PromotionType>PROMOTION_ANIMAL_TUNDRA</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
				<FreePromotion>
					<PromotionType>PROMOTION_ANIMAL_PERMAFROST</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
				<FreePromotion>
					<PromotionType>PROMOTION_ANIMAL_SNOW</PromotionType>
					<bFreePromotion>1</bFreePromotion>
				</FreePromotion>
			</FreePromotions>
			<LeaderPromotion>NONE</LeaderPromotion>
			<iLeaderExperience>0</iLeaderExperience>
			<KillOutcomes>
...
			</Actions>
		</UnitInfo>
to
Code:
		<UnitInfo>
			<Class>UNITCLASS_SUBDUED_AARDVARK</Class>
			<Type>UNIT_SUBDUED_AARDVARK</Type>
			<UnitMeshGroups>
				<iGroupSize>1</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>1</iMeleeWaveSize>
				<iRangedWaveSize>0</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>1</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_AARDVARK</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<FormationType>FORMATION_TYPE_ANIMAL</FormationType>
		</UnitInfo>


6) This is the bit I am not sure will work:scan:. Edit the art defines files rename the schema at the top and make each art define look like
Code:
		<UnitArtInfo>
			<Type>ART_DEF_UNIT_AARDVARK</Type>
			<fScale>20.0</fScale>
		</UnitArtInfo>
 
Wow that sounds pretty logical and achieveable! Thx for the great explanation!
Will test it tonight, maybe contributing steadily in 2 weeks or so, gonna be pretty occupied next week.
 
Have a little problem with the xml not loading.

I think I followed all the steps you listed but I may be wrong... :confused:
 

Attachments

  • xml.png
    xml.png
    58.1 KB · Views: 111
Unfortunately that means that the art defines are not Woc able. :(
Looking into the source code it seems like for the art XML the method for copying in the non default values is not implemented. As long as that is the case it will always work like a force overwrite.
 
Looking into the source code it seems like for the art XML the method for copying in the non default values is not implemented. As long as that is the case it will always work like a force overwrite.

Which means it is not as useful as WoC.

@DRJ That means you just need to put the whole art defines in for the units you have worked on.
 
ok alright gonna try that. What would have been different with the shorter forceoverwrite code?

and what if i want to include a sabretooth or pygmy (they are in different modules)??
 
ok alright gonna try that. What would have been different with the shorter forceoverwrite code?

and what if i want to include a sabretooth or pygmy (they are in different modules)??

Force overwrite requires all the code to work anyway.

You put them all in your mod, in fact you can put them all in the one file, that is the power of this type of modding. we may need to make sure the modules are loaded in the right order but it should work fine once they are.
 
I experimented with the xml and the first time actually was pretty smooth sailing. Upon changing the fscale value to a third of its original size (0,42->0,14) and editing the meshunits from 2 to 8, I had this neat screenie.... Well I suppose it's pretty graphic intense but nevertheless fun to play with for a perfect PR screenie in the future^^

Some follow-up questions: can I also scale the flag item each unit has?

And can I change the xml while staying in game? How you guys handle it when you edit xml?

How do I activate the nomad camp test module? Sry is there a ''//'' I have to delete in a certain file?

Finally, here's some eyecandy preview (not yet the landscape of the planned PR screenie which I already have in the back of my head, though)

Another question: is there a xml editor, that can change each fscale tag value to 1/3 of it's original value automatically? Can such code be written somehow? Where could I start for stuff like that?

Bump: Nimek's XML Parser might have the ability to do this automatically for all units in a few hours, if rescaling is all done in XML.
 
Back
Top Bottom