Key-Values File: Difference between revisions

From Equilibrium Engine Wiki
Jump to navigation Jump to search
(Created page with "Equilibrium Engine has it's own data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other serializable values). Those files used in many of the engine files, such as '''Material Files''', '''Vehicle Configuration Files''', '''Various Object Definition Files''', '''egfCa and animCa scripts.''' The data structure maybe seem similar to '''JSON''' but it's been simplified and extende...")
 
No edit summary
 
Line 5: Line 5:


The data structure maybe seem similar to '''JSON''' but it's been simplified and extended with useful features.
The data structure maybe seem similar to '''JSON''' but it's been simplified and extended with useful features.
As seen in example below, keys can both can have and not have values, have nested keys inside and unlike ''JSON'', keys are not unique.


Example:<syntaxhighlight lang="cpp" line="1">
Example:<syntaxhighlight lang="cpp" line="1">
Line 14: Line 11:
{
{
     // key and value
     // key and value
model "models/cityobjs/slamp1.egf";
model "models/cityobjs/slamp1.egf"; smashsound "metal.streetlamp";
smashsound "metal.streetlamp";


breakForce /* inline comment that does not break the flow of data */ 5;
breakForce /* inline comment that does not break the flow of data */ 5;
Line 40: Line 36:
}
}
}
}
</syntaxhighlight>
</syntaxhighlight>As seen in example:
 
# Keys can both can have and not have values, have nested keys inside.
# Unlike ''JSON'', keys are not unique.
# Multiple values are separated with spaces, no need for brackets and commas.
# Semicolon is used to separate key-value entries.
# Each section begins with '''{''' and ends with '''}''' brackets.

Latest revision as of 18:21, 31 January 2023

Equilibrium Engine has it's own data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other serializable values).

Those files used in many of the engine files, such as Material Files, Vehicle Configuration Files, Various Object Definition Files, egfCa and animCa scripts.


The data structure maybe seem similar to JSON but it's been simplified and extended with useful features.

Example:

// key and value with section
physics "slamp1"
{
    // key and value
	model 		"models/cityobjs/slamp1.egf"; smashsound	"metal.streetlamp";

	breakForce	/* inline comment that does not break the flow of data */ 5;

    // keys without value but with nested content
	breakable
	{
		minforce 12.0;
		
		parts
		{
			part "part1"
			{
				physics lamp_part1;
				offset 0 -1.4 0;    // multiple values (array)
			}

			part "part2"
			{
				physics lamp_part2;
				offset 0 -0.1 0;
			}
		}
	}
}

As seen in example:

  1. Keys can both can have and not have values, have nested keys inside.
  2. Unlike JSON, keys are not unique.
  3. Multiple values are separated with spaces, no need for brackets and commas.
  4. Semicolon is used to separate key-value entries.
  5. Each section begins with { and ends with } brackets.