Open
Conversation
* 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
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:

After change:
