Author Topic: Storing Skill Types By Faction  (Read 4633 times)

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Storing Skill Types By Faction
« on: 13 January 2013, 01:48:16 »
How would you guys feel about storing skills in a faction folder and then simply tying them to models with a string in the XML. So then you could give all units a basic attack with a basic damage, and then assign a value to the new strength stat in the unit XML to do differentiation.

You could then write one basic attack skill, one standard move skill, one stop skill, one die skill and for buildings one be_built skill. This instead of having to write one skill that essentially looks identical in every unit XML.

And if you want to add special attack skills its can't possibly add any more effort. Then in the unit XML you would just specify a set of strings:
<skills>
  <skill "stop">
  <skill "move">
  <skill "attack">
  <skill die">
</skills>

Special skills would have their name in the skill XML file so you could just plug another string in in the unit Xml. You can also set move speed and attack speed and other things in the Unit file to be added to the values in the skill file.

Personally I would consider this a more efficient method of defining skills but I am not sure if modders would agree.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Storing Skill Types By Faction
« Reply #1 on: 13 January 2013, 03:35:54 »
How would you guys feel about storing skills in a faction folder and then simply tying them to models with a string in the XML. So then you could give all units a basic attack with a basic damage, and then assign a value to the new strength stat in the unit XML to do differentiation.

You could then write one basic attack skill, one standard move skill, one stop skill, one die skill and for buildings one be_built skill. This instead of having to write one skill that essentially looks identical in every unit XML.

And if you want to add special attack skills its can't possibly add any more effort. Then in the unit XML you would just specify a set of strings:
<skills>
  <skill "stop">
  <skill "move">
  <skill "attack">
  <skill die">
</skills>

Special skills would have their name in the skill XML file so you could just plug another string in in the unit Xml. You can also set move speed and attack speed and other things in the Unit file to be added to the values in the skill file.

Personally I would consider this a more efficient method of defining skills but I am not sure if modders would agree.
How would it work with models? Or would we still link the model from the unit XML?
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Storing Skill Types By Faction
« Reply #2 on: 13 January 2013, 05:43:35 »
Well you would give the models for generic commands all the same name. So all die models would just be die.g3d and the walk models all walk.g3d.

Models would still be stored in the unit folders though.

Now there are a few ways to do it with special skills. You could give them numbered values, you could give them unit types and skill names or some such thing. You could even theoretically put special skills into the unit folder if you wanted.

Skills would still be stored with units in memory I'd expect. It might also be possible to set up move stop and die like meeting point and be_built skills, just having them load for any unit with a model.

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Storing Skill Types By Faction
« Reply #3 on: 13 January 2013, 06:35:14 »
I'd really prefer not to force all the models to be in separate folders because then we loose the ability to use 1 texture for multiple different models.
I really think this would only make it more confusing for new modders and more of a pain in the ass to do XML work... If you want to minimize XML parsing or something.. just find a faster format. As far as I know XML is pretty dang slow.
Egypt Remastered!

Proof: Owner of glest@mail.com

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Storing Skill Types By Faction
« Reply #4 on: 13 January 2013, 06:46:22 »
I'd really prefer not to force all the models to be in separate folders because then we loose the ability to use 1 texture for multiple different models.
I really think this would only make it more confusing for new modders and more of a pain in the ass to do XML work... If you want to minimize XML parsing or something.. just find a faster format. As far as I know XML is pretty dang slow.

Wait what? No. The models would be in the same place they currently are. Its only the XML that would change. I want to minimize how much XML has to be WRITTEN, not parsed. You can still use a texture for more than one model.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Storing Skill Types By Faction
« Reply #5 on: 13 January 2013, 07:20:07 »
I'd really prefer not to force all the models to be in separate folders because then we loose the ability to use 1 texture for multiple different models.
I really think this would only make it more confusing for new modders and more of a pain in the ass to do XML work... If you want to minimize XML parsing or something.. just find a faster format. As far as I know XML is pretty dang slow.

Wait what? No. The models would be in the same place they currently are. Its only the XML that would change. I want to minimize how much XML has to be WRITTEN, not parsed. You can still use a texture for more than one model.
The problem is that the models would have to be in the same folder as the textures. Since your method cuts out the ability to insert a path, there's no way to tell the game to use the models that are all in this grouped folder. As well, how would we have multiple models for a command (I don't believe this was implemented in GAE, but as a future possibility, perhaps)?
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Storing Skill Types By Faction
« Reply #6 on: 13 January 2013, 07:40:11 »
I don't understand why you think the models would be in a different folder than the textures? Only the XML would be moved. Everything else would stay the same as it currently is.

And why couldn't you use a path?

And why couldn't you have multiple models for a skill?

If you guys are going to make these statements, perhaps you could specify why you think those things?

Using multiple models is trivial, and could be done in a multitude of ways. You could specify a limit on the possible number then search the unit model folder for the file names if you numbered it. Like for move it would search for move0 - move9 or something and add however many it found. I haven't got plans to add multiple models because it takes time to make and loads up game memory with many times the number of megabytes, but there is no reason you couldn't find every model file for a given skill type.

I also don't why you think paths couldn't work? The model names would be walk0 - walk9 as previously indicated. The string specified by the player would be walk. The program would grab the generic walk skill, the only one named walk in my method, it would grab the XML data and just use the current path to that unit and add /models.walk0.g3d to it to grab the model and then it would check for any other g3d files with walk and a number from 1-9 and load those also.
« Last Edit: 13 January 2013, 08:55:19 by MoLAoS »

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Storing Skill Types By Faction
« Reply #7 on: 13 January 2013, 09:24:59 »
I don't understand how this will be any easier... It would only be different. This sounds like it would cut down maybe 1/3 of the writing of an XML.. but what's the point of that? Copy-pasting is faster. I kinda feel like I'm the only modder who just copy-pastes an xml and modifies it... It's rare for me to even type and entire XML line out.
Egypt Remastered!

Proof: Owner of glest@mail.com

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Storing Skill Types By Faction
« Reply #8 on: 13 January 2013, 10:13:07 »
I don't understand how this will be any easier... It would only be different. This sounds like it would cut down maybe 1/3 of the writing of an XML.. but what's the point of that? Copy-pasting is faster. I kinda feel like I'm the only modder who just copy-pastes an xml and modifies it... It's rare for me to even type and entire XML line out.

I copy paste quite a lot actually. Shit I use find and replace a lot. I don't like how much space some stuff takes up in unit XML. Its pointless to copy paste at least 3-4 skills on each unit all the time when you could do it once and ignore it. For units without any special attacks you could avoid having to type out any skills at all. Probably something to be done with commands to.

Its mainly a readability issue. I've also been changing around the XML for other things making most things optional with default values.

As another option, how would you feel about standard commands/skills only needing the name? So for the die command you would just type die in the unit xml and it would know to grab the die.g3d it would know the skill type was die, it would set animation and speed to 100, ep cost auto set to 0, and it would grab sounds listed with the name die, or die0 - die9. You could still store skills in the unit file then and you could add any level of necessary detail, although for skills like die why would you need to?

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Storing Skill Types By Faction
« Reply #9 on: 13 January 2013, 18:25:54 »
I don't understand how this will be any easier... It would only be different. This sounds like it would cut down maybe 1/3 of the writing of an XML.. but what's the point of that? Copy-pasting is faster. I kinda feel like I'm the only modder who just copy-pastes an xml and modifies it... It's rare for me to even type and entire XML line out.

I copy paste quite a lot actually. Shit I use find and replace a lot. I don't like how much space some stuff takes up in unit XML. Its pointless to copy paste at least 3-4 skills on each unit all the time when you could do it once and ignore it. For units without any special attacks you could avoid having to type out any skills at all. Probably something to be done with commands to.

Its mainly a readability issue. I've also been changing around the XML for other things making most things optional with default values.

As another option, how would you feel about standard commands/skills only needing the name? So for the die command you would just type die in the unit xml and it would know to grab the die.g3d it would know the skill type was die, it would set animation and speed to 100, ep cost auto set to 0, and it would grab sounds listed with the name die, or die0 - die9. You could still store skills in the unit file then and you could add any level of necessary detail, although for skills like die why would you need to?

I honestly don't see that as help.. As long as this doesn't replace the way it works now, then do as you wish...

I think the only improvements we could make to XML would be to speed up the parsing. :P
Egypt Remastered!

Proof: Owner of glest@mail.com

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Storing Skill Types By Faction
« Reply #10 on: 13 January 2013, 20:31:30 »
There is no reason to speed up parsing. My 4 year old core 2 duo loads even my massively bloated factions in like 30-90 seconds or something.

Anyways I decided to go ahead and do the second thing since I'm changing so much other skill and command stuff already.

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: Storing Skill Types By Faction
« Reply #11 on: 13 January 2013, 23:48:31 »
Anything that cuts down on XML is good, as long as the the new system is capable of doing everything (or more) that the old system was then I support it. Of course this will end any notion of 'porting' mods between VG/MG and Mandate but I guess that was already the case due to changes you have already made.

I've read thru the list of changes in the Mandate threads and as a modder it would be nice to know how these things are implemented in XML.
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
Re: Storing Skill Types By Faction
« Reply #12 on: 14 January 2013, 00:32:58 »
Haha my 100 item 75 unit faction gets deprecated every other time I compile something :) Such a pain to modify so many files. So its definitely unlikely that a GAE or MG mod would just fit in. I even took out certain things like supporting vanilla Glest typos and what not.

However a GAE mod would function perfectly, as would a vanilla Glest mod. You would just need to make some slight alterations to the XML files, but the actual gameplay is still supported.

The new system supports any in game effect that the old one did, as well as various other new aspects.

I was planning on releasing an updated documentation of XML once the major changes were done. Its still possible that I would refactor other aspects of the engine with XML related functions before  I'm done.

Almost everything is fairly similar to the way it currently is. Enhancements are a little different though:
Here is the basic stuff you need to give a unit heal and a vision range.

<statistics> Super class for enhancements, contains the new damage types and resistances and possibly new stuff soon
  <enhancement> standard GAE enhancement tags, however stuff has been rewired a bit
   <resource-pools> this class contains hp,  sp, ep, cp, and also hp, sp, ep boosts for adding to current instead of max
     <max-hp value="100" value-mult="0" add="0" mult="0"/> this tag is for the new stat class for single stats
   </resource-pools>
   <unit-stats> this contains the leftover stats currently, sight, morale, expgiven, movespeed, and effect strength
     <sight value="10" value-mult="0"/> this is also the code for the stat class, obviously the sight stat
   </unit-stats>
  </enhancement>
</statistics>

The Stat class contains the data points of a single stat, value is the basic value, like max-hp, value mult is for upgrades and other things that add/multiply unit stats. value is also used for that when its not on the unit itself. add is the value that works for layered upgrades, so you can click the same upgrade button many times and each time you get the original bonus + the add value for as many times as its clicked. mult is the same but a multiplier. This would also work for stacking buffs from effects, or even doing each extra stack of the buff has decreased effect.

It may seem like there are a lot of tags, but thats the problem with XML, its quite verbose. The above unit doesn't have resistances for instance. Note that it also has no AttackStats tag, because all tags are optional, and it has no ProductionSpeeds tag because its not a worker or building and doesn't harvest repair or produce anything. Those are subclasses of enhancement.

There is actually another tag, the creatable-type tag, which is the class that contains the dimensions of the unit and the resource/upgrade/unit/item requirements and the skills and commands. UnitType and ItemType inherit from this class.

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Storing Skill Types By Faction
« Reply #13 on: 14 January 2013, 03:01:42 »
I don't understand how this will be any easier... It would only be different. This sounds like it would cut down maybe 1/3 of the writing of an XML.. but what's the point of that? Copy-pasting is faster. I kinda feel like I'm the only modder who just copy-pastes an xml and modifies it... It's rare for me to even type and entire XML line out.
Same here.  :)
Get the Vbros': Packs 1, 2, 3, 4, and 5!

 

anything