JSON (JavaScript Object Notation) is a text-based human-readable format for data. It is designed to be minimalist, compact and language independent, but the syntax matches JavaScript (also similar to C). JSON is very convenient for parsing in the game's scripts using SpiderMonkey's builtin JSON.parse(). The game uses JSON (.json) files for storing raw data, when the overhead of a script is not required. Currently they are used for:

  • Civilization data (civs\)
  • Random map definitions (maps\random\)
  • AI definitions (simulation\ai\)
  • Assorted data shared by game setup and Atlas (simulation\data\)

One limitation of JSON compared to standard JavaScript is that C/C++-style comments like // are not allowed. If you need to document something in JSON data, the only practical way of doing this is to use a property string like:

 "XXCOMMENTXX": "This is a comment about something in the JSON data, not quite as nice as a // comment is it?"

For more information, see http://json.org/.

Last modified 12 years ago Last modified on Feb 28, 2012, 2:54:26 AM
Note: See TracWiki for help on using the wiki.