Jump to content

How do we use the PHENOTYPE feature?


Recommended Posts

The Phenotype tag which replace the previous Gender tag, can be now have tokens.

Once there is more than one token it will pick one randomly.

Note that tokens are also inherited  see 

https://trac.wildfiregames.com/changeset/22611

Then in the actor name you will be able to specify the {phenotype} tag for the engine to replace

Assuming this in the Identity component

<Phenotype datatype="tokens"> male female</Phenotype>

And this in the actor

<Actor>units/britons/{Phenotype}_villager.xml</Actor>

Will be replaced by

<Actor>units/britons/male_villager.xml</Actor>

<Actor>units/britons/female_villager.xml</Actor>

An official post could be made maybe by@wraitii or @Freagarach like the one I made for breaking changes.

  • Thanks 1
Link to comment
Share on other sites

7 hours ago, Stan` said:

The Phenotype tag which replace the previous Gender tag, can be now have tokens.

Once there is more than one token it will pick one randomly.

Note that tokens are also inherited  see 

https://trac.wildfiregames.com/changeset/22611

Then in the actor name you will be able to specify the {phenotype} tag for the engine to replace

Assuming this in the Identity component

<Phenotype datatype="tokens"> male female</Phenotype>

And this in the actor

<Actor>units/britons/{Phenotype}_villager.xml</Actor>

Will be replaced by

<Actor>units/britons/male_villager.xml</Actor>

<Actor>units/britons/female_villager.xml</Actor>

An official post could be made maybe by@wraitii or @Freagarach like the one I made for breaking changes.

Here's what I have:

template_unit_support_citizen

Spoiler

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_support">
  <Attack>
    <Melee>
      <Damage>
        <Hack>6.0</Hack>
        <Pierce>0.0</Pierce>
        <Crush>0.0</Crush>
      </Damage>
      <MaxRange>4.0</MaxRange>
      <PrepareTime>500</PrepareTime>
      <RepeatTime>1000</RepeatTime>
      <RestrictedClasses datatype="tokens">
		Ship
		MercenaryCamp
	  </RestrictedClasses>
    </Melee>
    <Slaughter>
      <Damage>
        <Hack>25.0</Hack>
        <Pierce>0.0</Pierce>
        <Crush>0.0</Crush>
      </Damage>
      <MaxRange>4.0</MaxRange>
    </Slaughter>
  </Attack>
  <Auras datatype="tokens">
    slave_ownership
  </Auras>
  <Builder>
    <Rate>1.25</Rate>
	<Entities datatype="tokens">
      structures/{civ}_civil_centre
      structures/{civ}_military_colony
      structures/{civ}_temple_vesta
      structures/{civ}_government_center
      structures/{civ}_pyramid_1
      structures/{civ}_pyramid_2
      structures/{civ}_house
      structures/{civ}_ice_house
      structures/{civ}_tenement
      structures/{civ}_storehouse
      structures/{civ}_farmstead
      structures/{civ}_field
      structures/{civ}_rotarymill
      structures/{civ}_corral
      structures/{civ}_dock
      structures/{civ}_market
      structures/{civ}_pillar_ashoka
      structures/{civ}_statue
      structures/{civ}_ball_court
      structures/{civ}_temple
      structures/{civ}_temple_mars
      structures/{civ}_temple_amun
      structures/{civ}_theatron
      structures/{civ}_library
      structures/{civ}_lighthouse
      structures/{civ}_wonder
    </Entities>
  </Builder>
  <Cost>
    <Population>1</Population>
	<Resources>
      <food>50</food>
    </Resources>
    <BuildTime>15</BuildTime>
  </Cost>
  <Health>
    <Max>80</Max>
  </Health>
  <Identity>
    <GenericName>Citizen</GenericName>
	<Phenotype datatype="tokens">
	  female
	  male
	</Phenotype>
	<VisibleClasses datatype="tokens">Builder Gatherer Citizen TaxPayer</VisibleClasses>
	<Classes datatype="tokens">Worker Civilian</Classes>
	<Tooltip>Build civilian buildings and gather resources. Command nearby Slaves to work faster. Especially good at building.
Traits: Low Cost, Low Health, Slow Speed, Light Armor, Weak Attack, Avoids Death.
Good at: Building and Dying.
Mediocre at: Gathering Resources.
Bad at: Fighting.</Tooltip>
    <Icon>units/imp_support_citizen.png</Icon>
	<Formations disable=""/>
  </Identity>
  <RangeOverlayRenderer/>
  <ResourceGatherer>
    <MaxDistance>2.0</MaxDistance>
    <BaseSpeed>1.0</BaseSpeed>
    <Capacities>
      <food>10</food>
      <wood>10</wood>
      <stone>10</stone>
      <metal>10</metal>
      <glory>1</glory>
    </Capacities>
    <Rates>
      <food.fruit>0.5</food.fruit>
      <food.grain>0.25</food.grain>
      <food.meat>0.5</food.meat>
      <wood.tree>0.5</wood.tree>
      <wood.ruins>5.0</wood.ruins>
      <stone.rock>0.5</stone.rock>
      <stone.ruins>2</stone.ruins>
      <metal.ore>0.5</metal.ore>
    </Rates>
  </ResourceGatherer>
  <ResourceTrickle>
    <Rates> 
      <food>0.0</food>
      <wood>0.0</wood>
      <stone>0.0</stone>
      <metal>0.0</metal>
      <coin>1.0</coin>
      <glory>0.0</glory>
    </Rates> 
    <Interval>30000</Interval> 
  </ResourceTrickle>
  <Sound>
    <SoundGroups>
      <select>voice/{lang}/civ/civ_{phenotype}_select.xml</select>
      <order_walk>voice/{lang}/civ/civ_{phenotype}_walk.xml</order_walk>
      <order_attack>voice/{lang}/civ/civ_{phenotype}_attack.xml</order_attack>
      <order_gather>voice/{lang}/civ/civ_{phenotype}_gather.xml</order_gather>
      <order_repair>voice/{lang}/civ/civ_{phenotype}_repair.xml</order_repair>
      <order_garrison>voice/{lang}/civ/civ_{phenotype}_garrison.xml</order_garrison>
      <walk>actor/human/movement/walk.xml</walk>
      <run>actor/human/movement/run.xml</run>
      <attack>attack/weapon/sword.xml</attack>
      <death>actor/human/death/{phenotype}_death.xml</death>
      <build>resource/construction/con_wood.xml</build>
      <trained>interface/alarm/alarm_create_infantry.xml</trained>
      <gather_fruit>resource/foraging/forage_leaves.xml</gather_fruit>
      <gather_grain>resource/farming/farm.xml</gather_grain>
      <gather_tree>resource/lumbering/lumbering.xml</gather_tree>
      <gather_rock>resource/mining/pickaxe.xml</gather_rock>
      <gather_ore>resource/mining/mining.xml</gather_ore>
      <gather_ruins>resource/mining/mining.xml</gather_ruins>
    </SoundGroups>
  </Sound>
  <UnitAI>
	<CanPatrol>false</CanPatrol>
  </UnitAI>
  <UnitMotion>
    <WalkSpeed op="mul">0.8</WalkSpeed>
  </UnitMotion>
</Entity>

 

 

And then I have units/athen_support_citizen:

Spoiler

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_support_citizen">
  <Identity>
    <Civ>athen</Civ>
	<Lang>greek</Lang>
    <SpecificName>Polítis Athēnaîos</SpecificName>
    <GenericName>Athenian Citizen</GenericName>
    <Icon>units/athen_support_citizen.png</Icon>
  </Identity>
  <VisualActor>
    <Actor>units/athenians/female_citizen.xml</Actor>
    <Actor>units/athenians/male_citizen.xml</Actor>
  </VisualActor>
</Entity>

 

 

It doesn't work.

Edited by wowgetoffyourcellphone
Link to comment
Share on other sites

Got it to work, thanks!

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_support_citizen">
  <Identity>
    <Civ>theb</Civ>
	<Lang>greek</Lang>
    <SpecificName>Polites Thēbaios</SpecificName>
    <GenericName>Theban Citizen</GenericName>
    <Icon>units/athen_support_citizen.png</Icon>
    <SelectionGroupName>units/{civ}_support_citizen</SelectionGroupName>
  </Identity>
  <VisualActor>
    <Actor>units/athenians/{phenotype}_citizen.xml</Actor>
  </VisualActor>
</Entity>

 

  • Like 1
Link to comment
Share on other sites

Thanks for the reaction @Stan`! And glad it worked out for you @wowgetoffyourcellphone, sorry for the delayed reaction, I was AFK for the weekend :)

In the first template in the inheritance one should use (something like):

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit">
  <Identity>
    <Phenotype datatype="tokens">Child</Phenotype>
  </Identity>
  <VisualActor>
    <Actor>units/athenians/{phenotype}_citizen.xml</Actor>
  </VisualActor>
</Entity>

This will replace all {phenotype} occurrences in the visual actor (as well as in sounds) with "child".

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_support">
  <Identity>
    <Phenotype>Male Female</Phenotype>
  </Identity>
  <VisualActor>
    <Actor>units/athenians/{phenotype}_citizen.xml</Actor>
  </VisualActor>
</Entity>

This will randomly choose between the two given phenotypes. You have to make sure the Actor for all these entities (units/athenians/male_citizen.xml and units/athenians/female_citizen.xml) exist.

Using:

<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_support_citizen">
  <Identity>
    <Phenotype datatype="tokens">Child</Phenotype>
  </Identity>
  <VisualActor>
    <Actor>units/athenians/{phenotype}_citizen.xml</Actor>
  </VisualActor>
</Entity>

will add the "Child" to the list of possible phenotypes. (So that will become "Male Female Child".)

A notion to all (template) modders: <Gender> is to be replaced with <Phenotype>!

@Exodarion @darkinterloper @borg- @Nescio @Angen @(-_-) @Trinketos (And everyone else I did not mention.)

Any questions? Please ask!

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

@Freagarach, thank you for the explanation and examples. (Perhaps it should be added somewhere in the trac wiki?) I think I now understand how it works and why <Gender> was replaced. I'm not sure phenotype is the most appropiate term, but I can't think of anything better, so I won't complain about that. :)

On 8/3/2019 at 8:19 AM, wowgetoffyourcellphone said:

Is there an example yet in the core game? 

I'm not sure, but I suppose the lion and lioness templates could now be merged. (And it would be extra nice if someone would create a lion cub actor—note that they have spots!)

  • Like 2
Link to comment
Share on other sites

Can I ask for a small audio extension? If multiple phenotypes are selected, then their sunds play for each phenotype. For instance, a mixed group of men and women currently just pick one of the genders to play as their acknowledgement sounds (selected, tasked to move or chop, etc.), but it would be nice to hear both the man and woman sounds.

  • Like 3
  • Thanks 1
  • Confused 1
Link to comment
Share on other sites

23 hours ago, wowgetoffyourcellphone said:

Can I ask for a small audio extension? If multiple phenotypes are selected, then their sunds play for each phenotype. For instance, a mixed group of men and women currently just pick one of the genders to play as their acknowledgement sounds (selected, tasked to move or chop, etc.), but it would be nice to hear both the man and woman sounds.

You can ask of course ;) But wouldn't that be very annoying? For it would probably mean to have all different voices of a large selection group to be played simultaneously, which would mean you only hear rumour?

50 minutes ago, Trinketos said:

Is not used now?

The phenotypes itself are used (were previously genders), but the new feature to use random phenotypes is not used in the base game.

Link to comment
Share on other sites

48 minutes ago, azayrahmad said:

So is this means that it is possible to generate random gendered citizens like in AoE2? Is it possible for them to have different stats as well?

Different genders (actors) for same template, which means only one set of stats. But yeah, DE now has differently gendered villagers with the properly gendered voice files. 

Edited by wowgetoffyourcellphone
  • Like 2
Link to comment
Share on other sites

5 minutes ago, wowgetoffyourcellphone said:

Different genders (actors) for same template, which means only one set of stats. But yeah, DE now has differently gendered villagers with the properly gendered voice files. 

ith fenotype we even can differenciate kind of voices. soldier vs peasant or olderman and younger.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...