[AI debug] Dump AI information to file.

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

[AI debug] Dump AI information to file.

#1 Post by Cjkjvfnby »

I am working on new debug feature: dump AI progress to file. https://github.com/Cjkjvfnby/freeorion/pull/11

It is replace of charting.

Feature consists of two parts: dumper and reader.
  • dumper
    • dump progress to folder with unique game name (name stored in AIState)
    • dump information about turns tree to files. Loading game create new branch in turns tree, so no information will be lost. Turn information splited by sections, each section is file. Each line of file contains json string with turn info. Here is example from 2_95186f69_Realm\fleets:

      Code: Select all

      [{"turn": 8, "parent_uid": "95187e57", "turn_uid": "95188010", "headers": ["id", "fid", "name", "sid", "owner", "visibility", "ships", "target"]}, [{"name": "Scout Fleet", "ships": [358], "visibility": "full", "fid": 357, "sid": 86, "owner": 2, "id": 357, "target": ["explore", 59, "system", ""]}, {"name": "Battle Fleet", "ships": [362], "visibility": "full", "fid": 361, "sid": -1, "owner": 2, "id": 361, "target": ["military", 86, "system", "Wiily \u03b2"]}, {"name": "Fleet 407", "ships": [406], "visibility": "none", "fid": 407, "sid": 33, "owner": -1, "id": 407}, {"name": "Fleet 412", "ships": [410], "visibility": "full", "fid": 412, "sid": 32, "owner": 2, "id": 412, "target": ["explore", 132, "system", ""]}, {"name": "Fleet  413", "ships": [411], "visibility": "full", "fid": 413, "sid": 212, "owner": 2, "id": 413, "target": ["explore", 212, "system", "Troy"]}, {"name": "Fleet 416", "ships": [415], "visibility": "full", "fid": 416, "sid": 6, "owner": 2, "id": 416, "target": ["explore", 6, "system", "Hera \u03b3"]}, {"name": "Fleet 418", "ships": [417], "visibility": "full", "fid": 418, "sid": 45, "owner": 2, "id": 418, "target": ["orbitalDefense", 45, "system", "Wiily \u03b4"]}, {"name": "Fleet 420", "ships": [419], "visibility": "full", "fid": 420, "sid": 45, "owner": 2, "id": 420}]]
      
  • viewer
    I use local Django server to view result in browser. You can see attached image example: https://github.com/Cjkjvfnby/freeorion/pull/11

    Making GUI via web is most easiest way. I chose Django because it is awesome and I have a lot experience with it.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: [AI debug] Dump AI information to file.

#2 Post by Dilvish »

That looks quite handy-- I've been getting the sequence of techs researched by using grep on the log files, but this is a bit better. Could you pls do a little writeup on the viewer? Is this generating some php code or whatnot that you need the local web server for?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: [AI debug] Dump AI information to file.

#3 Post by Cjkjvfnby »

Dilvish wrote:That looks quite handy-- I've been getting the sequence of techs researched by using grep on the log files, but this is a bit better. Could you pls do a little writeup on the viewer? Is this generating some php code or whatnot that you need the local web server for?
It is my current version as is. See README for instructions.
https://github.com/Cjkjvfnby/freeorion- ... ump_reader

No php only python https://www.djangoproject.com/
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Cjkjvfnby
AI Contributor
Posts: 539
Joined: Tue Jun 24, 2014 9:55 pm

Re: [AI debug] Dump AI information to file.

#4 Post by Cjkjvfnby »

Update dumper:
- store less service information
- add dump of systems

Update reader:
- inner changes
- add info about systems (based on https://github.com/Morlic-fo/freeorion/pull/2) I don't like how it looks, will search other way to visualize it.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

Post Reply