﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,phab_field
6734,Update cmpgraph.pl and entgraph.pl,Langbart,,"The [source:/ps/trunk/source/tools/cmpgraph/cmpgraph.pl cmpgraph.pl] was added with [8857] to generate a function call dependency graph as a quick visual overview between simulation components.


The [source:/ps/trunk/source/tools/entgraph/entgraph.pl entgraph.pl] was added with [2091] as an entity XML inheritance graph generator.

Outdated images can still be seen on `Philip Taylor's` website:
- [http://zaynar.co.uk/0ad-pub/components.png components.png]
[[Image(cut_cmpgraph.png, 500px, center, border=4, link=http://zaynar.co.uk/0ad-pub/components.png)]]
- [http://zaynar.co.uk/0ad-pub/entities.svg entities.svg]
[[Image(cut_entgraph.png, 500px, center, border=4, link=http://zaynar.co.uk/0ad-pub/entities.svg)]]

- update the scripts, converting to `python` is preferred
- since the graph calls will be very complex, the outcome shall be an interactive `.html` file to then be included in  [https://docs.wildfiregames.com/ docs.wildfiregames.com] therefore it is regularly examined on its functionality

==== related projects for visualization function calls
===== hyiltiz - templatesanalyzer

as part of updating [source:/ps/trunk/source/tools/templatesanalyzer/unitTables.py templatesanalyzer/unitTables.py] with [26403], `hyiltiz` gave instructions for creating an interactive `.html` file in the [source:/ps/trunk/source/tools/templatesanalyzer/Readme.md templatesanalyzer/Readme.md]

{{{#!md lineno=55 marks=62,63
### 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
}}}

[[Image(temp_calls.png, 600px, center)]]


===== trompetin17 - UnitAI FSM Graph
- project to visualize `UnitAI` calls
- Source: https://pastebin.com/JG26P2n4
 - `esprima` would need to be  replaced with `espree` as JavaScript parser
  - `esprima` had only full support for ECMAScript 2019
  - the `UnitAI.js` uses `Optional chaining ""?.""` (ECMA 2020 feature)
  - the lines with `.match(...)` need to be protected against `undefined`
- Codepen: https://codepen.io/anon/pen/NZyzbb
 - add this to the `html` part
{{{#!xml
<script src=""http://d3js.org/d3.v4.min.js""></script>
}}}
- related IRC conversations between `trompetin17, Stan, wraitii, Vladislav, elexis`
 - [https://irclogs.wildfiregames.com/%230ad-dev/2019-06-29-QuakeNet-%230ad-dev.log 29/Jun/19], [https://irclogs.wildfiregames.com/%230ad-dev/2019-06-30-QuakeNet-%230ad-dev.log 30/Jun/19], [https://irclogs.wildfiregames.com/%230ad-dev/2019-06-30-QuakeNet-%230ad-dev.log 01/Jul/19], [https://irclogs.wildfiregames.com/%230ad-dev/2019-07-02-QuakeNet-%230ad-dev.log 2/Jul/19]
{{{#!irc
# 30/Jun/19
08:16 < Stan`> Can you make a graph out of it ?
08:16 < trompetin17> thats the idea :D
08:16 < trompetin17> Im just extracting the information
08:16 < trompetin17> and then
08:16 < trompetin17> use TextUml for Graph for example
08:17 < trompetin17> or 3djs with Hierarchy
# 07/Jul/19
12:51 < wraitii> what's green vs orange?
12:52 < trompetin17> the number of call
12:52 < trompetin17> if the line stroke is bigger
12:52 < trompetin17> means more ""setNextState""
}}}

[[Image(unitai_fsm.png, 600px, center)]]
",enhancement,new,If Time Permits,Backlog,Build & Packages,,,,
