These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
12Next page
 

Common Loadout Format (draft specification): feedback wanted!

Author
Indalecia
#1 - 2012-06-12 09:35:11 UTC
Greetings to the EVE community.

I am currently working on a web-based fitter, and together with Pyfa/aurora developers we decided the whole community (including us) could benefit from a loadout format that doesn't suck. Before blowing my own horn, here's a quick rundown of the existing formats, and why they're f*cked up beyond repair:

  1. EVE XML loadout export: it doesn't include typeIDs, so if an expansion changes names of some modules, you're screwed.
  2. ShipDNA: it's nice enough for simple stuff, and integrates nicely with the client, but it supports nowhere enough functionality (like charges, or module state) to be good as a more general format. Also, it's not at all extendable.
  3. EFT format: probably the worst of all. Only typenames and no clear parsing rules. It is ambiguous in many ways (such as: character encoding, line terminations, ordering, etc.), its extendability is very poor and not correctly specified.


So, we came up with a new format: the Common Loadout Format (CLF). There is a draft of the specification available now, and if you're a developer interested in this format, I'd like you to take a couple of minutes, read the draft and share your feedback with us.

Here's the draft of the CLF, version 1: http://artefact2.com/clf/draft-common-loadout-format-01

Here are some questions to help you put your impressions into words:

  • Is the specification clear enough? Did you have to read certain parts multiple times to understand them? Did you find some sentences ambiguous/unclear?
  • Are the provided examples clear and useful enough? (Have they helped you understand the format?)
  • Have you spotted inconsistencies, mistakes, or contradictions inside the spec. that should be corrected?
  • Do you have any ideas of what we might have forgotten to add in the format?


Once the draft is considered good and mature enough, it will be released as the "official" standard for CLF version 1, and reference validator implementations will be made available shortly (in PHP and possibly Python).

Also, keep in mind: this document is a draft, and it is inappropriate to rely on it as it is still a work in progress.

Thanks.

https://o.smium.org/ — v0.13.5 — A browser-based fitting tool and loadout sharing platform

Desmont McCallock
#2 - 2012-06-12 13:31:10 UTC  |  Edited by: Desmont McCallock
The EVEMon Dev Team is approving and supporting this project.

My notes to the project.
- Suggesting to rename 'presets' to 'fittings' thus 'preset' to 'fitting' (makes more sense).
- Make 'presets' REQUIRED (what's the meaning of the format if it doesn't contain a fitting?)
- Make 'presets-modules' REQUIRED for the same reason as above.
- Deprecate the 'charge' key and use only 'charges' (if it only has one charge then the array simply contains only one element).
- Make 'slottype' key REQUIRED in order to know in advance the slot and not have to code a lookup.
- Key 'chargepresets' isn't clear of it purpose. I guess it refers to proposed charges to be uses with the module (in addition to the one already loaded on the module). In that case 'name' should be made OPTIONAL and add a REQUIRED 'typeid' key (we don't want to rely on names, the purpose of this format is to avoid parsing issues with names). How about renaming that key to 'altcharges' or 'cargobay'?
- If 'drone' key is used then 'inbay' has to be REQUIRED at least.

That's all I can think for now. May return with more in the future.
Indalecia
#3 - 2012-06-12 15:23:29 UTC
Desmont McCallock wrote:
- Suggesting to rename 'presets' to 'fittings' thus 'preset' to 'fitting' (makes more sense).
I think it's just the word "fitting" meaning different things to different people here. As it is defined in the draft, it is "A given ship with information about its state, including fitted modules, fitted charges, drones, implants, etc. and possibly variations of those.". The key word here being variation — a preset is nothing more than a variation of the same fitting. Presets were intended just for slight variations of the same idea, like a pimped version, a T2 version and a T1 version. The format was not designed to store multiple, unrelated loadouts in one JSON object.


Desmont McCallock wrote:
- Make 'presets' REQUIRED (what's the meaning of the format if it doesn't contain a fitting?)
That's a fair point. Although, even if it's in most cases pointless to not have a preset, I can't see why we should forbid it. The format could also be used just for its drone presets, for example.

Desmont McCallock wrote:
- Make 'presets-modules' REQUIRED for the same reason as above.
There's actually a valid use case against this. Consider a freighter loadout, where you cannot fit any modules, but you still want to save the implants (like agility implant, and warp speed implant).

Desmont McCallock wrote:
- Deprecate the 'charge' key and use only 'charges' (if it only has one charge then the array simply contains only one element).
The movitation for this was to make it easier for entites not wanting to support charge presets. If it ends up creating more confusion/problems, it will probably be removed in favor of the solution you just described.

(Cont. in the next post)

https://o.smium.org/ — v0.13.5 — A browser-based fitting tool and loadout sharing platform

Indalecia
#4 - 2012-06-12 15:23:42 UTC
Desmont McCallock wrote:
- Make 'slottype' key REQUIRED in order to know in advance the slot and not have to code a lookup.
That's a very debatable topic. We agreed that any data that can be acquired with the SDE and the mandatory data in the JSON loadout should be optional. It is dangerous to rely blindly on the specified slottypes (because a malicious user could write incorrect types), and to do correct validation you'll have to do the lookup anyway. If it seems too much of a hassle, you could create a view (or a small cache file) with just two colums, "typeid" and "slottype", that's fairly easy to do. Think of optional fields as helpers for human-readability.

Desmont McCallock wrote:
- Key 'chargepresets' isn't clear of it purpose. I guess it refers to proposed charges to be uses with the module (in addition to the one already loaded on the module). In that case 'name' should be made OPTIONAL and add a REQUIRED 'typeid' key (we don't want to rely on names, the purpose of this format is to avoid parsing issues with names). How about renaming that key to 'altcharges' or 'cargobay'?
No, that's not how the "chargepresets" key is used. It is just an array that does the mapping between charge preset IDs (specified in the "charges" key of the module, reffered to as "cpid" in the draft) and the charge preset name/description. So basically charge presets allow you to define multiple "sets" of charges for your modules.

Desmont McCallock wrote:
- If 'drone' key is used then 'inbay' has to be REQUIRED at least.
What if you only have active (ie: in space) drones? Like a Drake that only has a 25 m3 drone bay, you'll want your drones to be active, which leaves your bay empty. But I agree that if either "inbay" or "inspace" is not specified, than the other should be.

Thanks for your feedback!

https://o.smium.org/ — v0.13.5 — A browser-based fitting tool and loadout sharing platform

Khorkrak
KarmaFleet
Goonswarm Federation
#5 - 2012-06-12 16:19:20 UTC  |  Edited by: Khorkrak
RFC 2822 is intended for email messages and the date format there is likewise. The ISO 8601 Date Time format is simpler to deal with when converting from a string to a datetime. ISO 8601

Field names using the lowercase_with_underscores naming convention are slightly more readable than with simply the lowercase convention:
creationdate vs creation_date.

Consider removing the extraneous spaces in the JSON shown in the specification, while keeping spaces that are normal when writing mathematical expressions or simply writing in English. For example:
No: { "typeid": 8105, "charge": { "typeid": 209 } }
Yes: {"typeid": 8105, "charge": {"typeid": 209}}

Read the Pet Peeves section even if you're not writing in Python. Python Coding Style as much of it applies regardless of programming language.

JSON is a subset of YAML. YAML is meant to be easy for both humans and programs to read - relative to XML in particular. It is the direction that CCP is going as well. Why not give it a try? I created the following by simply copy pasting the JSON from the spec (removing the ... at the end) and fed into the following code:

import yaml

json_expression = 'copy pasted JSON'
print yaml.dump(yaml.load(json_expression))

presets:
- chargepresets:
- {id: 0, name: Scourge missiles}
modules:
- charge: {typeid: 209}
typeid: 8105
- charge: {typeid: 209}
typeid: 8105
- charge: {typeid: 209}
typeid: 8105
- charge: {typeid: 209}
typeid: 8105
- charge: {typeid: 209}
typeid: 8105
- charge: {typeid: 209}
typeid: 8105
- charge: {typeid: 209}
typeid: 8105
presetname: Meta 4 launchers
- chargepresets:
- {id: 0, name: Scourge missiles}
- {id: 1, name: Scourge fury missiles}
- {id: 2, name: Scourge precision missiles}
modules:
- charges:
- {typeid: 209}
- {cpid: 1, typeid: 2629}
- {cpid: 2, typeid: 24513}
typeid: 2410
- charges:
- {typeid: 209}
- {cpid: 1, typeid: 2629}
- {cpid: 2, typeid: 24513}
typeid: 2410
- charges:
- {typeid: 209}
- {cpid: 1, typeid: 2629}
- {cpid: 2, typeid: 24513}
typeid: 2410
- charges:
- {typeid: 209}
- {cpid: 1, typeid: 2629}
- {cpid: 2, typeid: 24513}
typeid: 2410
- charges:
- {typeid: 209}
- {cpid: 1, typeid: 2629}
- {cpid: 2, typeid: 24513}
typeid: 2410
- charges:
- {typeid: 209}
- {cpid: 1, typeid: 2629}
- {cpid: 2, typeid: 24513}
typeid: 2410
- charges:
- {typeid: 209}
- {cpid: 1, typeid: 2629}
- {cpid: 2, typeid: 24513}
typeid: 2410
presetname: Tech II launchers
ship: {typeid: 24698, typename: Drake}

XML has its advantages though provided humans won't be reading the output often. Name spaces are built in and xpath expressions can be used to extract items of interest declaratively while with JSON / YAML / Hashes / Python Dicts the only way is iterative looping unless you know exactly where in the structure the items are located - and even then to fetch multiple means looping.

Developer of http://www.decloaked.com and http://sourceforge.net/projects/pykb/

Indalecia
#6 - 2012-06-12 16:42:26 UTC
Khorkrak wrote:
RFC 2822 is intended for email messages and the date format there is likewise. The ISO 8601 Date Time format is simpler to deal with when converting from a string to a datetime. ISO 8601
This will be considered. The goal is obviously to have a format that can be easily generated and parsed in as many languages as possible.

Khorkrak wrote:
Field names using the lowercase_with_underscores naming convention are slightly more readable than with simply the lowercase convention:
creationdate vs creation_date.

Consider removing the extraneous spaces in the JSON shown in the specification, while keeping spaces that are normal when writing mathematical expressions or simply writing in English. For example:
No: { "typeid": 8105, "charge": { "typeid": 209 } }
Yes: {"typeid": 8105, "charge": {"typeid": 209}}
I'm afraid this is just a matter of personal preference, there is never a "one size fits all"-type of solution. About the field naming convention, this was done this way to be consistent with the column names in the SDE, and they will probably never be longer than a couple of words anyway. For the spacing in the JSON, this is just cosmetic and irrelevant to the parser.

Yaml could be a suitable format as well, however I think it's less adequate than JSON for an exchange format (think for example of web-services that operate on loadouts, returning JSON that can be exploited with Javascript out-of-the-box); also, as far as I can see, JSON support is more widespread in popular programming languages than Yaml.

XML was considered, and we chose not to use it because it's somewhat overkill for the task (and it's not uncommon to have vulnerabilities in XML parsers). We also think JSON is the way to go as CCP will use JSON for its CREST API.

Thanks for your feedback, it's appreciated!

https://o.smium.org/ — v0.13.5 — A browser-based fitting tool and loadout sharing platform

Sakari Orisi
Doomheim
#7 - 2012-06-12 20:36:03 UTC
The evefit team approves of this format.

I've been providing input via IRC and will naturally be providing more.
Khorkrak
KarmaFleet
Goonswarm Federation
#8 - 2012-06-12 21:01:17 UTC  |  Edited by: Khorkrak
Type IDs are far better than the names however unfortunately these too have changed in the past. Lets hope that never recurs. Here's a case in point. When the Omen Navy Issue, Scythe Fleet Issue, Exequror Navy Issue and Osprey Navy Issue ships were added they broke EDK. A patch was created and posted here: Old patch Scroll down past the ugly PHP stuff to the SQL. Note the type ids, in particular:

29271: Omen Navy Issue
29270: Scythe Fleet Issue
29269: Exequror Navy Issue
29268: Osprey Navy Issue

Today we have:
29271: No longer exists
29270: No longer exists
29269: Major's Son
29268: Major Effects

A funny effect of this is that some old EDK killboard entries will show Major's Son or Effects as the ship or weapon instead of Exequror or Osprey Navy Issue during 2008.

And now these ships are type ids:
17709 Omen Navy Issue
29336 Scythe Fleet Issue
29344: Exequror Navy Issue
29340: Osprey Navy Issue

For the lulz here are a few:

Exequror Navy Issue
Scroll to Francky Nackols and check weapon used
Same this time for MarkusBarak

Scythe Fleet Issue
Uh oh - disappeared from attackers list as the ship type id no is longer valid (whoops). Still present though in the killmail text see Name: Zhula Guixgrixks.
At any rate, just goes to show the havoc this type of change can cause so hopefully we won't see that happen again, but who knows...

Developer of http://www.decloaked.com and http://sourceforge.net/projects/pykb/

Aethlyn
Brutor Tribe
Minmatar Republic
#9 - 2012-06-12 22:18:30 UTC
I'd add a mandatory field with the current game version of the data used to create the fitting. That way programs could try to determine changed IDs or simply use older tables (unless I missed a note it's there; I think there's only a value for the format version?).

Looking for more thoughts? Follow me on Twitter.

Indalecia
#10 - 2012-06-12 23:07:55 UTC
Aethlyn wrote:
I'd add a mandatory field with the current game version of the data used to create the fitting. That way programs could try to determine changed IDs or simply use older tables (unless I missed a note it's there; I think there's only a value for the format version?).
I think that's a very good idea. I see two ways of storing the game version, one is using the expansion name plus the version mentioned in patch notes, the other is just using the build number:
Quote:
"client-version": { "expansion": "Inferno", "version": "1.0.10" }
"client-version": 384443
The former is easier to exploit from the entity's point of view, but the second is simpler to generate in an automated form (by connecting to the TQ server and reading the reply). Opinions?

Also, thank you for the feedback!

https://o.smium.org/ — v0.13.5 — A browser-based fitting tool and loadout sharing platform

Desmont McCallock
#11 - 2012-06-13 05:50:52 UTC  |  Edited by: Desmont McCallock
How about the SDE version?
Quote:
"sde": {"version": "Inferno_1.0_70633"}
Indalecia
#12 - 2012-06-13 17:30:10 UTC
After having thought about it for some time, I think going for the build number is the best way to go. The main function of this field would be to elegantly handle typeID changes, and using build numbers is the easiest way to do it (it's just a comparison between two numbers): http://paste.artefact2.com/p/963b16f

This method would also work if the process has to be done multiple times (just write the conditions in chronological order).

This is still open for discussion (of course), if you can come up with other reasons in favor of the other version formats.

https://o.smium.org/ — v0.13.5 — A browser-based fitting tool and loadout sharing platform

Khorkrak
KarmaFleet
Goonswarm Federation
#13 - 2012-06-13 17:52:54 UTC
That should do the trick. The more frequently occurring problem though is CCP devs deciding to simply delete type ids altogether. Look at what happened with the old scanner probes: Quest etc - their type ids are just gone - I think the same thing happened with mines but then they were brought back in if I'm not mistaken.

So what to do if a fitting references type ids that no longer exist? Just drop them out I suppose or map them to whatever they were switched to as was done for probes.

Developer of http://www.decloaked.com and http://sourceforge.net/projects/pykb/

Khorkrak
KarmaFleet
Goonswarm Federation
#14 - 2012-06-14 19:50:56 UTC  |  Edited by: Khorkrak
Since it's clear now that type ids are context sensitive, that is relative to a particular EVE build, is there really any benefit to using them in the loadouts over the names? The names alone both uniquely identify items within a given EVE build and are human readable (as in they do not require referencing a mapping of ids to names in order to make sense of the loadout).

Consider non-technical users exporting a loadout. It's easier to see which loadout is which when you have the names in there for everything. Removing the type ids altogether reduces the clutter. Also, I don't see the benefit of the cpid's and most of the key names. There has to be a ship, so lets just say that'll be the first item in the list. Then there are module presets aka fittings that's next - is there anything else? Within these presets are modules and then optionally a list of charge options for each.

So the structure can be simplified to just this. The cpids being unnecessary as the charges are listed explicitly always. Storing the fitting in a database would of result in normalization and its space efficiencies as that's where that mapping to ids would occur - away from human eyes save for debugging time.

JSON
and the even more readable yet still just as simple to process for non-fail languages Blink
YAML

Someone apparently implemented a parser for Javascript too: Javascript YAML

Developer of http://www.decloaked.com and http://sourceforge.net/projects/pykb/

Indalecia
#15 - 2012-06-14 21:52:06 UTC  |  Edited by: Indalecia
Khorkrak wrote:
Since it's clear now that type ids are context sensitive, that is relative to a particular EVE build, is there really any benefit to using them in the loadouts over the names? The names alone both uniquely identify items within a given EVE build and are human readable (as in they do not require referencing a mapping of ids to names in order to make sense of the loadout).
That's a big, big no-no. If you want to go back to only using typenames, then you might as well keep using the EFT or the EVE XML format. Typenames change far, far more often than typeids (for example, propulsion mods, invulnerability fields, missiles and torps, etc.). If CCP decides to change typeids, I think they would also break all the personal and corporation fittings (from the in-game fitting browser) using them by doing so, so it's unlikely they'll do it often. With your method an entity would need to have pretty much all the SDEs ready in your database to parse typenames. Typeids tend to change much less, so hardcoding the (few) changes and only keeping the latest SDE could work. I could even see a small file regrouping all the typeid changes (and the build number of when it happened) being maintained for entities to use.

Khorkrak wrote:
Also, I don't see the benefit of the cpid's and most of the key names. There has to be a ship, so lets just say that'll be the first item in the list. Then there are module presets aka fittings that's next - is there anything else? Within these presets are modules and then optionally a list of charge options for each.
Charge preset IDs are here to avoid repeating the preset name over and over, to make it easier (if someone is manually editing the file) to change the names. It's also better for parsing, because you immediately know how many charge presets there are.

Khorkrak wrote:
So the structure can be simplified to just this. The cpids being unnecessary as the charges are listed explicitly always. Storing the fitting in a database would of result in normalization and its space efficiencies as that's where that mapping to ids would occur - away from human eyes save for debugging time.
This is undeniably more appealing to the eye and more consise than the current CLF, however, this comes at a great cost:

  • Where are the preset descriptions? And the charge preset names/descriptions?
  • How would you handle modules which don't have a charge fitted in some charge presets? (Like, a sensor booster with a script in charge preset A, but not in charge preset B) You could use nulls in your array, but that's a bit hackish and you're essentially back to using implicit cpids.
  • Also, you thew extendability out of the window. What if you ever want to add a field to the format? With arrays and no keys, you hide a lot of the logic in the parser (that has to make a lot of assumptions about where to find information), so by touching the format a little bit (like by adding a column), you're breaking all parsers out there. That's terrible. Using keys is better for backwards and forwards compatibility (old parsers will just ignore the new key).


I hope you're not taking my criticism personally, I appreciate the feedback ;)

https://o.smium.org/ — v0.13.5 — A browser-based fitting tool and loadout sharing platform

Khorkrak
KarmaFleet
Goonswarm Federation
#16 - 2012-06-14 23:52:00 UTC  |  Edited by: Khorkrak
No offense taken at all, it's important to hash this stuff out. I'm surprised so few have responded - seems apathetic. That could be a problem. Which leads into backwards compatibility. What if the EDK and Battleclinic developers etc can't be bothered to change their code to export data in the new format? Will EFT really stop supporting the old format? What to do for people with existing loadouts saved in the old way? Will there be a conversion process from old to new - at least to the extent possible?

It's like when Microsoft Excel came out and Lotus 123 was king. Yes I'm that old. Excel won by being able to both read in and write out in Lotus 123 format so people that used it would still be able to send stuff to the those stuck in their ways who would not change as well as read their data. What can be done here to ensure adoption?

Developer of http://www.decloaked.com and http://sourceforge.net/projects/pykb/

Desmont McCallock
#17 - 2012-06-15 05:46:18 UTC  |  Edited by: Desmont McCallock
As far as I know Gripen's ways (EFT), he's not going to support CLF, not until he's forced to.
Talking to MrCue (BC admin), supporting CLF depends on its popularity.
From EVEMon's side, I intent to support CLF as long as it is used by an app.

Edit: Currently EVEMon supports XML, DNA, EFT formats.
Sakari Orisi
Doomheim
#18 - 2012-06-15 06:06:23 UTC
Desmont McCallock wrote:
As far as I know Gripen's ways (EFT), he's not going to support CLF, not until he's forced to.
Talking to MrCue (BC admin), supporting CLF depends on its popularity.
From EVEMon's side, I intent to support CLF as long as it is used by an app.

Seconded, pyfa and aurora will both support CLF.
Indalecia
#19 - 2012-06-15 09:13:30 UTC
Khorkrak wrote:
No offense taken at all, it's important to hash this stuff out. I'm surprised so few have responded - seems apathetic. That could be a problem. Which leads into backwards compatibility. What if the EDK and Battleclinic developers etc can't be bothered to change their code to export data in the new format? Will EFT really stop supporting the old format? What to do for people with existing loadouts saved in the old way? Will there be a conversion process from old to new - at least to the extent possible?
Converting from the CLF to another format is easy. The other way is not so easy, but can still be done with a few assumptions. Once the format stabilizes a bit, I will make a reference validator/parser in PHP for the CLF, and I guess I could also include a little conversion script to juggle between formats. Maybe I could use it in a simple webpage where users paste their loadouts, select an output format and they get the result, and host it somewhere. (The code would be most likely public domain.)

Regarding adoption, only time will tell us. But I think that if the format is good, and gets used by some popular applications, it will grow popularity on its own. (And I'm sure application developers will be glad to have a solid specification and reference implementation to code their parsers against.) Anyway, I am definitely sure I will primarily use the CLF in the project I'm working on (a browser-based fitter), if that counts.

I will update the draft soon to make a few changes based on the feedback I got here in the last few days. After that, we'll have to decide on an expiration date for the draft: after this date, the draft either becomes the "official" specification (and becomes immutable, except for trivial changes such as typos), or a second draft is published (with a new expiration date).

https://o.smium.org/ — v0.13.5 — A browser-based fitting tool and loadout sharing platform

Artem Valiant
NecroRise Squadron
Galaxy Spiritus
#20 - 2012-06-15 12:48:08 UTC
Good idea. I think EVEUniverse will support CLF format.
12Next page