Build Your Own World
A tile world built from a seed, where one search lights the rooms and finds the path
- Java
- Algorithms
- Procedural generation
- Game architecture
Overview
A tile world built from a seed, where one search lights the rooms and finds the path
- Role
- Architecture, half the classes
- Team
- Pair project
- Timeline
- Spring 2026
- Course
- CS 61B, UC Berkeley
A procedurally generated, explorable tile world in Java, built on the course tile engine with a pair partner. I designed the architecture and implemented half the classes: GameWorld, Room, Light and BFS, covering world generation, wall generation, the game loop, rendering, avatar movement and lighting.
Ideation
Before writing code, we mapped the whole game as a flow chart: the menu (new game, load, theme, exit), entering a seed, building the world and its lights, and the game loop with movement, the hover bar, click-to-move and saving. It became our plan for which classes we needed and how they connect.
Building the world
The player types a numeric seed. It seeds one Random, and that Random drives every choice: how many rooms (8 to 14), their sizes and positions, the hallway paths, which lights are on. The same seed always makes the same world.
generateWorld() runs the pipeline: rooms place floors, hallways place floors, then generateWalls() sweeps every tile and turns any empty tile with a floor among its 8 neighbors into a wall, then lighting, then the avatar.
RationaleDeriving walls after floors keeps hallway-into-room joins clean, since neither rooms nor hallways ever draw a wall. Checking all 8 neighbors, not just 4, is what closes the corners of each room.
One search, two uses
One generic breadth-first search returns a map from each tile to its distance from the start, expanding only through walkable tiles and stopping at walls and at a max depth.
Lighting and pathfinding are the same algorithm with different depth limits, so one tested search serves both: a fix to the search fixes lighting and pathfinding at once, and neither has to know how the other works.
Save and load
Saving writes the seed plus every keystroke, and the theme and light states, to a text file. Loading regenerates the world from the seed and replays the keystrokes, instead of saving the whole grid.
Complexity, from our design doc (W×H tiles)