Skip to content

Vertical tilemap layers#41

Open
Megabjarne wants to merge 3 commits intotigerplush:mainfrom
Megabjarne:feature/vertical_tilemap_layers
Open

Vertical tilemap layers#41
Megabjarne wants to merge 3 commits intotigerplush:mainfrom
Megabjarne:feature/vertical_tilemap_layers

Conversation

@Megabjarne
Copy link
Copy Markdown
Contributor

@Megabjarne Megabjarne commented Apr 5, 2026

Before the world was scanned to find the topmost block (at or below the camera) and this block was rendered as a tile on a flat tilemap, and other entities were drawn as sprites slightly above this terrain tilemap,
this meant that entities couldn't be obscured by terrain, to the point where they were always visible regardless of what layer the camera was relative to them.
With this change, N layers of tilemaps are created at various Z values, and when the rendering scan finds a block it is rendered as a tile on the tilemap at the corresponding height, entities like dwarves are now similarly drawn at their current Z value, this allows entities to be "below" the terrain and obscured.
In addition, a tilemap is created for tiles that are obscured, like where there is a solid block at the same height as the camera, previously nothing would be drawn there so it would default to the clear color, but now black tiles are drawn in order to obscure any entities that might be rendered below it.

Before change:
image

After change:
image

* Generate tilemaps at different z heights to allow entities to be obscured by terrain
* Obscures entities drawn on the layers further down
* Move the camera in z to fit with the current view layer/height
* Reduce near clipping plane to exclude entities drawn at higher z levels than the camera
@Megabjarne
Copy link
Copy Markdown
Contributor Author

I'm not married to the name "Blocked tile" but coduln't think of anything better on the spot, and wanted to just get the basic functionality in place

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