Skip to content

Fix Build and Rendering Errors in GameBoard.kt - #142

Merged
candour merged 2 commits into
mainfrom
fix-bad-merge-rendering-errors-7945371924461333578
May 11, 2026
Merged

Fix Build and Rendering Errors in GameBoard.kt#142
candour merged 2 commits into
mainfrom
fix-bad-merge-rendering-errors-7945371924461333578

Conversation

@candour

@candour candour commented May 10, 2026

Copy link
Copy Markdown
Owner

This PR fixes critical build and rendering errors in GameBoard.kt that were likely introduced during a bad merge.

The fix involves:

  1. Unified Rendering Architecture: Introduced a DrawableEntity data class to collect all renderable items (Background, Decals, World entities, Projectiles, and UI Overlays) into a single list.
  2. Isometric Depth Sorting: World entities (Stalls, Enemies, Pillars, and the Goal Table) are now correctly sorted by their axial r coordinate to ensure correct visual overlap.
  3. Build Fixes: Fixed a specific Kotlin compilation error where pow(2) was used instead of pow(2f).
  4. Logic Restoration: Restored rendering logic for stalls and enemies that had been mutilated or omitted in the bad merge.
  5. Clean-up: Removed stray else blocks and incomplete line-of-sight visualization code that were causing syntax errors.

Verification:

  • ./gradlew assembleDebug passes.
  • ./gradlew test passes.

PR created automatically by Jules for task 7945371924461333578 started by @candour

Summary by CodeRabbit

  • Refactor
    • Reworked the board rendering pipeline to ensure consistent layering and draw order for world and foreground elements, improving visual stability and maintainability.
  • Bug Fixes / Visual
    • More consistent background edge rendering, unified enemy health text styling, clearer overlays (selected stall LOS/range, upgrade indicators), and smoother projectile motion/arc visuals.

Review Change Stack

Resolved numerous unresolved references and syntax errors in GameBoard.kt
caused by a bad merge. Refactored the rendering pipeline to use a unified
DrawableEntity system with five z-order groups to ensure correct
isometric depth sorting.

Key changes:
- Defined DrawableEntity data class for sorted rendering.
- Grouped Background, Decals, World entities (Stalls, Enemies, Pillars),
  Projectiles, and UI Overlays into a single drawables list.
- Implemented sorting by group and then by axial 'r' coordinate for the
  World layer.
- Fixed a compilation error where pow(2) was used on Floats without f suffix.
- Restored missing stall and enemy rendering logic that was lost during
  the bad merge.
- Verified build with assembleDebug and ran unit tests.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 49296800-16ce-4aec-9173-82cea4a83276

📥 Commits

Reviewing files that changed from the base of the PR and between 8712ef3 and c1e40af.

📒 Files selected for processing (1)
  • app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt

📝 Walkthrough

Walkthrough

GameBoard rendering refactored from immediate draw loops into a unified deferred-render queue. A new DrawableEntity data class (z-order + draw lambda) accumulates world-layer entities (pillars, stalls, enemies), foreground effects (puddles, visual effects), overlay visualizations (range, upgrade indicators), and projectiles. After enqueuing all entity types, the queue is sorted by z-order and each entity's draw lambda is executed to produce the composite frame.

Changes

GameBoard Rendering Queue Refactor

Layer / File(s) Summary
Data Shape
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
DrawableEntity data class stores axial coordinates, z-order, and a DrawScope lambda for deferred rendering.
Enemy Health Text Styling
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
Introduces a remembered healthTextPaint used for drawing enemy health percentage text.
Background / Decals
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
Background pass uses explicit tile-type checks for edges and renders START/DRAIN decals during the background draw.
World Layer Entities
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
Pillars, goal tables, stalls, and enemies are enqueued into drawables with a world-layer z-order, replacing the previous immediate/sorted world draw flow.
Foreground Layer Entities
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
Puddles and visual effects enqueued with effect-type-specific z-orders; lambdas capture alpha/progress for animation.
Overlay Layer Entities
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
Selected-stall LOS/range overlay and upgrade indicator enqueued with higher z-orders to render above world and foreground.
Projectile Rendering
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
Projectiles enqueued with per-frame interpolation between positions and optional arc-height adjustment before drawing.
Queue Execution
app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt
drawables sorted by z-order using existing comparator; each entity's draw lambda executed to composite the final frame.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • candour/towerpower#140: Also refactors GameBoard rendering and DrawableEntity/sorting logic toward a queued/layered model.
  • candour/towerpower#141: Modifies GameBoard rendering ordering, projectile/VFX ordering, and enemy health UI similar to this PR.
  • candour/towerpower#135: Implements LOS blocking visualization for the selected-stall overlay that is now enqueued in the new drawables pipeline.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Fix Build and Rendering Errors in GameBoard.kt' directly and accurately describes the main objective of the changeset—resolving build and rendering errors in the GameBoard.kt file following a bad merge.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-bad-merge-rendering-errors-7945371924461333578

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ae3a5207-4946-48ac-92e4-6639390fd685

📥 Commits

Reviewing files that changed from the base of the PR and between 74444cd and 8712ef3.

📒 Files selected for processing (1)
  • app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt

Comment thread app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt Outdated
Comment thread app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt Outdated
Comment thread app/src/main/java/com/messark/hawker/ui/components/GameBoard.kt Outdated
Resolved numerous unresolved references and syntax errors in GameBoard.kt
caused by a bad merge. Refactored the rendering pipeline to use a unified
DrawableEntity system with five z-order groups for correct isometric depth.

Key changes:
- Unified rendering system using DrawableEntity and five z-order groups.
- Standardized TileType checks to use the 'is' operator for sealed classes.
- Optimized performance by caching obstruction lists and reuse healthTextPaint.
- Corrected Goal Table anchor to Offset(0.5f, 0.8f) for consistency.
- Fixed Float.pow(2) compilation error by using pow(2f).
- Restored missing stall and enemy rendering logic lost during merge.
- Verified build with assembleDebug and ran unit tests.

Co-authored-by: candour <4670475+candour@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Build Successful! 🚀

Download APK

Note: This link will be removed when the PR is closed.

@candour
candour merged commit 17a3e76 into main May 11, 2026
3 checks passed
@candour
candour deleted the fix-bad-merge-rendering-errors-7945371924461333578 branch May 11, 2026 00:28
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