Skip to content

WIP : Attempt to change zoom level of the minimap#13

Draft
vadim-soude wants to merge 1 commit intoJNNGL:mainfrom
vadim-soude:main
Draft

WIP : Attempt to change zoom level of the minimap#13
vadim-soude wants to merge 1 commit intoJNNGL:mainfrom
vadim-soude:main

Conversation

@vadim-soude
Copy link

I want to change the zoom level of the minimap (like the vanilla way) meaning each pixel don't represent one block but, for example, four.

For now, I changed the way the flat render work, the minimap is scaled down the way I want, but I have an issue with player movement.
The minimap scrolling still goes at the same speed as the player, when it's a 1:1 ratio it's not an issue, but now it's a 1:2 ratio and it glitches out. When I go to the end of a 1:1 classic section of the world (a 128x128 zone) the visual snap to the beginning of the section and everything end-up is misaligned.

I hope someone can figure out how to fix the move part, I tried a lot of things, but everything broke 😞

Known issue : Since we are pulling blocks from a 256 by 256 zone (16*16 chunks) instead of 128 by 128 zone (8 by 8 chunks) everything is slower and the performances are way worst but it "normal"

@vadim-soude
Copy link
Author

image
And technically I cheated a little, I just took the first block of the four for each pixel instead of the most frequent, but I think it's better for performances.

@vadim-soude vadim-soude marked this pull request as draft March 29, 2024 12:47
@PamplemomM
Copy link

The key issue here is that the scroll speed of the minimap is still tied to the 1:1 ratio, but you’ve zoomed it out to a 1:2 ratio, so the player movement on the map is no longer aligned with their actual movement in the world. When the minimap is scaled down, you have to adjust the player’s position relative to the new zoom level.

You could try mapping the player’s real-world position to the minimap's scaled position. Here’s the rough idea:

  • Before Zoom: The minimap directly maps to world coordinates, i.e., each pixel represents 1 block.
  • After Zoom: Each pixel could represent 4 blocks (1:2 ratio). So, when you move, the position on the minimap should be adjusted by a factor of 4 for each direction.

I don't know if this is very clear but this is the idea

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.

2 participants