Jump to content

Reskinning Step 1 : Duplicating game objects


Amineri

Recommended Posts

Unfortunately, it doesn't seem like run-time swapping of weapon textures is going to be possible.

 

MEC weapons vs EXALT weapons appear to be set up somewhat differently.

 

MEC Railgun :

begin object name=MECRailgun class=MaterialInstanceConstant
...
    Parent=Material'GEN_MaterialParents.Master_Materials.CHH_Soldiers'

EXALT Assault Rifle :

begin object name=Minst_AssaultRifleModern class=MaterialInstanceConstant
...
    Parent=Material'GEN_MaterialParents.Master_Materials.WPN_Objects'

The EXALT Assault Rifle GEN_MaterialParents.Master_Materials contains both CHH_Soldiers and WPN_Objects, but the MEC Railgun GEN_MaterialParents.MasterMaterials only contains CHH_Soldiers. Further, in neither case does the weapon DIF texture link through the material.

 

XComHumanPawn.UpdateMeshMaterials does handle some of these :

                    case 'CHH_Soldiers':
                    case 'CHH_WeaponKits':
                    case 'WPN_LaserWeapons':
                    case 'WPN_PlasmaWeapons':
                        UpdateArmorMaterial(MeshComp, MIC);
                        break;

through the method UpdateArmorMaterial. However, the only vanilla functionality is changing tints :

        MIC.GetVectorParameterValue('CMOD', BaseArmorTint.Primary);
        MIC.GetVectorParameterValue('CMODB', BaseArmorTint.Secondary);

I believe that this is how the matched tinting for weapons and armor in Enemy Within is accomplished.

 

---------

 

TL/DR -- weapons and armors are likely going to require "compile-time" hex-editing of the textures instead of run-time swapping (as is possible for flags and UI elements).

Link to comment
Share on other sites

  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

XMTS and I were discussing this, and he had the idea to look into how UDK cooks DLC.

 

For example, in Enemy Unknown, the Slingshot (DLC_Day60) is cooked with it's own separate tfcs :

  • Steam\SteamApps\common\XCom-Enemy-Unknown\XComGame\DLC\PCConsole\DLC_Day060\CookedPCConsole\CharTextures_DLC_Day060.tfc
  • Steam\SteamApps\common\XCom-Enemy-Unknown\XComGame\DLC\PCConsole\DLC_Day060\CookedPCConsole\Lighting_DLC_Day060.tfc
  • Steam\SteamApps\common\XCom-Enemy-Unknown\XComGame\DLC\PCConsole\DLC_Day060\CookedPCConsole\Textures_DLC_Day060.tfc

If we can similarly figure out how to cook separated tfc files, and then hex-mod the duplicated weapon/armor model packages to use these new tfcs (as well as correcting the offsets), managing multiple different new models would be a lot simpler.

 

I've not yet figured out how to get UDK to cook such DLC-style packages, but from their manual pages, there is a commandline option for the Unreal Frontend cooker :

 

 

usermode: Cooks content as if it's DLC or a mod (this will only cook what's specified on the commandline, it won't cook shipped script packages, etc).

 

I'm still not sure how to configure all this in detail, however.

Link to comment
Share on other sites

Weapons seems to be handled as ActiveAttachments, so you would have to check in UpdateArmorMaterial, if an attachment is weapon's mesh and its archetype or name, before apllying a texture.

 

I understand you and Johny don't want to bloat LW download too much. Maybe you could do some batch to duplicate files you need and then patch them, but I don't think people would mind 10-100 MB up, if you give them something so great like new stuff. Especially today, with fast internet, when are people used to download gigabyte patches for games like WoW or XCom.

Edited by Drakous79
Link to comment
Share on other sites

In terms of size there's a bit of a trade-off, which helps me better understand the trade-offs Firaxis had to make.

 

If I cook/compress the LongWar.upk texture package, it shrinks to around 1.3 MB. Uncooked it's over 15 MB.

 

If they had released the PC game uncooked, modding it with UDK would have been easier (but still not trivial because of native code built into their licensed version), but the installed size would be substantially larger than it is. Also performance would have suffered a bit, meaning they would have had to up their system requirements. They already had to set it up for cooking for the consoles, so they went with the cookedPCConsole option.

 

Currently I'm leaning toward an option using a second dynamic flag texture, keyed off of using flag config U values >= 1.0. Since each flag is only 256x128, I don't think there will be much perfomance loss from not using mipmaps for the secondary flag textures, and it simplifies updating/adding flag textures considerably. Basically this means adding a single 1024x1024 texture to LongWar.upk (supporting up to 32 more country flags), with all other changes happening internal to XComGame.upk. This could (eventually, maybe) adding more countries above the vanilla 36.

 

On the other hand, weapons/armors can't have main textures swapped at run-time (if they can, I can't figure it out), plus the primary armor textures are 2048x2048, which could cause problems with lots of models, plus file bloat would get pretty significant. So duplicating the model and hex editing in new mipmaps (ideally in the model package and a new tfc file) is probably the way to go for such items.

Link to comment
Share on other sites

Drakous79, DynamicLoadObject gives you a class reference if successful, and null reference if not. Here is an example of how it is used for loading mutators:

local class<Mutator> mutClass;
local Mutator mut;
local string mutname;

mutClass = class<Mutator>(DynamicLoadObject(mutname, class'Class'));
if(mutClass == none)
{
    return;
}
mut = Spawn(mutClass);
BTW, don't forget that we can subclass almost every class with mutators and change how things work completely, if needed. Edited by wghost81
Link to comment
Share on other sites

... I believe that this is how the matched tinting for weapons and armor in Enemy Within is accomplished.

 

Happy to hear you're all making huge progress on the integration of both the Weapons alternate textures run-time loadouts (however limited it would need to be and still work "correctly") and the ( supplemental - Yeah! ) Flags 1024x1024 compromise via TFC (and with some UV dispatch functions -- as a juicy bonus) for easy access and quick custom edits by players - eventually.

 

Basicly, the RailGun & ParticleCannon "flaw" is the (only) core issue - i think. That code work would possibly serve somewhere else for other tricky situations nonetheless. Rarely will players hardly notice the rest, AFAIC. So the priority focus should fall on known issues & recognized fixable assets by anyone and through usual collaborations. So far, so good.

 

About the above comment though... could such tints be "un-matched" between the two and if so, that would certainly require a new Barracks card config slot (1-32) exclusively for weapons (or helmets, etc), right?

Edited by Zyxpsilon
Link to comment
Share on other sites

Right, and to save those tints somewhere (Checkpoint probably) and update some functions like UpdateArmorMaterial and those for customization UI.

Edited by Drakous79
Link to comment
Share on other sites

To be clear, I'm certainly fine with more files for the new weapon textures; it's just adding 30 armor texture files just to support a few new nationalities is a bit overkill. If you guys can work out the on-the-fly textures for flags, that would be much better.

 

The best would to be add all nationalities, but I think this one is sorted out. It is possible to change the texture on the fly while new UVs are written in DefaultConfig.ini and new textures are in one new package and one new tfc file plus new code in UpdateFlagMaterial function.

 

And updated enum ECountry in XGGameData, UIUtilities.GetCountryLabel and add small images (or action script pointing to new package) to UICollection_Common_SF.

 

Edited by Drakous79
Link to comment
Share on other sites

I can order up 32 new countries, but we'd also need new UI flags for most of them (there's a few in there already) -- unless this method handles that as well. Anyway, say the word and I'll post up a list of the flags I'd want for Long War. (There's a bit more scripting to do -- sorting languages and pawn characteristics, name lists, and so on)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...