Skip to content

Conversation

@Lunkle
Copy link
Member

@Lunkle Lunkle commented Jan 2, 2026

No description provided.

Lunkle added 4 commits January 1, 2026 09:58
Reorganized and renamed map generation classes, replacing MainWorldGenerationStrategy with OverworldGenerationStrategy. Introduced MapGenerationParameters and GenerationProcess for improved extensibility. Moved and refactored biome, points, and structure generation steps under an overworld package. Updated usages and tests to reflect the new structure and naming.
Moved biome decision logic from BiomeGenerationStep to BiomeParameters for better encapsulation. Introduced a new structure generation system, including StructureGenerationStep, StructureGenerationConfig, and TreeGenerationConfig, enabling procedural placement of structures like trees based on biome parameters and noise. Updated world and tile logic to support actor rendering and placement, and refactored noise generator constructors for consistency.
Actors are now rendered by iterating over tiles in relevant chunks instead of directly from a global actor list. This ensures actors are rendered on top of tiles and improves rendering locality. Also adds a tiles() method to Chunk for easier tile access, and removes actor rendering from Tile's render method. Minor cleanup in structure generation logging.
@gemini-code-assist
Copy link

Summary of Changes

Hello @Lunkle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the foundational elements for procedural tree generation within the game world, significantly enhancing environmental detail. It achieves this by overhauling the existing world generation architecture, centralizing generation steps, and encapsulating biome determination logic. The changes also include performance improvements for actor rendering and a general cleanup of generation-related class names and packages.

Highlights

  • Tree Generation Implementation: Introduced a new StructureGenerationStep and TreeGenerationConfig to procedurally generate trees on the map, specifically 'oak_tree' in 'FOREST' biomes, enhancing world diversity.
  • World Generation Refactoring: Significantly refactored the world generation process by introducing MapGenerationParameters and a GenerationProcess class. This centralizes the management of biome, points of interest, and structure generation steps within a Zone, replacing the previous fragmented approach.
  • Biome Logic Encapsulation: Moved biome calculation logic (continent, category, variant determination) from BiomeGenerationStep into the new BiomeParameters class, improving modularity and clarity of biome definition.
  • Actor Rendering Optimization: Optimized actor rendering by only rendering actors within the chunks visible around the camera's position, rather than iterating through all actors in the world. This should improve performance for large worlds.
  • Renaming and Cleanup: Renamed MainWorldGenerationStrategy to OverworldGenerationStrategy and moved various generation-related classes into a new overworld package, standardizing naming and improving package organization. The GenerationStepStatus enum was also removed as part of this refactoring.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant and well-executed refactoring of the world generation system. The new GenerationProcess with distinct steps for biomes, points of interest, and now structures, greatly improves the modularity and extensibility of the generation logic. The addition of tree generation is a great new feature. I've also noticed and appreciated the performance optimization in actor rendering.

I have a few suggestions to further improve the code:

  • A bug fix for actor rendering logic to ensure all nearby actors are rendered.
  • A small refactoring to improve consistency in how generation parameters are accessed.
  • A design consideration for handling conflicts in structure generation.
  • Removal of an unused method.

Overall, this is a high-quality pull request.

Comment on lines +84 to +93
List<Chunk> chunksToRender = asList(
getChunk(chunkCoord),
getChunk(chunkCoord.up()),
getChunk(chunkCoord.down()),
getChunk(chunkCoord.left()),
getChunk(chunkCoord.right()),
getChunk(chunkCoord.down().right()),
getChunk(chunkCoord.right().right()),
getChunk(chunkCoord.down().down())
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The logic for selecting chunks to render appears to be flawed. It doesn't select a complete 3x3 grid of chunks around the camera's current chunk, which could lead to actors at the edges of the screen not being rendered. The current implementation includes chunks like chunkCoord.right().right() and chunkCoord.down().down(), which are outside the immediate 3x3 area, while missing corner chunks like up().left().

To ensure all visible actors are rendered correctly, I suggest using a proper 3x3 grid of chunks centered on the camera's position.

List<Chunk> chunksToRender = asList(
				getChunk(chunkCoord.up().left()),
				getChunk(chunkCoord.up()),
				getChunk(chunkCoord.up().right()),
				getChunk(chunkCoord.left()),
				getChunk(chunkCoord),
				getChunk(chunkCoord.right()),
				getChunk(chunkCoord.down().left()),
				getChunk(chunkCoord.down()),
				getChunk(chunkCoord.down().right())
		);

Comment on lines 29 to 33
public GenerationProcess(Zone zone, MapGenerationStrategy strategy) {
biome = new BiomeGenerationStep(zone, strategy.seed());
points = new PointsGenerationStep(zone, strategy.seed());
structure = new StructureGenerationStep(zone, strategy.parameters());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's an inconsistency in how generation steps are initialized. BiomeGenerationStep and PointsGenerationStep use strategy.seed(), while StructureGenerationStep uses strategy.parameters(). The seed() method on MapGenerationStrategy appears to be redundant now that MapGenerationParameters exists.

For better consistency and to centralize parameter access, I recommend using strategy.parameters().seed() for all step initializations. This would also allow for the removal of the seed() method from the MapGenerationStrategy interface and its implementations, cleaning up the API.

Suggested change
public GenerationProcess(Zone zone, MapGenerationStrategy strategy) {
biome = new BiomeGenerationStep(zone, strategy.seed());
points = new PointsGenerationStep(zone, strategy.seed());
structure = new StructureGenerationStep(zone, strategy.parameters());
}
public GenerationProcess(Zone zone, MapGenerationStrategy strategy) {
biome = new BiomeGenerationStep(zone, strategy.parameters().seed());
points = new PointsGenerationStep(zone, strategy.parameters().seed());
structure = new StructureGenerationStep(zone, strategy.parameters());
}

Comment on lines +49 to +53
for (StructureGenerationConfig params : structureParameters) {
BiomeParameters biomeParameters = zone.biomeGenerationStep().parametersAt(tile);
Structure structure = params.placeStructure(tile, biomeParameters);
structures[chunk.x() * CHUNK_SIZE + tile.x()][chunk.y() * CHUNK_SIZE + tile.y()] = structure;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In the generate method, you iterate through structureParameters and assign a structure to a tile. If multiple StructureGenerationConfig instances attempt to place a structure on the same tile, the last one in the list will overwrite the previous ones. This might be the intended behavior, but it could lead to unexpected results as more structure types are added.

You might want to consider adding a check to see if a tile is already occupied by a structure before placing a new one to prevent this.

Removed the seed() method from MapGenerationStrategy and updated all generation steps (biome, points, structure) to use strategy.parameters().seed() instead. Adjusted constructors and usages accordingly for improved consistency and extensibility. Added missing no-arg constructors for serialization where needed.
@Lunkle Lunkle merged commit 354ff80 into main Jan 2, 2026
1 check passed
@Lunkle Lunkle deleted the tree-generation-donny branch January 2, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants