Author Topic: multiple factions sharing unit definitions  (Read 2372 times)

roflcopter

  • Guest
multiple factions sharing unit definitions
« on: 13 August 2011, 08:21:06 »
Suppose I want to create multiple factions which have several units in common, but have other units that are different.
Is there any way to specify (in the faction xml?) that additional units for the said faction can be found in some shared path outside the faction folder?

Faction A units = several shared units + several units unique to A
Faction B units = several shared units + several units unique to B
Faction C units = all unique to C
etc. etc.

(inb4) Yes I realize I can use symbolic links (with /factions/B/units/roflcopter being a folder-alias to /factions/A/units/roflcopter) during the development phase (so I only have to make adjustments to one copy of each file related to roflcopters) but I don't think that schema will port well to Windows systems...

Surely there must be a proper way to do this on a permanent basis rather than keeping multiple copies of the same folders(s).
« Last Edit: 13 August 2011, 08:27:05 by roflcopter »

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: multiple factions sharing unit definitions
« Reply #1 on: 13 August 2011, 10:07:35 »
Firstly, it's a bad idea to have the exact same unit in more than one faction: it'd boring and unimaginative. At least change some parts (eg, a swordman unit is a very common reoccurance, but the swordman in persian is very different from the swordman in tech).

The XML will have to be unique, but that's the tiny part any way, just have the models in one unit's folder and have all the same units specify that model in the path. Thus, we have unique XMLs, but the models and images are shared. This is the same technique that GAE's Shibboleth testing mod uses, linking to the Magitech files (in a whole different techtree!) to reduce filesize and "copy" the units.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Coldfusionstorm

  • Golem
  • ******
  • Posts: 868
    • View Profile
Re: multiple factions sharing unit definitions
« Reply #2 on: 13 August 2011, 13:47:48 »
Yes there is, there is a common data folder in never versions of Megaglest, then you just need to backlink to these folders.

tech/faction1
tech/faction2
tech/commondata

so when adding files in the xml (wich would be under tech/faction/unit/roflcopter), you just place a ../../../ (untill you reach the common data).

(thats how i remeber it being done, one ../ for eachfolder backflip (moving one folder back up).

WiP Game developer.
I do danish translations.
"i break stuff"

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Re: multiple factions sharing unit definitions
« Reply #3 on: 13 August 2011, 16:59:16 »
U can share most files between factions in glest with few exceptions, which are the faction xml and unit xml (example: archer.xml).
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: multiple factions sharing unit definitions
« Reply #4 on: 13 August 2011, 18:19:45 »
Yes there is, there is a common data folder in never versions of Megaglest, then you just need to backlink to these folders.

tech/faction1
tech/faction2
tech/commondata
Hate to drag you down to reality, but so called common data is available in all versions of Glest and always have been. Apocalyptic Dawn uses a "shared" folder to store the icons and sounds, for example. It's purely a matter of pointing the relative links correctly and is no different than having them stored in a unit's folder.

Since the XMLs are the only part that tell the engine where to find the other files, they are the only thing that absolutely must exist. You can even put the files where ever you want, so long as you link to them in the XML.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

roflcopter

  • Guest
Re: multiple factions sharing unit definitions
« Reply #5 on: 13 August 2011, 23:30:03 »
Firstly, it's a bad idea to have the exact same unit in more than one faction: it'd boring and unimaginative. At least change some parts (eg, a swordman unit is a very common reoccurance, but the swordman in persian is very different from the swordman in tech).
Hmm. Maybe I'm looking at it the wrong way.

Perhaps it would be possible to make A and B use the same faction/unit-set with some kind of internal branching/specialization. Is it possible to define mutually exclusive upgrades, e.g.:
Could performing the upgrade that allows units_A ... prevent the same player from performing (during the same game) the upgrade that allows units_B?

That would effectively create sub-factions within a faction (to be chosen during the game rather than on the pre-game screen).

The objective being to have a large pool of units but with no player having access to all of them.

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: multiple factions sharing unit definitions
« Reply #6 on: 14 August 2011, 00:55:03 »
That would effectively create sub-factions within a faction (to be chosen during the game rather than on the pre-game screen).
Yeah, this has been possible in GAE for a couple years already.

https://docs.megaglest.org/GAE/Subfactions
« Last Edit: 18 June 2016, 19:29:48 by filux »

roflcopter

  • Guest
Re: multiple factions sharing unit definitions
« Reply #7 on: 14 August 2011, 05:22:09 »
That would effectively create sub-factions within a faction (to be chosen during the game rather than on the pre-game screen).
Yeah, this has been possible in GAE for a couple years already.

https://docs.megaglest.org/GAE/Subfactions
Ah, yes. Hasten the merge.

As for my previous question, is there a general way for one upgrade to depend negatively upon another (like "you can do A only if you have not done B, and vice versa")?
« Last Edit: 18 June 2016, 19:28:13 by filux »

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: multiple factions sharing unit definitions
« Reply #8 on: 14 August 2011, 06:05:03 »
As for my previous question, is there a general way for one upgrade to depend negatively upon another (like "you can do A only if you have not done B, and vice versa")?
That can be done with subfactions, yes. For example, upgrade A and B both exist in the "base" faction (that is, no subfaction). Upgrade A will advance you into one subfaction, where upgrade B does not exist, while upgrade B will advance you down another subfaction where upgrade A does not exist.

Compared to an existing (kinda) example, in the Four Path Magitech (a kinda started mod that I'd continue one day if time ever allows), Magic's ghost armour exists only in the base and "path of corruption" subfaction. If you choose to go down the "path of nature" subfaction, the ghost armour is unavailable (done by simply not including it in that subfaction). The ghost armour only exists in the "path of corruption" and base subfactions (the only ones listed in its XML).

So back to your example, upgrade A would exist only in the "upgrade A" and base subfactions, and once done, moves you into the "upgrade_a" subfaction (where upgrade b does not exist, and therefore, cannot be done).
Code: [Select]
<subfaction-restrictions>
<subfaction name="base" />
<subfaction name="upgrade_a" />
</subfaction-restrictions>
<advances-to-subfaction name="upgrade_a" is-immediate="false"/>
Upgrade B would only exist in the "upgrade B" and base subfactions, and once done, moves you into the "upgrade_b" subfaction.
Code: [Select]
<subfaction-restrictions>
<subfaction name="base" />
<subfaction name="upgrade_b" />
</subfaction-restrictions>
<advances-to-subfaction name="upgrade_b" is-immediate="false"/>
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

roflcopter

  • Guest
Re: multiple factions sharing unit definitions
« Reply #9 on: 17 August 2011, 04:14:21 »
As for my previous question, is there a general way for one upgrade to depend negatively upon another (like "you can do A only if you have not done B, and vice versa")?
That can be done with subfactions, yes. For example, upgrade A and B both exist in the "base" faction (that is, no subfaction). Upgrade A will advance you into one subfaction, where upgrade B does not exist, while upgrade B will advance you down another subfaction where upgrade A does not exist.

I figured out what seems to be a reasonable way to do this in MegaGlest:
  • Give the faction one copy of a (purely symbolic) starter unit which cannot be produced by any means.
  • Allow this unit to morph into exactly one of an arbitrary number of derivative units.
  • Have the same arbitrary number of upgrades, each of which names exactly one of these derivative units as <unit-requirements>.
  • Have this faction contain a wide assortment of elemental/sub-faction units, each of which names exactly one of the above upgrades among its <upgrade-requirements>.
Step 3 being needful as the upgrade (unlike the morphed unit) cannot be killed off for strategic advantage.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: multiple factions sharing unit definitions
« Reply #10 on: 18 August 2011, 03:15:04 »
That has nowhere near the same abilities of subfactions, however. You'd be limited to the upgrades being only on this single unit, you cannot have more of this unit, and you can't restrict entire buildings, attacks, or units to a subfaction.

The best way to do this in MegaGlest would actually be merging the two engines into Glest 4.0.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert