PDA

View Full Version : [Tool] EDU-matic: Automatic unit balance/EDU generation system



Aradan
11-23-2009, 21:06
https://img22.imageshack.us/img22/4319/edumatic.png


General Info
Tool Name: EDU-matic
Latest Version: 1.3.1 (Basic & Advanced) - 25/10/2010
Brief Description: Automatic EDU balancer/generator for RTW/M2TW (and expansions)
Dev Platform: MS Excel 2003 VBA (should be compatible with all versions of Windows 98+/Excel)
Developer: Aradan
Download Links: Mirror 1 (http://www.twcenter.net/forums/downloads.php?do=file&id=2678)

-------------------------------------------------------------------------------------------------

Information (copied from tool documentation)
Welcome to EDU-matic. It is a tool that automatically generates a balanced export_descr_unit file for RTW or M2TW and their expansions) mod based on a fairly limited amount of customisable variables and attributes. The basic principles upon which EDU-matic is built are the following:

The central element of a unit is the soldier. This generic, unarmed and unarmoured soldier has certain stats. A number of global variables/rules are also defined, that form the basic structure of the balance system.

Then, the basic elements are defined. Unit classes, categories, weapons, projectiles, armours, shields, engines, mounts and so on. Each one of those elements is set to affect various unit-stats, called "attributes" (eg a melee weapon might affect attack, charge, defence, cost). These core elements can have multiple values as options (eg melee weapon might be dagger, shortsword, or longsword), and each one of these options might have a different value for the element's attributes. All these elements, attributes and values are collectively called the "core data".

Example: "Shortsword, Attack 4, Charge 2, Defence 1, Cost 20", is a definition for the "Shortsword" option of the "Melee weapon" core data element.
A unit is essentially the sum of a combination of all the aforementioned core data options. Which means, in order to describe a unit, you need to provide its name, its quality class, its weapon, its armour type, its shield type, its mount and generally choose for it a value for each available core data element. That combination of those core data element values is called a "unit definition".

Example: "My Unit, low quality, shortsword, small wooden shield, steel cap, padded leather vest, leather boots, unarmoured horse.", is a unit definition for the unit "My Unit".
In order to calculate a unit's stats, the tool reads its definition, breaks it down into its various elements, finds the relevant core data each element is associated with, and feeds all that into a function.

Therefore, what a user mainly needs to do is provide EDU-matic with the core data elements and then define which of those describe each unit. Getting unit stats from those becomes then a rather simple process. The EDU generation can be broken down in 7 steps: 1. Defining core data, 2. Defining units, 3. Checking for errors, 4. Generating data, 5. Manually Editing data (optional), 6. Formatting data, 7. Generating EDU
Below follows a description of each step.


1. Defining Core Data

This is done in the CoreData sheet. Everything, from recruitment classes and unit specialties to weapon and mount stats, is defined here. What you need to do is fill the cells with your values. They have certain restrictions imposed on them, regarding the type of contents they can take, on which you can find info by reading each cell's comments or any error messages you get while assigning their values. You can also find explanations on what each variable/attribute does in the relevant cell's comment.

At the the top of the sheet there are the global variables. These are the most basic variables and it is absolutely necessary you define them (you will get an appropriate message in the error-log if you don't). You will notice that some entries have been grayed out. It means they are currently not used in any formulas, so changing their values will not have any effect; you can leave those undefined if you want.

Below the global variables are the data that concern unit classes, categories, weapons, projectiles, quality levels, armours, shields, materials, mounts, engines, ships, skeletons and so on. Each of these elements, which can take a number of different values (eg "unit quality class can be: "low", "medium" or "high"), has several attributes (eg unit quality class has: "name", "cost modifier" and "morale bonus"). For each different value of an element (alternatively called "ranges") the values of the attributes may vary as well, so that the cost modifier for high quality class is different to that of the low quality one etc.

It is possible - in fact it is one of the main purposes of the tool - for the user to create new options for a range (eg add a new quality class, "elite"). As with pre-existing ones, the attributes of the new options will have to be properly defined, and values assigned to them. The tool will use default values in case it finds a non-defined/blank attribute cell, but as these default values might not fit your mod well, it would be advised that you play safe and assign your own.

Do note that though the CoreData sheet is already populated with various values and items (mainly from the mods FATW, NI and EB), these are intended to work as a base and as an example for the user. The very idea behind EDU-matic is that all these can be changed and items edited/removed/added in order to suit each user's needs.

2. Defining Units

This is done in the UnitDefinitions sheet. Each row holds the definition for a unit and what you need to do is fill the cells applicable in each unit's case with one of the options available. Certain cells take only data from a predefined list (usually defined in CoreData, but also internally if the values are RTW/M2TW keywords), while others have no restrictions and allow any value (for instance, the 'comments' cell).

Units must be listed one right below the other, without any blank rows, as a blank row will mark the end of the definitions and the tool will not read past that. If you want to mark a unit as "work in progress" and you don't want the tool to parse its definition, simply prefix the unit's name with an exclamation mark ( ! ); if you want to divide your definitions into groups, simply create a blank row and instead of a unit name put a comment (eg the group's name) in the first cell, prefixing it with a number sign ( # ).
Examples of unit definitions have been given in the UnitDefinitions sheet, including a proper unit definition, a WIP unit, a Comment line and a definition with errors (inc. Core Data errors).


3. Checking for Errors

This is also done in the UnitDefinitions sheet. All you need to do is click the "Check Defs" button, after you are done with defining units. The UnitDefinitions -and to some extent the CoreData- sheets will be scanned for potential errors and the results of the scan will be put in the ErrorLog sheet, ordered by unit, with the unit's name and line mentioned, as well as a detailed message about the problem encountered. If no errors are found, then a message will come up, prompting you to proceed with the generation of data. If errors do come up, you will be unable to do so, and you will have to first fix them using the error-log as reference. 'Comment' and 'WIP' lines will be ignored while scanning for errors.


4. Generating Data

This is also done in the UnitDefinitions sheet. All you need to do is click the "Create Data" button. Any previous contents of the DATA sheet will be erased, and it will be populated with stats, which are the results of parsing the unit-definitions, getting the appropriate variable values from each unit attribute, combining them with the core data variables and using all those in certain formulas. Comment' and 'WIP' lines in UnitDefinitions will also be translated into 'comment' and 'wip' lines in DATA, all empty except the first cell, which will contain either the comment or the 'WIP' keyword respectively.

Note that once you generate data, you cannot do it again without first re-checking for errors. This is mainly so that you don't generate, then change some definitions and then try to regenerate immediately, forgetting to run the error check and thus potentially creating an undetected error. It is advised that you never edit unit definitions after checking for errors but before generating data.


5. Manually Editing Data (optional)

This optional step is done in the DATA sheet. After generating the data with the help of core-data and unit-definitions and populating the DATA sheet with them, you can manually edit any entries you want simply by changing the contents of the appropriate cells. Be very careful though, as no error-checks are done past this stage, so any mistakes you make while manually editing data might cause serious problems.


6. Formatting Data

This is done in the Output sheet. All you need to do is click the "IMPORT" button. Any previous contents will be erased, and the Output sheet will be populated with the entries from the DATA sheet, formatted into the appropriate structure that the EDU file requires. 'WIP' lines will be ignored during this process and 'Comment' lines will be translated into comments, framed by extra empty lines above and below them.


7. Generating EDU

This is also done in the Output sheet. All you need to do is give the directory where the EDU file will be exported into, the name of the file (export_descr_unit by default, but can be anything) and then just click the "EXPORT" button. The file will be created (its name suffixed by a timestamp) inside the specified folder, and a link to it will also be provided.

At the top of the file a header will be placed, which can be defined in the Header sheet. There, you may type your header, starting in the top-left cell and using only the first column cells for entries. You can have empty lines, and you will need to start the non-empty ones with semi-colons. To mark the end of the header, just type END in the first cell of the row after the header's last used row.
An example header has been given in the Header sheet.

-------------------------------------------------------------------------------------------------

ThanksTo MasterOfNone/Dol Guldur/Palantir:
For prodding me to work on EDU-matic (and for making sure I got no rest until it was done) and also for the creation of the early version of the macro that exports data from the .xls to a .txt file.

EDU-matic is dedicated to him. For his 5-year long presence as a leading figure in the community; for the time he spent mentoring me and answering my silly questions; for torturing me with his british humour; and for all the great times we had modding together or just chatting.

To JMRC of Europa Barbarorum:
For good feedback

Cute Wolf
11-24-2009, 16:23
Great job aradan, but I have something to ask (maybe I wasn't too familiar with excel-thing)

I made a new unit, and determine that attack,charge ; defense (ar,sk,sh) ; morale (mo,disc,for)... and just want to get that unit's cost how?

Example:

Wild Guy Spearmen
Pri atk: underhand spear 12, charge 4
def: 1,12,4
morale: 10, impetuous, trained

just what variable I must input... thanks... I just want to have their cost

Aradan
11-25-2009, 00:20
The cost is automatically calculated when you click the "Generate Data" button, along with all other stats, have you done that?

Cute Wolf
11-25-2009, 05:04
Dunno... I only get this EDU, without anything inside except:


;Generated by the EDU-matic, created by Aradan for Norman Invasion
;Please visit http://www.twcenter.net/forums/showthread.php?t=111344 for Aradan's Complete EDU Guide
;Free to use as long as this header is kept in place. Thank you.
;EDU for ...


;########
;This is my Header
;########




Yupz... no unit inside :help:

EDIT
Oh, after checking the check defs button, a dialog box said :Data Cannot be generated, unit descriptions has errors......

Aradan
11-25-2009, 12:49
Which means you have to check the ErrorLog sheet, where those errors are detailed, and fix them, before generating data. Let me know if anything weird happens, though I hope everything works as it should.

Cute Wolf
11-26-2009, 17:08
Yupz, something is weird, but no more a problem.

I set the program running to BI, but in the error log, all the errors are the lack of culture :wall:

Yeah, I know it maybe an unintended glitch, but I end up using english cultures on them... :laugh4:
Many thanks...

Aradan
11-26-2009, 22:13
All units must belong to a culture. You can set up a "default" one with all modifiers set to 1 (and all bonuses to 0) and use that, if you like.

Aradan
01-16-2010, 12:56
EDU-matic has been updated to version 1.3.

List of changes:

1. Fixed an error in the armour upgrade cost formula
2. Tweaked recruitment, armour upgrade and custom battle cost formulas.
3. Added an ammo modifier attribute to projectiles
4. Training now tied to unit formation
5. Impetuous ability (previously lacking) added as an yes/no option in UnitDefinitions
6. Frighten_foot/mount attribute added to weapons




EDU-matic Advanced:

An alternative version of the tool, called "EDU-matic Advanced" has also been developed. It's main difference to "Basic" is that it has a new ArmourDefinitions sheet where the user may separately define armour sets and upgrades as well as multiple model variations for every one of those (which include armour and shield, and their frequency in the model can also be specified), and the tool then makes all necessary calculations of average armour and shield values, mass, armour upgrade levels, costs, hit sounds and any other relevant attributes for those, plus it automatically assigns armour upgrade levels in case max number is not reached and difference between intended armour levels is >=5 (in order to 'circumvent' the hardcoded +7/3 bonus per upgrade). The Advanced version is intended for M2TW/KGDM, but it can of course work with RTW as well, where model upgrades are not allowed and model variations after the first are ignored.

An excerpt from the tool documentation for the Advanced version:


3. Defining Armour Models

This is done in the ArmourDefinitions sheet. Each row contains the data for an armour model: the type of armour for each bodypart, the armour material, the shield type and the shield material. Things are simple in RTW since each unit only has 1 model and there are no visual model upgrades. However M2TW allows multiple variations per model (we will call these variations collectively a 'model-set'), and each armour upgrade changes the model-set as well.

It's possible to group multiple model definitions together into a model-set, by defining multiple models one right below the other, putting the model-set's name in the first column cell of the first model and leaving the respective cells of the other ones blank. The 'Instances' cell holds the number of times each model/variation appears in a unit's model-set. Armour upgrades can have their own separate model-sets, which can be defined in the same way anywhere on the sheet. When defining model-sets make sure you have named only the first variation of your model-set (you will need to name it when you have just 1 variation as well) and that you have not forgotten to name any sets, as the tool will group all models between two named variations in a single model-set.The sum of this is that a unit can now have 20% fully armoured guys with tower shields, 30% naked guys with no shields, 35% guys with leather armour and bucklers and 15% guys with some metal, some leather, some bronze, some scale and some steel parts with medium shields, all the same time (thanks to m2's ability for mutliple models per unit) and the unit stats will accurately reflect the average of all those people.
Plus, armour upgrades now don't necessarily mean that your unit's torso armour got a boost, but maybe just that the percentage of armoured men in the unit increased (and the one of unarmoured ones decreased) and therefore your unit is on average better equipped. This is all taken care of by the tool.





Both versions are included in the download.

As always, feedback is welcome.


-----

EDIT: Minor update to version 1.3.1, "unit info" line now activates only for M2TW and not Kingdoms.