Does Vassal support computer opponents?
TL;DR: No, it does not.
Computer opponents
First off, by computer opponent (CO) we mean some kind off automatised system that can execute valid actions in a game at valid points in time, without any human intervention.
There are many different ways in which such a CO can be implemented
- Look-up tables based on current state of game
- Goal-driven decision trees
- Expert systems
- Artificial Neural Networks (ANN) also known as “A.I.”, for example Large Language Models (LLM)
- …
Sometimes these techniques are coupled into a CO. For example, many older chess computers used expert systems (database of plays) and goal-driven decision trees to implement COs.
Prerequisites of a Computer Opponent
- Game State: To implement a CO in software, the CO program will most of the time need access to the current game state. E.g., which pieces are where on the board, and what resources are available to the CO.
- Access to Game Engine: The CO needs some way of communicating with the game engine - e.g., Vassal. That is, the CO needs to be able to say to the game engine “I want to move piece A to place b”, and to get possible feedback from the game engine.
Limitations of Vassal
Vassal - as a game engine - does not keep track of the game state in any meaningful way. For example, Vassal does not know where each piece is on the board, nor does it necessarily have any meaningful concept of available resources.
That means that it is very hard to extract the game state from Vassal - if not impossible - into a CO.
Vassal’s rather obscure save format is not easily decoded and re-encoded outside of the Vassal source code (although the Python module pywargame does provide an API for that - as well as encoding and decoding Vassal modules).
That means that there’s no easy way for a CO to communicate with the Vassal game engine.
So is there a way?
One could imagine a flow as follows
- A Human makes its move in Vassal, and then saves the current game to a save file
- The CO program reads in the saved game, along with the Vassal module, and tries to replicate the game state internally (e.g., using
pywargame) - The CO then makes a number of decisions and encodes that into a save file (e.g., using
pywargame) - The human imports that save file into the human player’s state
The culprit really lies in “The CO … replicate the game state internally” which may or may not be easy at all - simply because the saved game may not contain enough information.
Of course, every single part of Vassal can in principle be overwritten by custom code in a module, and one could implement storing game state like that. However, it would essentially amount to a complete rewrite of Vassal.
One module that does implement a fully automated CO is One Minute Bulge - which is arguably so simple that it is a vast of time ![]()
Will this ever change?
For Vassal version 3? No, not ever.
However, the plans for Vassal 4 is to have a the engine keep much more tabs on the game state, not least through much deeper scripting possibilities in each module. Presumably, a module can define how game state should be recorded and when. Also, the engine itself is supposed to be run as a server which the clients (human or computer driven) can communicate with via a clear Application Programming Interface (API), which is agnostic to the client.
A client may say “I want to move piece A to place b”, to which the server may say “No can do, b is off limits to A”. Or the client may say “Please give me the location of all pieces visible to the German faction” to which the server will reply with a list of appropriate pieces and their locations. Or the server may broadcast to clients “Faction 1 has moved piece C to d, please update your displays”. Or “@Faction 3, faction 2 attacks your piece D in f, do you want to withdraw?”.