Custom Classes Intro
Creating Custom Classes
Custom Classes allow you to override parts of VASSAL's code to create your own custom features. In order to get started creating a custom class, you should first:
- Be familiar with Using Git, and obtain a copy of the VASSAL code (see Using Git article)
- Install the IntelliJ IDE and make sure you can build the VASSAL code (see Getting_started_with_IntelliJ article)
Now, make a separate folder for your custom classes project (NOT under the folder where you have VASSAL code stored, etc), and start a new git local repository there.
$ md MyCustomClasses $ cd MyCustomClasses $ git init
Then, clone the VASSAL "custom code template":
$ git clone https://github.com/vassalengine/vassal-module-template
That grabs our module template (source code for sample custom classes, and a Maven project file) from the VASSAL git repository.
Then, perform these steps:
- Launch IntelliJ
- From the File menu, select "Open..."
- Browse to your MyCustomClasses folder, and inside the vassal-module-template subfolder, open the "pom.xml" file.
- You will be informed this is a Maven project and asked if you want to open it as a project -- click Yes.
The project will now open, and you will see the Vassal custom class "template", which contains examples of how to create custom classes (e.g. a MyChatter class to customize the Chat Log). You can build these and experiment with them if you like, and learn how to install them in your modules.
Information on how to install a particular class in your module is contained in the comments of the .java files in the template, e.g. MyChatter.java.
Once you've experimented with using the sample custom classes we have provided, you are ready to branch out and start customizing classes in your own way!