Package: coggle-ecs
CoggleECSCoggleECS is a small tool used to parse.mmfiles created atcoggle.itfor ECS data. It can then output ECS data as a tree or table. It can also be used to simply show links in your map.For instance, Coggle creates links between nodes using a markdown format:Player [#](#5d3adc) [#](#78959d). CoggleECS will replace those links with their respective nodes:Player <Move,  Transform>.InstallationUsing pipRun the following line in the terminal:pip install coggle-ecsUsing setup.pyClone or download this repository and run the following line from the project's root directory:python setup.py installUsing Ctl+CCopy and paste if you're daring enough.Setup & Usage1. In CoggleOutputting as tree data can work for any type of Coggle map (in fact you can just export the map itself as a text tree from Coggle if you don't care about replacing links).However, outputting as a table requires a few things:Thereneedsto be nodes named each of the following (not case-sensitive):'Entitities' or 'Entity' or 'E''Components' or 'Component' or 'C''Systems' or 'System' or 'S'Entities should linktotheir respective Components.Systems should linktotheir respective Components.Without the three nodes, the table will not render. And if those nodes exist but there are no links (or improper ones) then table will be be unfilled.2. In CoggleECSOnce the above steps have been completed and your map has been filled, download it as a.mm. Then follow a similar program to below:fromcoggle_ecsimportCoggleECSmy_map=CoggleECS('path/to/your/map.mm')my_map.parse()You're all set to usemy_map(or whatever you named it) to export in whatever format you prefer!ExamplesInput<mapversion="0.9.0"><nodeTEXT="Game Engine"FOLDED="false"POSITION="right"ID="5e0568ca68fbc74e9bb7c666"X_COGGLE_POSX="0"X_COGGLE_POSY="0"><edgeCOLOR="#b4b4b4"/><fontNAME="Helvetica"SIZE="17"/><nodeTEXT="Entities"FOLDED="false"POSITION="right"ID="c2876d86e931f9deab2da00f"><edgeCOLOR="#ebd95f"/><fontNAME="Helvetica"SIZE="15"/><nodeTEXT="Player [#](#5d3adc) [#](#78959d)"FOLDED="false"POSITION="right"ID="2fbd2a01b1c71bd12bcbcb6b"><edgeCOLOR="#ecd966"/><fontNAME="Helvetica"SIZE="13"/><nodeTEXT="This is some description."FOLDED="false"POSITION="right"ID="b5b0332157c9287b3640d066"><edgeCOLOR="#ecd870"/><fontNAME="Helvetica"SIZE="13"/></node></node><nodeTEXT="Alien [#](#78959d) [#](#feee8a)"FOLDED="false"POSITION="right"ID="22db55a2c98a51c71bca1791"><edgeCOLOR="#ead86c"/><fontNAME="Helvetica"SIZE="13"/></node></node><nodeTEXT="Components"FOLDED="false"POSITION="right"ID="abed60d3595a05321d843d5c"><edgeCOLOR="#efa670"/><fontNAME="Helvetica"SIZE="15"/><nodeTEXT="Hostile"FOLDED="false"POSITION="right"ID="feee8a5d3ea26d514852b5db"><edgeCOLOR="#eea26d"/><fontNAME="Helvetica"SIZE="13"/></node><nodeTEXT="Transform"FOLDED="false"POSITION="right"ID="78959d52cbc1843fb429b409"><edgeCOLOR="#ee9d65"/><fontNAME="Helvetica"SIZE="13"/></node><nodeTEXT="Move"FOLDED="false"POSITION="right"ID="5d3adc4deef6b0da6ebcc899"><edgeCOLOR="#f09e65"/><fontNAME="Helvetica"SIZE="13"/></node></node><nodeTEXT="Systems"FOLDED="false"POSITION="right"ID="36c5720bc10e612f2a18cad1"><edgeCOLOR="#e68782"/><fontNAME="Helvetica"SIZE="15"/><nodeTEXT="Movement System [#](#5d3adc) [#](#78959d)"FOLDED="false"POSITION="right"ID="22e2424c6291b42cd61178e7"><edgeCOLOR="#e37e7b"/><fontNAME="Helvetica"SIZE="13"/></node><nodeTEXT="Enemy System [#](#feee8a)"FOLDED="false"POSITION="right"ID="0ed47a23e497face721424d9"><edgeCOLOR="#e78682"/><fontNAME="Helvetica"SIZE="13"/></node></node><nodeTEXT="Art"FOLDED="false"POSITION="left"ID="14bf08663116d2383d6c20f3"><edgeCOLOR="#e096e9"/><fontNAME="Helvetica"SIZE="15"/></node></node></map>OutputGame Engine
    Entities
        Player <Move,  Transform>
            This is some description.
        Alien <Transform,  Hostile>
    Components
        Hostile
        Transform
        Move
    Systems
        Movement System <Move,  Transform>
        Enemy System <Hostile>
    ArtHostile Transform Move
Type   Name                                  
Entity Player                          X    X
       Alien                 X         X     
System Movement System                 X    X
       Enemy System          XOutput Functionsoutput_text(self,outfile,delim=' ',indent=4,include_id=False)Output the map as a tree into a text file.​outfile: The output file​delim: Prepends node (Used to denote the level)​indent: Number of delims to print​include_id: Include the node's id at the endoutput_structure(self,outfile,indent=3,down='|',level='+',dash='-',space=' ')Output the map as a tree (in a folder structure format) into a text file.​outfile: The output file
​indent: The number to indent each level
​down: The character denoting a change in level
​level: The character denoting a new parent
​dash: The character bridging between the level and the node
​space: The empty space between down charactersoutput_table(self,outfile,use_ticks=True,true_tick='X',false_tick='')Output the map as a table into a text file.​outfile: The output file
​use_ticks: Replace True and False with given strings
​true_tick: Tick to replace True
​false_tick: Tick to replace Falseoutput_csv(self,outfile,sep=',')Output the map as a table into a CSV file.​outfile: The output file​sep: The CSV separatoroutput_json(self,outfile,orient='split')Output the map as a table into a JSON file.​outfile: The output file​orient: The format for the JSON (used internally by a pandas DataFrame)Other FunctionalityYou can also tap into yourCoggleECSinstance to get other data. Some examples:fromcoggle_ecsimportCoggleECSmy_map=CoggleECS('path/to/your/map.mm')my_map.parse()# Find a node by the beginning of its ID (returns first occurence)node=my_map.find_by_id('1a2b3c')# Get all the Entities, Components, or Systemsentities=my_map.get_entities()components=my_map.get_components()systems=my_map.get_systems()# Get the ECS pandas DataFramemy_map.create_table(include_systems=True)df=my_map.tableDependenciesThis tool runs on Python 3 or later.It also requires Pandas (the library, not the bear).