geordanr / xwing

Squad builder for the First Edition X-Wing Miniatures game by Fantasy Flight Games.
http://geordanr.github.io/xwing
MIT License
97 stars 154 forks source link

Add support for outputting lists in format needed for Tabletop Simulator #369

Closed doweaver closed 7 years ago

doweaver commented 7 years ago

Example:

Delta Squadron Pilot + TIE/x7 + Stealth Device (31) Delta Squadron Pilot + TIE/x7 + Stealth Device (31) Countess Ryad + Push the Limit + TIE/x7 + Stealth Device (38)

geordanr commented 7 years ago

What is the actual output specification?

doweaver commented 7 years ago

It's :

Pilot1 + upgrade + upgrade... (point total)
Pilot2 + upgrade + upgrade... (point total)
etc.

It came from the way http://xwing-builder.co.uk/build presents squads, but the performance of that site isn't on the level of yours, so I prefer this one :)

Maybe the right move here is to update Tabletop Simulator to accept the existing "Simple" output, but currently there are a couple other squadron generator's (the one above, and Fab's) which have the TTS format. The existing simple format also has a bunch of extra information TTS doesn't need, like the point totals of each upgrade, etc.

elistevens commented 7 years ago

The appropriate way to transfer squad info between programs is the XWS spec, which is supported by all of the major builders. See here for more info:

https://github.com/elistevens/xws-spec/blob/master/README.md

Edit: I should also note that this is used by List Juggler, Han Shopped First, etc. to move information from the builders to other 3rd party tools.

doweaver commented 7 years ago

Yeah, agreed that XWS is the best way to do it. Parsing JSON in Tabletop Simulator is unfortunately quite painful (with all of the extraneous text), which is why the mod author went with the format above (basically, the minimal format the information could be presented in). The builder already has a multitude of ways to view the squad in text (Fancy/Simple/BBCode/HTML), so I thought adding another option might be acceptable. If you're philosophically opposed, I understand - it's not a clean solution for sure, although I've yet to actually see a clean solution for getting data into Tabletop Simulator.

geordanr commented 7 years ago

Yeah, I would prefer not have to maintain another output specification (that is, after all, why we developed XWS).

Also, the TTS spec is ambiguous in some circumstances, e.g.

Braylen Stramm + R2-D2 (29)

Is that the astromech or the crew? This is the sort of thing XWS was intended to solve.

elistevens commented 7 years ago

What language does TTS do scripting in? It might be possible to find an open-source JSON parser in that language and drop that in. Or the TTS devs could add a JSON parser library to the program as one of the tools that people have available (which I think would make a lot of sense).

Aside, what faction is this list:

Boba Fett (39)
Kath Scarlet (38)
doweaver commented 7 years ago

TTS does its scripting in Lua, but I'm not intimately familiar with how it works - I'm mostly a user :)

The way it currently handles ambiguity like in your example above is to pull both versions of the card and prompt the user to select one.

I think we should close this issue for now so I can do some more digging in to what we could potentially do with JSON in TTS. Using XWS is definitely the ideal.

elistevens commented 7 years ago

http://lua-users.org/wiki/JsonModules might be of use. Looks like there are a number of pure-Lua MIT-licensed parsing libs out there.

tjakubo commented 7 years ago

Hey, I just stumbled upon this and wanted to let you know that TTS mod can parse the BB-code version of your builder output for quite some time already. This is the original issue so you might want to close it and point people there.

If anyone has trouble with usage, refer to docs here for usage: https://github.com/tjakubo2/TTS_xwing/wiki/Doc:-Squad-Building other guides, including videos, will be linked on the wiki as well once done.

geordanr commented 7 years ago

Closing per @tjakubo2 's pointer to BBCode import.