This is just a repo with some of my Ludii experiments and learnings.
See resources.md for links to other documents and tutorials.
Extract the files from a Ludii .jar
file with the command: jar xf Ludii-filename.jar
(Note you probably want to do this in an empty folder.)
Then you'll find the .lud
files in a folder named lud
.
In the Ludii app, go to "File->Editor..." to open the editor. The two options are "packed" and "expanded". You probably want packed, but expanded removes all the functions (essentially just unrolling them into the definition).
Make changes and click compile to see them in action. (Re-loading the game will lose your changes, so be careful to copy anything you want to save to an external file.)
Right-click on a ludeme to see its possible values and/or alternatives.
The 5 parameters for the GAME ludeme are: name, players, mode, equipment, and rules.
If any of them are missing, it's assumed that the "defaults" are from Tic-tac-toe.
These examples are all inside (game (equipment {
HERE } ) )
unless otherwise specified.
(board 8)
(board 8)
... But also, outside of the (game ...
ludeme:
(metadata (graphics {
(board Style Chess)
} ) )
(board (hex 5))
(board (rotate 90 (hex 4)))
Playing in the center of the board spaces is the default. Add use:Vertex
to your board definition to specify playing on the intersections (or verticies).
(board (square 19) use:Vertex)
You’ll need to define your pieces in the “game -> equipment” ludeme. If none of the pieces start on the board, that’s all you need to do. (see example game: Hex)
If you want pieces to start on the board, you then need to reference them in a “game -> rules -> start -> place” ludeme. There are a number of ways to do this. (see example game: Chess)
Piece placement is the default. To move pieces already on the board is more work.
See checkers (english draughts).
From "Game of the Pawns":
(piece "Pawn"
Each
(or
{
(move Step Forward (to if:(is Empty (to))))
(move
Step
(directions { FR FL })
(to
if:(is Enemy (who at:(to)))
(apply (remove (to)))
)
)
}
)
)
If your game has multiple names, you can specify other names in the “metadata -> info -> aliases” ludeme. (And it will be searchable by those names!)
(metadata
(info {
(aliases {“Other Name”})
} )
)