MineColonies

MineColonies

57M Downloads

Wrong scematic mirroring and rotation

Coocys opened this issue ยท 10 comments

commented

Prerequisites

  • I am running the latest alpha version of MineColonies and Structurize for my Minecraft version.
  • I checked the MineColonies/Structurize wiki and made sure my issue is not covered there.
  • I made sure that this issue is not a duplicate of any existing issue.

Context

  • Minecraft Version: 1.16.4
  • MineColonies Version: Alpha 0.13.596
  • Structurize Version: 0.13.113-Alpha
  • Related Mods and their Versions: We have more mods but not related

Expected behavior

Preview for shema in building prosess stays static. New planed shema (with building tool) mirrores on some axis or rotates.

Actual behavior

Both preview of shema in building prosess and new shema bot mirror and rotate around the axis.

In Video shown the left preview is in work and the right on is the new shematic i want to mirror and place

Steps to reproduce the issue

  • Start build a building.
  • In the building process try to plan a new building with the building tool.
  • Move the preview so close to build in process that the lvl 5 scematic of the other building is shown.
  • Now you can rotate and mirror both at the same time even if one building is already in prozess of being build.

Logs

We dont have any crashes

Notes

Only works for the same type of building

Video Link: https://youtu.be/zcIcvL8wrQ4
I am sorry for the Audio just ignor it :D


Viewers

  • Add a thumbs-up to the bug report if you are also affected. This helps the bug report become more visible to the team and doesn't clutter the comments.
  • Add a comment if you have any insights or background information that isn't already part of the conversation.
commented

@Nightenom is there sth we can do?

commented

@Nightenom I wondered about adding a "static" flag to the rendering which adds it to a seperate static cache.

commented

Sure, go ahead, but it would be nice to make sure we don't have two completely same entries in two caches

commented

Does it matter, we only ever render one dynamic schematic, but a potential list of static schematics. The static ones should be fine because we don't alter mirror or rotation afterwards?

commented

The problem is current cache impl in structurize isn't aware of multiple rendering (it's not event-based, it's just dumb cache based on blueprint name - you can't base it on pos/rotation/mirror since then the cache would have no purpose)
Probably unfixable without kinda big rewrite, so the only option left is to bypass structurize cache from mcol side - for the static things create BlueprintRenderer per each and dispose it on build tool gui close. You can try to make it only work if gui selected schematic == one of static things but you have to pay enough attention when switching back to cache-rendered (so pos/rotation/mirror are correct)

commented

Just spitballing since I'm unfamiliar with the codebase (or what the caches are for), but couldn't you have a multi-layer cache? Level one is a per-schematic cache completely untransformed (presumably what the current cache is, from your description), and then on top of that is something that remembers a particular transform or whatever is needed to render in a particular orientation (rotation+mirror). You can then reuse the second level cache for all buildings of that type and rotation at different positions, and the first level cache is used to build the second level cache entries if you haven't cached that orientation yet.

commented

The problem is rotation/mirror requires a rebuild of baked blocks array which are kinda large data and we don't want our mod to use hundreds of MB of ram, the solution is to add one more logic level into rendering but that's kinda large work

commented

We already created a fix for this. Will be out soon.

commented

Would it be possible to rotate/mirror the "camera" calculating the rendering rather than the block data itself? Would that be any smaller?

Or maybe just make the showing of the upgraded buildings optional? There are times when it can actually make it harder to properly place an adjacent building because the preview gets in the way (even when showing correctly), e.g. with fortress style since the buildings usually are touching each other but at certain angles you'd be previewing through a virtual wall.

commented

fix released