Hey guys,

Just checking in with a progress update on the new mapping work. This one’s been focused on something that sounds simple… but really isn’t once you dig into it:

Rotating tile maps efficiently.

On the surface the demo just looks like an image being moved around.
Hover over it though and you’ll see the truth — it’s not an image at all.

It’s a map made up of quad polygons.
In some tests that’s:

• 28,000 polygons
• 113,000 polygons
• Upwards of 450,000 potential polygons

Every tile = a filled quad.





The Problem

When there’s no rotation, clipping a tile map to the viewport is pretty straightforward.

But once you introduce:

Rotation
Scaling
Projection
Alpha blending


Now you’re transforming and submitting huge numbers of polygons that may never even appear on screen.

That’s wasted work.

The goal here is simple:

Do not rotate, scale, or render polygons we don’t need.




The New Approach

The current system uses a subdivision-style clipping method.

Instead of checking tiles individually, it:

1. Estimates which region of the map intersects the viewport
2. Subdivides that region into smaller blocks
3. Tests those blocks against the camera
4. Rejects entire sections that fall outside

It keeps subdividing until blocks reach a minimum size (currently around 4×4 tiles).
At that point, it’s cheaper to just draw them than keep testing further.

This dramatically reduces the number of polygons sent to the renderer.

Examples from the demo:

• 28,000 → ~12,000 polygons
• 113,000 → ~1,500 polygons
• 450,000 potential → drops heavily once zoomed

That’s a serious reduction.




Why This Matters

This is really about enabling:

Camera rotation on large tile maps

Without this reduction layer, rotating cameras become impractical very quickly.

The nice part is — this reduction happens before rendering.
So it doesn’t matter whether it’s:

• Software rendered
• Hardware rendered
• Future pipeline changes

The same visibility logic applies.




Other Bits & Pieces

While working on this I also:

• Split more low-level functionality into the Vector2D library
• Added point-in-quad helpers
• Used rotated quad testing for hover detection
• Tested alpha blending over outlines
• Bruteforced ridiculous polygon counts just to see what breaks

It’s very much proof-of-concept, but this version is far more stable than earlier chunk-based attempts — especially around nasty 45° rotation cases.




Where It’s Headed

Next step is integrating this into the mapping library properly.

Still need to account for:

• Tile animation
• Null / masked tiles
• Further optimization passes

But so far?

I’m actually pretty happy with how it’s behaving.

Which is rare 😄




If I can’t break it in the next round of testing, this might finally be the version that sticks.

Let me know what you think.