A Java implementation of Hempuli's Baba Is You, where the rules of the level aren't fixed — they're physical text blocks (BABA, IS, WALL, STOP...) sitting on the same grid as the player, and pushing them around rewrites the laws of the game live. The interesting part of building this wasn't the puzzle levels, it was the rule engine underneath: every move re-scans the grid for [Noun] IS [Property/Noun] patterns and re-derives the entire rule set from scratch, so the game has to stay correct even while its own physics are being edited mid-move.
Comprehensive manuals for both end-users and developers are provided in the docs directory:
- User Manual: See docs/user.md for instructions on how to play the game, a breakdown of property behaviors, and a guide for creating custom levels.
- Developer Manual: See docs/dev.md for architectural details, the MVC design pattern implementation, and the underlying recursive collision system used in the codebase.
Try the game here : baba-is-you.onrender.com
- Java Development Kit (JDK) 21 or higher.
- Apache Ant.
To build and run the project, open a terminal in the root directory of this repository and execute the following commands:
-
Compile the source code and build the executable JAR file:
ant jar
-
Launch the game:
java -jar baba.jar
To test changes quickly without packaging the game into a JAR file, use the provided helper scripts:
On Windows:
run-dev.batOn macOS/Linux:
./run-dev.shThese scripts will automatically compile the source code and launch the game directly from the compiled classes.
Note: The game must be launched from the root directory of the repository to ensure it can correctly load the src/images/ and src/levels/ resource directories.
The game can be deployed as a web application using Docker. No external dependencies (no Webswing, no VNC) are required — the game runs as a lightweight Java HTTP server and renders entirely in the browser via HTML5 Canvas.
Requirements: Docker
# Build the image
docker build -t baba-is-you .
# Run on port 8080
docker run -d -p 8080:8080 --name baba-is-you baba-is-youThen open http://localhost:8080 in your browser.
The game state is served as a tiny JSON payload (~1KB per move). Sprites are cached by the browser after the first load. Performance is identical to running it natively.
- Dynamic Rule System: Push text blocks together to rewrite the physics and logic of the game during runtime.
- Custom Level Engine: Define and load custom levels using standard text files.
- Undo System: Press the spacebar to rewind previous states step-by-step to the beginning of the level.
- Modern Java: Built utilizing modern Java 21 features including Records, Sealed Interfaces, and Pattern Matching.
This repository is an academic school project completed at ESIEE Paris. It is only a small educational replica of the original game.
Full credit and rights for the original Baba Is You concept, mechanics, and design belong entirely to its creator, Arvi Teikari (Hempuli). Please support the official release and visit the Baba Is You official website for the official game and documentation.
All images, gifs, and animations used in this project were taken from the Baba Is You Wiki Advanced Rulebook.
