Basic coding

Hello,

I’m brand new to both VASSAL and Java (just working my way through a textbook on Java programming). At this point, I am just finding my way around the Eclipse IDE, and can create simple programs but have never ran anything outside Eclipse itself. I want to create a VASSAL module with a few automated features, and haven’t been able to get through the programming tutorial for Zap Wars without running into obstacles. The tutorial says:
“Inside, you will find an “images” directory containing all the graphics used by the module and a file named buildFile which is used by VASSAL to build the module. Any custom classes that you create to use in a module must be added to the zip archive. Simply add the .class files to the archive, with a directory structure mirroring the package structure in the usual way the .jar archives are made. Once the .class files exist in the archive, they can be imported from VASSAL’s Configuration Window.”
I can’t seem to find a buildFile at all for Zap Wars and am now at a loss for where to find the archive to add .class files. I can find the images in the ZapWarsData file but nothing else.

I would be grateful for any help with this.

Hi Keefersa! Welcome to Vassal!

The first important thing to know is that you don’t actually need to do any Java programming at all to make a Vassal module, even one with a significant amount of automation. “Custom Classes”, the things that get added on via Java, are really only recommended for advanced/esoteric things that aren’t possible in out-of-the-box Vassal. But out-of-the-box Vassal is quite sophisticated and I certainly recommend you get the hang of that first. Depending on whether you’re more interested in euro games or war games, etc, will make a difference which are the modules to look at.

I’d recommend pulling down a few existing modules for games you like, or games that are roughly similar to the kind you want to make a module for – and then after playing around with them a bit, open them up in the editor and get a feel for how they are put together. There are also some Youtube tutorials on how to make modules.

Meanwhile to answer your more detailed questions on ZapWars, the ZapWars.zip is here: vassalengine.org/wiki/File:ZapWars.zip

Inside it you will find the ZapWars.vmod file, which is an actual “Vassal module” that you can open/play/edit in Vassal. “VMOD” files are actually just renamed Zip files – so they in turn can be opened “as if they were zip files” (one easy way is to temporarily rename them from .VMOD to .ZIP, or you can teach whatever Zip tool you have to recognize .Vmod files). Anyway, if you open up ZapWars.vmod “as a zip” you will find a buildFile in the root directory of that. A buildFile is really an XML file containing the configuration of the module – basically all the stuff that one puts into the module when “Editing” it in the editor.

Hope this gets you started!

Brian

Hi Brian,

thanks for the prompt reply and clear answer. I don’t know if I ever would have found the buildFile as I was looking in the zip file I had downloaded directly from VASSAL.

As to your larger point, it does make sense to play around with existing games a bit and see what I truly need to add. I downloaded Empires in Arms and will have a look at that first, as I am working on a grand strategic scale game. I do want to try to automate some features, such as provincial economic values, but this might be something I can do through existing Vassal tools.

Again, I really appreciate your help with this - I don’t know how I would have solved this otherwise.

Scott

If you want to learn Java, before you invest too much time into learning Eclipse, consider switching to an IDE that is more modern and helps you much better to be productive, consider IntelliJ Idea, the community edition.

On the other hand, consider using a simple editor with syntax highlighting, like Notepad++ or VSCode, and compiling Java by calling the javac.exe manually. Once you need to use a debugger or navigate big projects with hundreds of classes, you can switch to a proper Java IDE.

This is a very nice use case for Vassal btw, use it to learn Java :smiley: