Page 1 of 3

Random Battle and Campaign Generator Mod

Posted: Mon Jun 06, 2011 1:30 pm
by dazoline II
I've completed version 0.2 of my MoreRandomOptions mod.

I've added several pieces of functionality, most notably the ability to store units in a single place for a random campaign and to be able to edit these units via the newly modded XML files.

For a detailed list of changes and information take a look at the Readme.txt file in the attached zip.

I welcome any feedback.



Edit:
I will put this description in the Readme.txt file for better clarity.
I've uploaded vesion 0.2a here, the modifications are a new readme file and a small fix for the RCG.

Modifying the Core Units:
A new set of files have been created to allow easier modifying of core units for random campaigns.

Out of the box functionality when building a Random Campaign means using a campaign file (Data/Random Campaigns) and a set of battles files (Data/Battles), the battle files contain the core units, which means without the mod you have to edit the core units in every battle file.

The modded files are contained in (Data/Campaign Core Units) and are named exactly like their counterparts in (Data/Random Campaigns). There are a number of different bits of functionality to these new files.

1. You only have to edit one file to affect all key core units across all campaign battles.

2. The modded files support upgrades. If you look in one of the longer modded campaign files such as 1st Inf, 41 - 44 you will see multiple core tags inside the coreunit tag. Each tag has a date and scenario attribute which describes when that upgrade takes place. In the core tag are unit tags, corresponding to the core units in that scenario. Remember that the unitname attribute of a unit tag is what keeps track of that unit between battles and provides the upgrade path.

3. A file, in (Data/Campaign Core Units) will provide some of the units for each of that campaigns battles subject to:
a. An out of the box random campaign will have no CCU (Campaign Core Unit) file, the code will recognize this and only use the core units present in the battles files. This allows the code to execute on non modded campaign files without crashing.
b. A random campaign that has a CCU file will have its key core units in Battles files replaced by the units in the CCU file. Note a key core unit is different than a core unit, not sure why but it is.
c. Any non key core units in Battles files will not be replaced, so there will be variability retained in the units used from battle to battle in a campaign.
d. The Random Campaign description will display the key core units described in the CCU not the original key core units from the campaign file.




Example.
In the Battle file below the units numbered from 1 to 6 are the key core units, these are present in every campaign battle. The CCU file below the battle file replaces these 6 units with nine modified units.
The scenario generated from the RCG will contain the units 7 - 10 from the battle file and the units from 1 - 9 from the CCU file.
An upgrade for unit 1 in the CCU file will look like below with the first instance being a Mark III G tank and the upgrade being a Mark III H tank type.

Note I've seen key core units that come as replacements in some battles so if you want all your key core units present for all turns in a battle you have to set the attributes reinforcementChance="1" reinforcementTurn="0" in the unit tags.


Battle File German Summer 41 (First) - 1st Pzr Div.xml
<coreunits>
1. <unit unitid="Pz Kpfw IIIG" unitname="HQ 2/1-1 Panzer" exp="Veteran" number="2" max="2"></unit>
2. <unit unitid="Pz Kpfw IIIG" unitname="2/2/1-1 Panzer" exp="Veteran" number="5" max="5"></unit>
3. <unit unitid="Pz Kpfw IVE" unitname="2/1/1-1 Panzer" exp="Elite" number="4" max="4"></unit>
4. <unit unitid="Pz Grenadier 41" unitname="1/2/1-1 PzGren" exp="Veteran" number="3" max="3"></unit>
5. <unit unitid="Sd Kfz 251" unitname="1/2/1-1 Transport" exp="Veteran" number="3" max="3"></unit>
6. <unit unitid="Sd Kfz 222" unitname="1/1-1 Aufkl" exp="Veteran" number="2" max="2"></unit>
7. <unit unitid="81mm Mortar" unitname="2/1-1 81mm Mortar" exp="Veteran" number="6" max="6" probability="A=.99;D=0.5"></unit>
8. <unit unitid="105mm Artillery" unitname="105mm Artillery" exp="Veteran" number="4" max="4" probability="A=0.75;D=0.5"></unit>
9. <unit unitid="150mm Artillery" unitname="150mm Artillery" exp="Veteran" number="4" max="4" probability="A=0.33;D=0.25"></unit>
10. <unit unitid="JU-87 Stuka" unitname="JU-87 Stuka" exp="Veteran" number="2" max="2" probability="A=0.75;D=0.75"></unit>
</coreunits>



1st Panzer Div 1941 Short.mine.xml
<coreunits desc="...">
<core date="6/22/1941" battle="German Summer 41 (First) - 1st Pzr Div">
1. <unit unitid="Pz Kpfw IIIG" unitname="HQ 2/1-1 Panzer" exp="Elite" number="2" max="2" reinforcementChance="1" reinforcementTurn="0"></unit>
2. <unit unitid="Pz Kpfw IIIG" unitname="2/2/1-1 Panzer" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
3. <unit unitid="Pz Kpfw IIB" unitname="2/2/1-2 Panzer" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
4. <unit unitid="Pz Kpfw IVE" unitname="2/1/1-3 Panzer" exp="Veteran" number="4" max="4" reinforcementChance="1" reinforcementTurn="0"></unit>
5. <unit unitid="Pz Grenadier 41" unitname="1/2/1-1 PzGren" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
6. <unit unitid="Sd Kfz 251" unitname="1/2/1-1 Transport" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
7. <unit unitid="Pz Grenadier 41" unitname="1/2/1-2 PzGren" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
8. <unit unitid="Sd Kfz 251" unitname="1/2/1-2 Transport" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
9. <unit unitid="Sd Kfz 231" unitname="1/1-1 Aufkl" exp="Veteran" number="3" max="3" reinforcementChance="1" reinforcementTurn="0"></unit>
</core>
<core ... >
1. <unit unitid="Pz Kpfw IIIH" unitname="HQ 2/1-1 Panzer" exp="Elite" number="2" max="2" reinforcementChance="1" reinforcementTurn="0"></unit>
2. <unit unitid="Pz Kpfw IIIG" unitname="2/2/1-1 Panzer" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
3. <unit unitid="Pz Kpfw IIB" unitname="2/2/1-2 Panzer" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
4. <unit unitid="Pz Kpfw IVE" unitname="2/1/1-3 Panzer" exp="Veteran" number="4" max="4" reinforcementChance="1" reinforcementTurn="0"></unit>
5. <unit unitid="Pz Grenadier 41" unitname="1/2/1-1 PzGren" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
6. <unit unitid="Sd Kfz 251" unitname="1/2/1-1 Transport" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
7. <unit unitid="Pz Grenadier 41" unitname="1/2/1-2 PzGren" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
8. <unit unitid="Sd Kfz 251" unitname="1/2/1-2 Transport" exp="Veteran" number="5" max="5" reinforcementChance="1" reinforcementTurn="0"></unit>
9. <unit unitid="Sd Kfz 231" unitname="1/1-1 Aufkl" exp="Veteran" number="3" max="3" reinforcementChance="1" reinforcementTurn="0"></unit>
</core>
</coreunits>


RE: Random Battle and Campaign Generator Mod

Posted: Mon Jun 06, 2011 3:40 pm
by Erik Rutins
Outstanding! I will give this a try today but I see some exceptional improvements based on the readme. The ability to easily modify core units for campaigns should be very, very popular.

Regards,

- Erik

RE: Random Battle and Campaign Generator Mod

Posted: Mon Jun 06, 2011 6:14 pm
by Erik Rutins
Really some great improvements here, thank you for posting this!

The map size does seem to be a bit out of sync with the selection though. I clicked on "Template" to see the description with the map size and cycled through a few maps and the size didn't always correspond to the selected map and was reported differently for the same map a couple of times, once correctly and once incorrectly. I was using the drop down menu to select different maps and occasionally clicking on and off "Template" to switch back to the view of the terrain map.

Regards,

- Erik

RE: Random Battle and Campaign Generator Mod

Posted: Mon Jun 06, 2011 7:13 pm
by junk2drive
Looks good. I found that if I changed from text back to map, the size and text appeared correctly for the next selected map (RBG).

(RCG) I'll give it a better look tonight.

RE: Random Battle and Campaign Generator Mod

Posted: Mon Jun 06, 2011 7:20 pm
by dazoline II
The map size is flaky, I've never used Javascript to get image size from a seperate image before so I don't know about the reliability of the code. The HMTL aspect of the HTA app lends its own flake to the reliability as well.
&nbsp;
I think I'll put a wish item in to include the size of a map in the XML. That way the generator doesn't have to rely on judging an image size, it just reads it from the XML.

RE: Random Battle and Campaign Generator Mod

Posted: Tue Jun 07, 2011 1:25 am
by junk2drive
I had a chance to look at the programs and readme. Nice job on all.

Still consuming the RBG core unit files. My brain is slow. I think you are saying I won't have to do like in the other thread and add units to all the xmls and rename the files to match.

RE: Random Battle and Campaign Generator Mod

Posted: Tue Jun 07, 2011 11:07 am
by dazoline II
ORIGINAL: junk2drive

I had a chance to look at the programs and readme. Nice job on all.

Still consuming the RBG core unit files. My brain is slow. I think you are saying I won't have to do like in the other thread and add units to all the xmls and rename the files to match.

The biggest part of this mod is to only edit the core files in one file and have that one edit be in all generated scenarios for the campaign.

I've edited my initial post to clarify how to work with the new modded XML and uploaded a new version with the revised readme and a small fix for the RCG.


RE: Random Battle and Campaign Generator Mod

Posted: Tue Jun 07, 2011 11:39 am
by junk2drive
Thanks for the improvements and explanations. Things are getting better all the time.

RE: Random Battle and Campaign Generator Mod

Posted: Tue Jun 07, 2011 10:56 pm
by HintJ
So this will make it so if I want to do a random campaign w/custom units, I don't have to edit every single .xml for each game?

How do I use it?

Sounds like a great idea, but can somebody please post a .zip of the original contents of the Data->Random Campaigns folder? Stupidly I copied over them and I don't think I was supposed to do that.

RE: Random Battle and Campaign Generator Mod

Posted: Tue Jun 07, 2011 11:08 pm
by junk2drive
HintJ the instructions are in the readme and the first post. Ask away if it is still not clear.

dazoline, the folder is named Current which caused confusion when looking in JSGME for the folder. There is also a text, General Unit Manager which I am not sure if it is notes to yourself or something the mod needs or what?

RE: Random Battle and Campaign Generator Mod

Posted: Tue Jun 07, 2011 11:13 pm
by junk2drive
You really should be using JSGME

Here is the random campaigns folder.

RE: Random Battle and Campaign Generator Mod

Posted: Tue Jun 07, 2011 11:41 pm
by HintJ
thanks.

If I understand correctly, after installing I edit the provided .xml files to have the custom units and upgrades I want for a campaign, then run the Random Campaign Generator, and thats it?

RE: Random Battle and Campaign Generator Mod

Posted: Tue Jun 07, 2011 11:55 pm
by junk2drive
That is how I understand it. If you view the other thread where I added some infantry and halftracks, I had to add it to all the files and change all the file names in order to keep the originals. Of course I could have made copies of the originals and made a JSGME mod.

The main thing is that your added units must have unique names. They don't have to be the number scheme like 1/1/1-1 but you can't copy and paste without changing the unitname after.

RE: Random Battle and Campaign Generator Mod

Posted: Wed Jun 08, 2011 12:06 am
by dazoline II
ORIGINAL: junk2drive

HintJ the instructions are in the readme and the first post. Ask away if it is still not clear.

dazoline, the folder is named Current which caused confusion when looking in JSGME for the folder. There is also a text, General Unit Manager which I am not sure if it is notes to yourself or something the mod needs or what?

My bad, I re did the zip file removing the extra text file and making the folder name consistent with the Mod name.

RE: Random Battle and Campaign Generator Mod

Posted: Wed Jun 08, 2011 12:08 am
by HintJ
ORIGINAL: junk2drive

That is how I understand it. If you view the other thread where I added some infantry and halftracks, I had to add it to all the files and change all the file names in order to keep the originals. Of course I could have made copies of the originals and made a JSGME mod.

The main thing is that your added units must have unique names. They don't have to be the number scheme like 1/1/1-1 but you can't copy and paste without changing the unitname after.
Just tested it out and it seems to work. It is great that dazoline II did this because it was badly needed. Requiring units w/unique names is no problem. In fact, the first thing I wanted to do is replace the 1/1/1/1 concept w/common names.

RE: Random Battle and Campaign Generator Mod

Posted: Wed Jun 08, 2011 12:16 am
by junk2drive
Yeah the first thing to do would be to put together the force the way you want it and then go in and change the names.

I foresee in the future an OOB list, for say a company of motorised troops with 3 platoons of troops and 3 platoons of halftracks, another company of 5 tanks, etc, where you just click and go.

RE: Random Battle and Campaign Generator Mod

Posted: Wed Jun 08, 2011 1:11 am
by HintJ
Hey this makes it real easy to experiment w/single units in platoons in the campaigns:


Image

RE: Random Battle and Campaign Generator Mod

Posted: Wed Jun 08, 2011 1:20 am
by dazoline II
ORIGINAL: junk2drive
I foresee in the future an OOB list, for say a company of motorised troops with 3 platoons of troops and 3 platoons of halftracks, another company of 5 tanks, etc, where you just click and go.

Its in my wishlist, but I think the presets (I see it as a simple version of oob) would have to change to represent that organizational structure. Or we see some type of organizational XML evolve.


RE: Random Battle and Campaign Generator Mod

Posted: Wed Jun 08, 2011 2:18 am
by junk2drive
Maybe someone with a library of OOBs will chime in.

Since I don't, I'd be guessing. Or borrowing from other games. For example we have a 1st Panzer Division 1941 short. Thinking battalion size. We would make the (First) xml everything that a 1st PZ Div battalion would have available instead of the current short list. Then in the purchase screen, you would only get so many points to spend to start a force for the first battle. As the battle progresses, you would purchase replacements from the original, unpurchased, pool. Reinforcements would come from that pool as well.

RE: Random Battle and Campaign Generator Mod

Posted: Wed Jun 08, 2011 10:28 am
by dazoline II
I was thinking a bit different for picking the units.
Not along the lines of an organic battalion but using the concept of a task force, cobbled together from a divisions different organic units.
A pinch of motorized troops, a dash of recon and a whole bucket full of tanks from a panzer division. Of course your task force could be an organic battalion as well if you pick it that way. we could possibly use different organic divisions as source OOB.

This task force would then be available as a seperate XML file where the player could attach it to any random battle or campaign they wanted. A bit different from what we have right now. either modded or unmodded.

The second part of your idea where you get replacements, do you mean in the battle itself or after a battle?
After a battle I think what we would need is a save export utility to XML. Such as Save As XML when saving a game in game and only for single player games. With that XML we could then take the battle to a more operational state where we could do dynamic replacements and so on. I'm thinking of that one unrealized idea in/of CM 1 Combat Mission Campaigns. Which was only torpedoed by not being able to read the save game file at the end of a battle. Of course that is a long while away.