Formatting AI jsons breaks the AI

Discussion in 'Mod Support' started by Quitch, October 29, 2014.

  1. Quitch

    Quitch Post Master General

    Messages:
    5,850
    Likes Received:
    6,045
    Is this supposed to happen?

    If you pass the AI json files through a human readable formatter such as http://jsonformatter.curiousconcept.com/ and then try to use the formatted version the AI is borked.

    I passed every json file in media\pa\ai through this parser and afterwards the AI will build 2-3 factories, 2 fabbers (which only build MEX thereafter) and then it amasses a Bolo/Bumblebee army in its base which it never uses.

    If I restore the files to their pre-formatted state then everything works.

    Shouldn't they work even with formatting? Certainly makes it very hard to mod them. Is it simply to do with the way that formatting tool works?

    Note that I copy them using the copy button.
  2. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Does changing the client side AI files even affect the server side AI if the server is run by Uber?
  3. Quitch

    Quitch Post Master General

    Messages:
    5,850
    Likes Received:
    6,045
    Herp derp, crying wolf too early. Used the reformat script from this thread and everything works fine. So either I did something wrong, or it's the online reformatter. Either way, not a game bug.
  4. Quitch

    Quitch Post Master General

    Messages:
    5,850
    Likes Received:
    6,045
    Running offline.
  5. emraldis

    emraldis Post Master General

    Messages:
    2,641
    Likes Received:
    1,843
    Maybe that's what's bugging up my AI as well...
  6. emraldis

    emraldis Post Master General

    Messages:
    2,641
    Likes Received:
    1,843
    Nope. Didn't fix mine, tried with AI on absurd difficulty, same problem is still happening.
  7. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Maybe there is just some general bug that randomly happens sometimes and Quitch just had bad luck when he tried to reason why his AI is screwing up?
  8. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    It's important to understand many JSON formatters work by taking the .json file, running it through a JSON interpreter into a different data format, and then printing it back out to JSON. This might seem benign, but depending on the implementation any numbers in the .json file might be altered slightly (1.0 might change to 0.9999997, etc.), and even the order of some things might be changed. Either of those could break something.

    http://jsonlint.com seems to be very good about not altering the array order or the number precision.
    lokiCML, squishypon3, Quitch and 2 others like this.

Share This Page