Analyzing the AI behavior

billw2015

King
Joined
Jun 22, 2015
Messages
837
I have a rough plan to generate structured logging (e.g. json objects rather than just strings) for AI decisions, like what units to build, what buildings etc., and gameplay stats like how many units in play of each type on each side, how many buildings etc., properties for each city etc.
Then I would pipe this into Elasticsearch (a database for logs that can perform complex queries, with a front end for viewing them in a web-browser) so it can be queried and analysed.
Is there anything like this already (maybe someone wrote a mod, or a filebeat/logstash ingest spec or something), or has it been tried?
Is there some other tools for analyzing the AI?
 
I have a rough plan to generate structured logging (e.g. json objects rather than just strings) for AI decisions, like what units to build, what buildings etc., and gameplay stats like how many units in play of each type on each side, how many buildings etc., properties for each city etc.
Then I would pipe this into Elasticsearch (a database for logs that can perform complex queries, with a front end for viewing them in a web-browser) so it can be queried and analysed.
Is there anything like this already (maybe someone wrote a mod, or a filebeat/logstash ingest spec or something), or has it been tried?
Is there some other tools for analyzing the AI?
There are quite a few AI logs but I assume you're already aware of those? I don't use them much - generally I've been watching the code process where I'm trying to figure out what's taking place.
 
There are quite a few AI logs but I assume you're already aware of those? I don't use them much - generally I've been watching the code process where I'm trying to figure out what's taking place.

I've certainly seen the logging in the code. Probably I can piggy back on it to output json or something as well.
What I'm thinking of is something like running the game in autoplay over night (I did this last night in fact), and then analyzing what it did statistically. I noticed a few anomalies in the units the AI had built (50 police units in one city etc.), I don't really see a way to investigate why it would do that very easily. However if I had all the data from the autoplay I could just scrub back through it when the AI started making police units and find out what the corresponding conditions were that may have caused it.
 
I've certainly seen the logging in the code. Probably I can piggy back on it to output json or something as well.
What I'm thinking of is something like running the game in autoplay over night (I did this last night in fact), and then analyzing what it did statistically. I noticed a few anomalies in the units the AI had built (50 police units in one city etc.), I don't really see a way to investigate why it would do that very easily. However if I had all the data from the autoplay I could just scrub back through it when the AI started making police units and find out what the corresponding conditions were that may have caused it.
I have some good suspicions but it's in the specifics of the code and either there are factors I'm overlooking there, some functions that are bugged, or it has something to do with the brokerage system not behaving as intended or expected. It would certainly help to figure out which city is calling for them and why it's going overboard about it.
 
While I do not have a full or maybe even good understanding of the brokerage system, and the idea of specialized cities, if a city is called to build a bunch of a type of unit then that would seem to indicate that there are factors out in that AI empire that these units are needed to be addressing. But if the units do not move to their assignments, or the assignment has changed after the build, then what is the AI going to do? Why did they not move? Was the situation that prompted their "call" now gone?

The infiltration of criminal units by other Empires would be one such trigger. Building one's own Criminal units would also be a trigger. But if the AI Loses the Object for these units to Address, what is the AI capable of doing in that situation? Can it actually address this?

Brings up Lots of what if scenarios and AI decision making processes.
 
But if the units do not move to their assignments, or the assignment has changed after the build, then what is the AI going to do? Why did they not move? Was the situation that prompted their "call" now gone?
This may well be a big part of the problem, something in pathing or some failure to check to ensure that the unit can get to the destination calling for the help, such as needing more naval AI to support transporting the units when needbe. There could be other problems I'm not sure about that are causing this to be the case too.

The infiltration of criminal units by other Empires would be one such trigger. Building one's own Criminal units would also be a trigger. But if the AI Loses the Object for these units to Address, what is the AI capable of doing in that situation? Can it actually address this?
The brokerage should release units that cannot get to the destination they were trained or called to go to so they can move according to their own programmed AI at that point, which for property control units, will then seek where they should be by biggest need, considering as well not only how many are already responding to those needs but the need to keep some basic coverage where they are (assuming they are in a city already.) The brokerage alone, as Alberts2 has suggested they should be dictated by, was not enough. I won't pretend it cannot be bugged or have some oversights in any portions of these segments.
 
C2C has the BBAI logging from the incuded BBAI mod.

However lots of AI functions don't have any logging code and adding such code to the whole AI code would be really helpfull.
 
Top Bottom