Results 1 to 6 of 6

Thread: Hardcoded Textures on Models,How to save time from Coding..

  1. #1
    Jarlaxe's Avatar Heavy Building Industry
    Join Date
    Mar 2009
    Location
    Greece
    Posts
    1,610

    Default Hardcoded Textures on Models,How to save time from Coding..

    Greetings,
    this is a tutorial on how to save some coding from the DMB text file and applies
    mostly on units that will have the same skin for many factions,
    in Hegemonia City-States we have one hoplite for every city,any faction conquers
    a city will use the city's special hoplite,for example the spartan "homoioi hoplitai" unit
    will have the same texture for any faction will conquer sparta(lol) and be able to recruit them.
    first of all to make this tutorial work' the skinner,the modeller and the coder
    of a mod must work together and come to an agreement on the names of the
    models and the skins,to make it clearer let's start.
    firstly
    the modeller makes the model and the skinner the skin,they have to come to an
    agreement of the name they are going to use,for example:

    if the model would be named "M_greek_hoplite.cas"
    then the skin should be "S_greek_hoplite.tga.dds"
    the reason for this' is going to be more understandble later.
    So,we have a model that it is named "M_greek_hoplite.cas"
    and a skin that it is named "S_greek_hoplite.tga.dds"
    the modeller should open the model "M_greek_hoplite.cas" with 3DSMAX and apply
    the texture "S_greek_hoplite.tga.dds" on it,then the model should be
    exported with the skin on it,on this phase the skin named "S_greek_hoplite.tga.dds"
    becomes hardcoded on the model.
    normally when the coder put this unit in the DMB text file for,say, 5 factions
    then he/she will code it like this:
    Code:
     
    type greek_hoplite
    skeleton fs_spearman, fs_swordsman 
    indiv_range 40
    texture greek_cities, data/models_unit/textures/S_greek_hoplite.tga
    texture macedon, data/models_unit/textures/S_greek_hoplite.tga
    texture seleucid, data/models_unit/textures/S_greek_hoplite.tga
    texture thrace, data/models_unit/textures/S_greek_hoplite.tga
    texture slave, data/models_unit/textures/S_greek_hoplite.tga
    model_flexi data/models_unit/M_greek_hoplite.cas
    model_sprite 60.0, data/sprites/greek_hoplite_sprite.spr
    model_tri 400, 0.5f, 0.5f, 0.5f
    in the case of this tutorial after the model "M_greek_hoplite.cas" has been exported from 3DSMAX
    with the skin "S_greek_hoplite.tga.dds" on it ,then we could code like this
    (don't forget ONLY if we want the particular unit to use the same texture by every faction it could
    recruit it.):
    Code:
     
    type greek_hoplite
    skeleton fs_spearman, fs_swordsman 
    indiv_range 40
    texture no_faction(i'll explain this later), data/models_unit/textures/S_greek_hoplite.tga
    model_flexi data/models_unit/M_greek_hoplite.cas
    model_sprite 60.0, data/sprites/greek_hoplite_sprite.spr
    model_tri 400, 0.5f, 0.5f, 0.5f
    As you understand after the export from 3DSMAX with the correct texture on it,the texture
    has been hardcoded on the unit, BUT the texture MUST be in the textures folder so that the
    model "finds it" by it's own.
    the point for coming on an agreement on the names of the model and the skin is to have
    an order on the names and don't have to look in the DMB everytime we want to know the skin
    so the names, for example,"M_greek_hoplite.cas" and "S_greek_hoplite.tga.dds" points the way
    that the skin has the same name as the model except the M(model)_ and S(kin)_.

    Another example
    If we want the particular unit to be recruited by all factions,we normally code like this:
    Code:
     
    type greek_hoplite
    skeleton fs_spearman, fs_swordsman 
    indiv_range 40
    texture romans_julii, data/models_unit/textures/S_greek_hoplite.tga
    texture armenia, data/models_unit/textures/S_greek_hoplite.tga
    texture britons, data/models_unit/textures/S_greek_hoplite.tga
    texture romans_brutii, data/models_unit/textures/S_greek_hoplite.tga
    texture carthage, data/models_unit/textures/S_greek_hoplite.tga
    texture dacia, data/models_unit/textures/S_greek_hoplite.tga
    texture egypt, data/models_unit/textures/S_greek_hoplite.tga
    texture gauls, data/models_unit/textures/S_greek_hoplite.tga
    texture germans, data/models_unit/textures/S_greek_hoplite.tga
    texture greek_cities, data/models_unit/textures/S_greek_hoplite.tga
    texture macedon, data/models_unit/textures/S_greek_hoplite.tga
    texture mercenary, data/models_unit/textures/S_greek_hoplite.tga
    texture numidia, data/models_unit/textures/S_greek_hoplite.tga
    texture parthia, data/models_unit/textures/S_greek_hoplite.tga
    texture pontus, data/models_unit/textures/S_greek_hoplite.tga
    texture romans_scipii, data/models_unit/textures/S_greek_hoplite.tga
    texture scythia, data/models_unit/textures/S_greek_hoplite.tga
    texture seleucid, data/models_unit/textures/S_greek_hoplite.tga
    texture romans_senate, data/models_unit/textures/S_greek_hoplite.tga
    texture slave, data/models_unit/textures/S_greek_hoplite.tga
    texture spain, data/models_unit/textures/S_greek_hoplite.tga
    texture thrace, data/models_unit/textures/S_greek_hoplite.tga
    model_flexi data/models_unit/M_greek_hoplite.cas
    model_sprite 60.0, data/sprites/greek_hoplite_sprite.spr
    model_tri 400, 0.5f, 0.5f, 0.5f
    in the case of this tutorial we should code it like this:
    Code:
     
    type greek_hoplite
    skeleton fs_spearman, fs_swordsman 
    indiv_range 40
    texture no_faction(i'll explain this later), data/models_unit/textures/S_greek_hoplite.tga
    model_flexi data/models_unit/M_greek_hoplite.cas
    model_sprite 60.0, data/sprites/greek_hoplite_sprite.spr
    model_tri 400, 0.5f, 0.5f, 0.5f
    AND
    if we want another skin for the faction of Pontus ,say "S_pontus_hoplite.tga" ,and the same for all the rest factions
    we will normally code it like this:
    Code:
     
    type greek_hoplite
    skeleton fs_spearman, fs_swordsman 
    indiv_range 40
    texture romans_julii, data/models_unit/textures/S_greek_hoplite.tga
    texture armenia, data/models_unit/textures/S_greek_hoplite.tga
    texture britons, data/models_unit/textures/S_greek_hoplite.tga
    texture romans_brutii, data/models_unit/textures/S_greek_hoplite.tga
    texture carthage, data/models_unit/textures/S_greek_hoplite.tga
    texture dacia, data/models_unit/textures/S_greek_hoplite.tga
    texture egypt, data/models_unit/textures/S_greek_hoplite.tga
    texture gauls, data/models_unit/textures/S_greek_hoplite.tga
    texture germans, data/models_unit/textures/S_greek_hoplite.tga
    texture greek_cities, data/models_unit/textures/S_greek_hoplite.tga
    texture macedon, data/models_unit/textures/S_greek_hoplite.tga
    texture mercenary, data/models_unit/textures/S_greek_hoplite.tga
    texture numidia, data/models_unit/textures/S_greek_hoplite.tga
    texture parthia, data/models_unit/textures/S_greek_hoplite.tga
    texture pontus, data/models_unit/textures/S_pontus_hoplite.tga
    texture romans_scipii, data/models_unit/textures/S_greek_hoplite.tga
    texture scythia, data/models_unit/textures/S_greek_hoplite.tga
    texture seleucid, data/models_unit/textures/S_greek_hoplite.tga
    texture romans_senate, data/models_unit/textures/S_greek_hoplite.tga
    texture slave, data/models_unit/textures/S_greek_hoplite.tga
    texture spain, data/models_unit/textures/S_greek_hoplite.tga
    texture thrace, data/models_unit/textures/S_greek_hoplite.tga
    model_flexi data/models_unit/M_greek_hoplite.cas
    model_sprite 60.0, data/sprites/greek_hoplite_sprite.spr
    model_tri 400, 0.5f, 0.5f, 0.5f
    in the case of this tutorial we should code it like this:
    Code:
     
    type greek_hoplite
    skeleton fs_spearman, fs_swordsman ; combat spear
    indiv_range 40
    texture pontus, data/models_unit/textures/S_pontus_hoplite.tga
    texture no_faction(i'll explain this soon), data/models_unit/textures/S_greek_hoplite.tga
    model_flexi data/models_unit/M_greek_hoplite.cas
    model_sprite 60.0, data/sprites/greek_hoplite_sprite.spr
    model_tri 400, 0.5f, 0.5f, 0.5f
    SPRITES
    now when we are ready to generate sprites,we make the standard actions ("-sprite_script"->command line,
    "sprites" folder->RTW/data/"sprites" and the sprite_script text file in RTW/data).
    now i'll explain the "no_faction",it is not important to write no_faction at this place as to
    write something,a number a word,anything.
    the point is that we write here whatever we write in the sprite_script text file next to the model.
    example:
    if we have this in the DMB :
    Code:
     
    type greek_hoplite
    skeleton fs_spearman, fs_swordsman ; combat spear
    indiv_range 40
    texture karpouzi, data/models_unit/textures/S_greek_hoplite.tga
    model_flexi data/models_unit/M_greek_hoplite.cas
    model_sprite 60.0, data/sprites/greek_hoplite_sprite.spr
    model_tri 400, 0.5f, 0.5f, 0.5f
    then in the sprite_script text file we will have this:
    Code:
     
    greek_hoplite karpouzi
    for the case we want a different texture to one faction
    we have this in the DMB :
    Code:
     
    type greek_hoplite
    skeleton fs_spearman, fs_swordsman ; combat spear
    indiv_range 40
    texture pontus, data/models_unit/textures/S_pontus_hoplite.tga
    texture karpouzi, data/models_unit/textures/S_greek_hoplite.tga
    model_flexi data/models_unit/M_greek_hoplite.cas
    model_sprite 60.0, data/sprites/greek_hoplite_sprite.spr
    model_tri 400, 0.5f, 0.5f, 0.5f
    and in the sprite_script text file we will have this:
    Code:
     
    greek_hoplite karpouzi 
    greek_hoplite pontus
    but it is better to use a phrase like "no_faction" rather than karpouzi(the greek water melon!)
    so, thats it!
    i'm posting this tut on the models forum but i think that it would be usefull to be mentioned
    and in the coding forum.
    i hope i made my self understandable enough and maybe help someone to save some time...
    thanks to MasterOfNone for the direction on sprites.
    Last edited by Jarlaxe; September 14, 2009 at 09:47 PM.
    - Leader / Modeller/ Skinner / City Builder of Hegemonia City States -
    - Modeller/ Skinner / City Builder of Fourth Age -

    - Under the patronage of the cream pie lover -
    - jimkatalanos -



  2. #2
    MasterOfNone's Avatar RTW Modder 2004-2015
    Join Date
    May 2005
    Location
    England
    Posts
    16,707

    Default Re: Hardcoded Textures on Models,How to save time from Coding..

    Good to point out, though some files or blocks already use a similar method in vanilla I believe (though they could have taken a leaf out of your book for naming textures!).

    BTW, how does this affect things when it comes to the generation of sprites?
    "One of the most sophisticated Total War mods ever developed..."
    The Fourth Age: Total War - The Dominion of Men

  3. #3
    Jarlaxe's Avatar Heavy Building Industry
    Join Date
    Mar 2009
    Location
    Greece
    Posts
    1,610

    Default Re: Hardcoded Textures on Models,How to save time from Coding..

    if the sprite generation works with the same method as the game can find these textures without mention them,then i think we will have nop prob.
    but better i will test it and update.
    - Leader / Modeller/ Skinner / City Builder of Hegemonia City States -
    - Modeller/ Skinner / City Builder of Fourth Age -

    - Under the patronage of the cream pie lover -
    - jimkatalanos -



  4. #4
    Jarlaxe's Avatar Heavy Building Industry
    Join Date
    Mar 2009
    Location
    Greece
    Posts
    1,610

    Default Re: Hardcoded Textures on Models,How to save time from Coding..

    updated!
    - Leader / Modeller/ Skinner / City Builder of Hegemonia City States -
    - Modeller/ Skinner / City Builder of Fourth Age -

    - Under the patronage of the cream pie lover -
    - jimkatalanos -



  5. #5

    Default Re: Hardcoded Textures on Models,How to save time from Coding..

    i harcoded a texture to a model i made, but i didnt want to do that XD, i even knew it could be done. but my question is how can i revert this?

  6. #6
    vyrille's Avatar Libertus
    Join Date
    Apr 2014
    Location
    Adelaide
    Posts
    91

    Default Re: Hardcoded Textures on Models,How to save time from Coding..

    I think there are 2 ways to revert it that i know of:
    1. Manually detach the assigned texture in 3dsmax, or
    2. Open the .CAS file using ms notepad. It will be all gibberish but the hardcoded texture filename should be right at the end of the block of text. Then edit as needed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •