Create account / Log in

What is possible in terms of integration?

Discussion area for the development team.

Moderators: uckelman, Tim M

What is possible in terms of integration?

Postby tinjaw » July 30th, 2020, 1:52 pm

I have two programs. Mine and VASSAL. I want to get data (state info) out of VASSAL and into my program.

1) Are there any extensions that do things like export CSV or XML files?

2) I can code in Java. What should I look at to add this functionality as an extension?

Best,
Chaim
User avatar
tinjaw
 
Posts: 31
Joined: April 10th, 2020, 12:11 pm

Re: What is possible in terms of integration?

Postby Cattlesquat » July 30th, 2020, 6:30 pm

It can definitely be done if you write a Custom Class (in other words, Java). But I don't know of anyone who has done it before so you'll be blazing some new territory.

The first step would be pulling down the Vassal source code and get it compiling on your computer -- see the Wiki for some articles on getting "git" set up (so you can pull down the source code), and then I think there's stuff about how to get your development environment set up (I think we're currently recommending IntelliJ if you don't already have a favorite).

Then you'd need to learn how to override VASSAL classes with your own custom classes. There's a "Coding Tutorial" in there somewhere (and ZapWars in the module section is related to that) which attempts to walk you some of the basics. You'd be looking for some good place to override a Vassal class with your own, so that you'd have an insertion point for you code. The code would have full access to the game state data by calling into Vassal methods, and could then write out whatever you want to a file (and/or read it in from a file). I guess the Deck trait even already has a thing to read/write hands of cards to and from text files, so you could take a peek in there.

I'm not saying it's easy, but it's possible if you've got some Java chops :-)

Brian
User avatar
Cattlesquat
 
Posts: 890
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA

Re: What is possible in terms of integration?

Postby Flint1b » July 30th, 2020, 6:38 pm

I don't know that much about internals but I would look at how savegames are written, then hook into that process and write your own serializer.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina

Re: What is possible in terms of integration?

Postby uckelman » July 30th, 2020, 6:57 pm

Thus spake tinjaw via messages:
> I have two programs. Mine and VASSAL. I want to get data (state info)
> out of VASSAL and into my program.

You'll find this far, far easier in VASSAL 4, when we'll have human-
readable files defining modules, logs, and saves. It's going to be hard
going dealing with the quasi-binary format VASSAL 3 uses.

> 1) Are there any extensions that do things like export CSV or XML files?

Converting existing files to the new format will be close to the top of
my list when V4 development gets moving, so you might be able to take
advantage of that.

--
J.
User avatar
uckelman
Site Admin
 
Posts: 8847
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: What is possible in terms of integration?

Postby Flint1b » August 3rd, 2020, 9:34 pm

On another thought, this would actually be a very interesting addon.

I would very much like to write an AI for some of the games I play with Vassal, for various reasons. Would like a faster response time instead of waiting for days for the response email, have a strong opponent to learn from, have an opponent at all (still can't find a reliable one for one of my games). Vassal already offers the GUI but I'd need the raw data to feed into the AI.

The current format may be ugly, but it should be possible and not too complicated to hook into the savegame writing functionality and write out a "second savegame" in another format, one that can be read by other tools like json. I think the data would need to be schema-free though so CSV is out of the question, except if someone was interested in coming up with a DB model in 2nd/3rd normal form that would work for every boardgame.
User avatar
Flint1b
 
Posts: 461
Joined: May 19th, 2020, 12:27 am
Location: Colonia Agrippina


Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests