forked from mirrors/0ad
6496aea364
- Add support for mul_round - Correct table - BUGFIX: correct roster table via the mixin Civ fix - avoid long lines for PEP8 compliance - for mod development outside .svn repo, create symlink - replace all TAB indents to 4 spaces for PEP8 - TAB to 4 spaces to be PEP8 compliant - refactor complex inline logic to compute and formatting - beautify and avoid long lines to be PEP8 compliant - beautify and simplify JS table format code - Using more accessible color scheme - Better color scheme - main analysis file - Rename the new version back to keep consistancy - dependency JS library - Unit analysis result - Rewrite specilized table logic to only show changed - Prefer numeric flag over string flag to refactor - Re-format HTML templates into readable source code - Civ specific table now renders non-empty - Update computeCivTemplate to parse A25 template dir - Cleanup debugging flags - Update copyright notice to 2022 - Explain how the code works for future development - Initial README - Refactor: put HTML IO code in a single function - Refactor: include JavaScript as verbatim str - Refactor: separate computation from IO - Refactor: compute templates before HTML IO - Refactor: compute CivTemplates before HTML IO - Refactor: compute separate from IO code - Fixed melee and ranged attack damage parsing - Fixed Resistance parsing - Implement the undefined function complain - Rename Armour -> Resistance - Simplify NumericStatProcess logic Patch by: @hyiltiz Differential Revision: https://code.wildfiregames.com/D4445 This was SVN commit r26403.
70 lines
2.9 KiB
Markdown
70 lines
2.9 KiB
Markdown
## Template Analyzer
|
|
|
|
This python tool has been written by wraitii and updated to 0ad A25 by hyiltiz.
|
|
Its purpose is to help with unit and civ balancing by allowing quick comparison
|
|
between important template data.
|
|
|
|
Run it using `python unitTables.py` or `pypy unitTables.py` (if you have pypy
|
|
installed). The output will be located in an HTML file called
|
|
`unit_summary_table.html` in this folder.
|
|
|
|
The script generates 3 informative tables:
|
|
- A comparison table of generic templates;
|
|
- A comparison table of civilization units (it shows the differences with the
|
|
generic templates);
|
|
- A comparison of civilization rosters.
|
|
|
|
You can customize the script by changing the units to include (loading all units
|
|
might make it slightly unreadable). To change this, change the
|
|
`LoadTemplatesIfParent` variable. You can also consider only some civilizations.
|
|
You may also filter some templates based on their name, if you want to remove
|
|
specific templates. By default it loads all citizen soldiers and all champions,
|
|
and ignores non-interesting units for the comparison/efficienicy table (2nd
|
|
table).
|
|
|
|
The HTML page comes with a JavaScript extension that allows to filter and sort
|
|
in-place, to help with comparisons. You can disable this by disabling javascript
|
|
or by changing the `AddSortingOverlay` parameter in the script. This JS
|
|
extension, called TableFilter, is released under the MIT license. The version
|
|
used can be found at https://github.com/koalyptus/TableFilter/
|
|
|
|
All contents of this folder are under the MIT License.
|
|
|
|
|
|
## Contributing
|
|
|
|
The script intentionally only relies on Python 3 Standard Library to avoid
|
|
installing 3rd party libraries as dependencies. However, you might want to
|
|
install a few packages to make hacking around easier.
|
|
|
|
### Debugging
|
|
IPython can be used as a good REPL and to easily insert a debug break point.
|
|
Install it with:
|
|
|
|
pip3 install ipython
|
|
|
|
then to insert a break point, simply insert the following line to the script where
|
|
you want execution to pause:
|
|
|
|
import IPython; IPython.embed()
|
|
|
|
Then, run the script as normal. Once you hit the breakpoint, you can use IPython
|
|
as a normal REPL. A useful IPython magic is `whos`, which shows all local
|
|
variables.
|
|
|
|
### Exploration
|
|
To understand the internal logic, generating a function call dependency graph
|
|
can be helpful by providing a quick visual overview. Use the following code to
|
|
create the function call dependency graph. It is dynamic, and allows quickly
|
|
getting familiarized with the analyzer. Note that you'll need `dot` engine provided
|
|
by the `graphviz` package. You can install `graphviz` using your system's package manager.
|
|
|
|
pip3 install pyan3==1.1.1
|
|
python3 -m pyan unitTables.py --uses --no-defines --colored --grouped --annotated --html > fundeps.html
|
|
|
|
Alternatively, only create the `.dot` file using the following line, and render it with an online renderer like http://viz-js.com/
|
|
|
|
python3 -m pyan unitTables.py --uses --no-defines --colored --grouped --annotated --dot > fundeps.dot
|
|
|
|
Enjoy!
|