Results 1 to 5 of 5
  1. #1
    Member Level 5
    Join Date
    Jun 2009
    Posts
    161
    Rep Points
    1
    Rep Power
    4

    Questions regarding XML

    As some of you may already know, i'm creating a flame tank pack which contains many varients as well as a few non-flamer varients (like sherman 105mm). I'd also like to release the pack as an unofficial addon to DCG. A few questions though...

    1. Zeke and Ngvede created their own vehicle pack, for the program to recognize it they created their own XML database of the units and their values. If i were to create my own XML file with any name I choose, will the program pick up on it, and use my vehicles as well?

    2. If that isn't the case, would I have to release it as an addon for the existing vehicle pack, and make the modifications to Zeke's and Ngvede's XML file?

    3. I have a few questions regarding what some of the values and syntax mean,

    , <rarity>1.3</rarity>; Is this the likely hood that it would be availiable to buy in the campaign, does higher = higher % chance, and any sort of scale on how likely it is? (e.g is 1.2 twice as likely as 0.6)

    <type>hd</type>; Some sort of classification, for what purpose though, for the AI, or something else?

    Ok this one is just the name in the editor

    <category>1</category>; Not sure on this one either, is this relating to the submenu the unit is found under?

    <inventory>{item "repair_kit"}</inventory>; If difine an inventory item, will it completly replace the defaut infantry loadout? or will it be in-addition to the default loadout


    4. Finally an import question, will the AI make use of these vehicles soley based on the information in the XML? So will they follow the rarity rules and the start/end date to randomly spawn in the mission, or does this have to be defined else where?


    Thanks, Zlatko

  2. #2
    Member Level 10
    Join Date
    Apr 2007
    Posts
    641
    Rep Points
    16
    Rep Power
    7

    Re: Questions regarding XML

    Quote Originally Posted by Zlatko
    1. Zeke and Ngvede created their own vehicle pack, for the program to recognize it they created their own XML database of the units and their values. If i were to create my own XML file with any name I choose, will the program pick up on it, and use my vehicles as well?
    DCG will recognize any file that starts with "Vehicles" and ends with ".xml" (ie. "Vehicles_MyNewOnes.xml")

    Quote Originally Posted by Zlatko
    2. If that isn't the case, would I have to release it as an addon for the existing vehicle pack, and make the modifications to Zeke's and Ngvede's XML file?
    I would just make your own new file - be sure to copy the format for Zeke and Ngvede's though.

    Quote Originally Posted by Zlatko
    3. I have a few questions regarding what some of the values and syntax mean,
    , <rarity>1.3</rarity>; Is this the likely hood that it would be availiable to buy in the campaign, does higher = higher % chance, and any sort of scale on how likely it is? (e.g is 1.2 twice as likely as 0.6)
    These are values from the old Avalon Hill board game Advanced Squad Leader. DCG uses a similar system to the one from that game. Here's the code in C# (even if you don't understand the syntax, you should be able to see the probabilities next to the rarity numbers):

    Code:
                if (rarity == null)
                {
                    return Campaign.random.Next(_maxplayerunits) + 1;
                }
                else
                {
                    int amount = 0;
                    bool available = true;
                    for (int i = 0; i < _maxplayerunits; i++)
                    {
                        if (available == true)
                        {
                            int probability = 99;
                            switch (rarity)
                            {
                                case "1.6":
                                    probability = 2;
                                    break;
                                case "1.5":
                                    probability = 7;
                                    break;
                                case "1.4":
                                    probability = 16;
                                    break;
                                case "1.3":
                                    probability = 27;
                                    break;
                                case "1.2":
                                    probability = 41;
                                    break;
                                case "1.1":
                                    probability = 57;
                                    break;
                                case "1.0":
                                    probability = 77;
                                    break;
                                case "0.9":
                                    probability = 99;
                                    break;
                            }
                            int chance = Campaign.random.Next(100);
                            if (chance < probability)
                            {
                                amount++;
                            }
                            else
                            {
                                available = false;
                            }
                        }
                    }
                    return amount;
                }
    Quote Originally Posted by Zlatko
    <type>hd</type>; Some sort of classification, for what purpose though, for the AI, or something else?
    Ok this one is just the name in the editor
    Sounds like you guessed that one

    Quote Originally Posted by Zlatko
    <category>1</category>; Not sure on this one either, is this relating to the submenu the unit is found under?
    This is used by DCG for some things like the historical operations. The units designate the maximum level of mechanization by using those numbers which also correspond more or less to the categories in the MoW entities folder.

    Quote Originally Posted by Zlatko
    <inventory>{item "repair_kit"}</inventory>; If difine an inventory item, will it completly replace the defaut infantry loadout? or will it be C to the default loadout
    It's in addition.

    Quote Originally Posted by Zlatko
    4. Finally an import question, will the AI make use of these vehicles soley based on the information in the XML? So will they follow the rarity rules and the start/end date to randomly spawn in the mission, or does this have to be defined else where?
    Nope, that's it. (with the exception of some historical operations using category numbers like I said above)

  3. #3
    Member Level 5
    Join Date
    Jun 2009
    Posts
    161
    Rep Points
    1
    Rep Power
    4

    Re: Questions regarding XML

    Wow, thanks a lot! That answered all my questions better than I ever could of imagined. Sorry to bother you again but I have many more questions to ask, to try and give me a clear picture of how this works.

    So with the catagory, during operation Overlord for example, the American airbourne units might only have access to catagorys '0' '1' and '8', being cannons, cars, and air support? That seems the most logical use for it.

    If that is the case, do standard map units, or generated ones just randomly pick from the group? So they might have many cannons, or many cars, or a mix of both? Do they have a higher chance of having medium tanks over heavies, and is the units catagories generated at start of battle or carried with them?

    While the probablity is easy to see the chance of aquiring a unit in the players arsonal, is the player given X catagory '1' units and so on? I have a theory on how the AI armys work but i'd like to clarify. When an army is generated, is it given units like: "4xCatagory 3", "2xCatagory 3" and "1xCatagory 3"? And then if an army unit has 5 medium tanks, and only 3 to chose from being a=2%; b=57%; c=99%, would the probability of those units being chosen be a=1.23%; b=36%; c=62.65% with 5 rolls of the dice to pick them?


    Thanks, sorry for pestering you

  4. #4
    Member Level 10
    Join Date
    Nov 2008
    Location
    Glued to the keyboard
    Posts
    605
    Rep Points
    4
    Rep Power
    5

    Re: Questions regarding XML

    Quote Originally Posted by Zlatko
    Wow, thanks a lot! That answered all my questions better than I ever could of imagined. Sorry to bother you again but I have many more questions to ask, to try and give me a clear picture of how this works.

    So with the catagory, during operation Overlord for example, the American airbourne units might only have access to catagorys '0' '1' and '8', being cannons, cars, and air support? That seems the most logical use for it.

    If that is the case, do standard map units, or generated ones just randomly pick from the group? So they might have many cannons, or many cars, or a mix of both? Do they have a higher chance of having medium tanks over heavies, and is the units catagories generated at start of battle or carried with them?

    While the probablity is easy to see the chance of aquiring a unit in the players arsonal, is the player given X catagory '1' units and so on? I have a theory on how the AI armys work but i'd like to clarify. When an army is generated, is it given units like: "4xCatagory 3", "2xCatagory 3" and "1xCatagory 3"? And then if an army unit has 5 medium tanks, and only 3 to chose from being a=2%; b=57%; c=99%, would the probability of those units being chosen be a=1.23%; b=36%; c=62.65% with 5 rolls of the dice to pick them?


    Thanks, sorry for pestering you
    (Jason1 can probably answer this question better, but I'll give it a try anyway)

    Categories up to 4 restricts the particular unit to units at or below that category, just like you thought.
    Category 99 is the "standard" mix of tanks and infantry, whilst category "5" is the "tank rush" loadout. (focus on loads of heavy tanks)
    I don't know of the exact balance between infantry and vehicles, but I think the process for the AI works as follows:
    1)Imaginary "roll" between all available units
    2) Check vs availability rating
    3) If passed, add one vehicle/infantry squad, if fail, "roll" for another unit.

    When it comes to the player; slightly different:
    Availability roll for -every- available unit. (in order)
    If "passed" check to see if one more is available, if that too passed, check for one more etc...
    If failed, check next vehicle in the list.
    This means that units with a 99% availability will probably be available in rather high numbers, a unit with around 70% availability might be available in 1-3 units, a unit with 2% probably 0, but perhaps 1.
    DCG Infantry monkey. Mod link: viewforum.php?f=138

  5. #5
    Member Level 10
    Join Date
    Apr 2007
    Posts
    641
    Rep Points
    16
    Rep Power
    7

    Re: Questions regarding XML

    Kohlrabi's post above is a great explanation. The only thing I would add is that the AI forces roll first for balance of infantry squads vs. vehicles before they start rolling for the specific types.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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