Skip to content

feat: Add AI-powered custom building generation with fal.ai#329

Open
blendi-remade wants to merge 13 commits intoamilich:mainfrom
blendi-remade:feat/custom-buildings
Open

feat: Add AI-powered custom building generation with fal.ai#329
blendi-remade wants to merge 13 commits intoamilich:mainfrom
blendi-remade:feat/custom-buildings

Conversation

@blendi-remade
Copy link

@blendi-remade blendi-remade commented Jan 23, 2026

  • Generate custom building sprites using fal.ai nano-banana-pro
  • Analyze buildings with vision LLM for game attributes (cost, jobs, pollution, etc.)
  • Smart aspect ratio selection based on building description
  • Client-side content bounds detection for precise isometric placement
  • Fal-branded UI with spinning logo and loading states
  • Full bulldoze support for multi-tile custom buildings

Note

Adds an experimental AI custom building pipeline backed by fal.ai, including a new POST /api/generate-building route that (1) chooses an aspect ratio via Gemini, (2) generates an isometric sprite via Nano Banana Pro, (3) removes the background via Bria RMBG, and (4) analyzes the sprite via vision LLM to derive in-game attributes (size/cost/pop/jobs/pollution/land value).

Introduces a full client UX + persistence flow: CustomBuildingPanel in the sidebar to create/list/remove/select custom buildings, CustomBuildingsProvider to store them in localStorage, and game/runtime support to place, render, select, and bulldoze multi-tile custom buildings (including content-bounds centering and external-image CORS handling in imageLoader). Documentation and dependencies are updated (@fal-ai/client, README setup via FAL_KEY).

Medium Risk. Adds new server API integration with external AI services and introduces a new building type that affects placement/rendering/bulldoze paths, which could impact core gameplay flows if misbehaving.

Written by Cursor Bugbot for commit a9e9966. This will update automatically on new commits. Configure here.

- Generate custom building sprites using fal.ai nano-banana-pro
- Analyze buildings with vision LLM for game attributes (cost, jobs, pollution, etc.)
- Smart aspect ratio selection based on building description
- Client-side content bounds detection for precise isometric placement
- Fal-branded UI with spinning logo and loading states
- Full bulldoze support for multi-tile custom buildings
@vercel
Copy link
Contributor

vercel bot commented Jan 23, 2026

@blendi-remade is attempting to deploy a commit to the andrew-4640's projects Team on Vercel.

A member of the Team first needs to authorize it.

cursor[bot]

This comment was marked as outdated.

- Introduce valid aspect ratios for building generation to ensure consistency
- Validate aspect ratio input from the client and fallback to default if invalid
- Remove deprecated background removal functions to streamline image processing
- Implement validation for custom building properties to prevent errors
- Update sidebar tool selection logic for improved user experience
- Apply AI-analyzed environmental stats to custom buildings in the game context
cursor[bot]

This comment was marked as outdated.

…enerator

- Added crossOrigin attribute to the image element to support loading images from external fal.ai CDN URLs, ensuring proper image retrieval and display.
cursor[bot]

This comment was marked as outdated.

…tom buildings

- Update pollution and landValue assignments to apply only to the origin tile, aligning behavior with regular building logic.
- Modify the footprint validation logic to only allow placement on grass tiles, clarifying that 'empty' tiles are part of multi-tile building footprints and not truly empty.
…analysis

- Implement a try-catch block around getImageData to manage potential SecurityError on CORS-tainted canvases, providing a fallback to assume full image content bounds if an error occurs.
cursor[bot]

This comment was marked as outdated.

- Update population and jobs assignments to use nullish coalescing, ensuring default values are applied when stats are undefined.
- Modify the footprint validation logic to allow placement on both grass and tree tiles, aligning with multi-tile building behavior.
cursor[bot]

This comment was marked as outdated.

- Remove the analyzing step from the CustomBuildingPanel, streamlining the user experience.
- Update the reset logic to only consider the generating step, enhancing modal behavior.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

- Update content width and height calculations to include an additional pixel, ensuring accurate content bounds analysis for image rendering.
- Update the logic to use customSize for buildings of type 'custom', ensuring accurate size determination for building placement in the isometric grid.
- Update the size calculation to utilize customSize for buildings of type 'custom', ensuring accurate placement and rendering in the isometric grid.
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.

1 participant