Jump to content

Technical Art Requirements


Recommended Posts

54 minutes ago, Gurken Khan said:

@Stan` IIRC you once wrote that it's a matter of art which flag is shown on a building. Since I really think the owner's flag should be shown on all owned buildings - including captured ones - where would be a good point to introduce that into the process, so that mid-term we'd have that?

Currently it's art controlled. See: https://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/art/actors/structures/athenians/barracks.xml#L25

23	  <group>
24	    <variant name="ungarrisoned" frequency="1"/>
25	    <variant name="garrisoned">
26	      <props>
27	        <prop actor="props/special/common/garrison_flag_hele.xml" attachpoint="garrisoned"/>
28	      </props>
29	    </variant>
30	  </group>
31	  <group>

This group controls the flag that's being displayed (here it's hele for helenistic because all hele civs have the same flag). By default the variant ungarrisoned is selected because it has a frequency of 1 (the other is 0)

This is controlled by this code: https://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/components/GarrisonHolder.js#L374

365	/**
366	 * Updates the garrison flag depending whether something is garrisoned in the entity.
367	 */
368	GarrisonHolder.prototype.UpdateGarrisonFlag = function()
369	{
370	    let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
371	    if (!cmpVisual)
372	        return;
373	
374	    cmpVisual.SetVariant("garrison", this.entities.length ? "garrisoned" : "ungarrisoned");
375	};


As you can see it's an on/off switch, either it's there or it's not. It forces the variant with frequency=0 to be shown.

To change this one solution could be to add a lot of variants:

23	  <group>
24	    <variant name="ungarrisoned" frequency="1"/>
25	    <variant name="garrisoned-hele">
26	      <props>
27	        <prop actor="props/special/common/garrison_flag_hele.xml" attachpoint="garrisoned"/>
28	      </props>
29	    </variant>
30	    <variant name="garrisoned-spart">
31	      <props>
32	        <prop actor="props/special/common/garrison_flag_spart.xml" attachpoint="garrisoned"/>
33	      </props>
34	    </variant>
35	  </group>
      ...
36	  <group>

And changing the code like so:

365	/**
366	 * Updates the garrison flag depending whether something is garrisoned in the entity.
367	 */
368	GarrisonHolder.prototype.UpdateGarrisonFlag = function()
369	{
370	    let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
371	    if (!cmpVisual)
372	        return;
373	    const cmpPlayerIdentity = QueryOwnerInterface(this.entity, IID_Identity);
374	    cmpVisual.SetVariant("garrison", this.entities.length ? `garrisoned-${cmpPlayerIdentity.GetCiv()}` : "ungarrisoned");
375	};

The problem is it requires a lot of manual work, it's not really flexible, and once you have a new civ, you're good to update all actors one by one. (You could automate some of it, but still)

Another solution would be to make the flag creation the responsibility of the code  like it's the case for rally points, which need to be sent over the network. But this has a performance cost, cause creating new entities through AddEntity ain't cheap. 

 

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

3 hours ago, Gurken Khan said:

Ohhhhhkayyyy. I understood some of it. ;)

Maybe I keep bringing it up until someone has a genius idea how to do it economically.

Glad it helped, let me know if you wanna understand more of it.

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...