Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate Glitches in Tilemaps Plugin #689

Closed
ilexp opened this issue Oct 6, 2018 · 9 comments
Closed

Investigate Glitches in Tilemaps Plugin #689

ilexp opened this issue Oct 6, 2018 · 9 comments
Labels
Bug It's broken and should be fixed Help Wanted Contributions especially appreciated Tilemaps Area: Tilemaps core / editor plugins
Milestone

Comments

@ilexp
Copy link
Member

ilexp commented Oct 6, 2018

Summary

While reviewing PR #687, @mfep found some unrelated issues with the Tilemaps plugin. Investigate and fix them.

as I looked into the PR related to the tilemaps plugin, I've noticed that it's in quite a bad shape. I didn't really have time to investigate them, but just FYI, here's some glitches I encountered. I don't think any of them is caused by the PR

  1. unknown circumstances, the tile paint tool does not paint the selected tile, but an other (!)
  2. unknown circumstances, the tile size property of the Tileset fails to update. On the tile palette it seems normal, but when drawn, 4 tiles draws in each grid position
  3. the little overlay which is supposed to indicate the currently hovered tile coordinates is blank and at a weird place (screenshot)

https://cdn.discordapp.com/attachments/229132318915297280/497131704536793108/Untitled.png

How to reproduce

  • Unknown. Investigate and comment when repro steps for any of the above are found.
@ilexp ilexp added Bug It's broken and should be fixed Help Wanted Contributions especially appreciated Plugin Area: Misc. core / editor plugins labels Oct 6, 2018
@ilexp ilexp added this to the General milestone Oct 6, 2018
ilexp added a commit that referenced this issue Oct 6, 2018
#FIX: Fixed a Canvas state leak for rendering CamView overlays in TilemapEditor, causing one of the glitches from issue #689
@ilexp
Copy link
Member Author

ilexp commented Oct 6, 2018

Looked into (3) and fixed it with the above commit. There was an overlay rendering routine that adjusted the state of a shared Canvas without resetting it afterwards, causing offset and rotation issues in rendered overlays.

The other two are of course still up for grabs 👍

@helle253
Copy link
Contributor

helle253 commented Oct 8, 2018

I'll take a look and see if I can get to the bottom of either of the other 2. @mfep Is there any additional information you can provide regarding reproduction steps and/or source of the issue? Thanks in advance 👍

@mfep
Copy link
Contributor

mfep commented Oct 8, 2018

I could reproduce glitch no. 1. It's possible that this is related to issue 2. as well. Here's how:

  1. Create a Tilemap with a TilemapRenderer in the Scene
  2. Open the used Tileset in the Tileset Editor window
  3. Open the Main Texture object, and modify the X component of the Source Tile Size property
  4. Press tab into the Y component, and edit that as well. Notice, that the Apply and Revert buttons on the bottom of the Tileset Editor do gray out. So the naive user would think that everything is in order...
  5. Go back to edit the Tilemap. All of the painting tools draw a different tile, not the selected one.

@helle253
Copy link
Contributor

helle253 commented Oct 15, 2018

It looks like there are some other issues with the tile palette. When docking windows, sometimes the palette window infinitely. I am still unsure of the mechanisms, but it looks like when the scene camera and the tile palette are in the same dock, they don't play well together.

2018-10-15-20-14-50

Regarding step 4 in your repro steps, that looks like another issue entirely, and is likely the source of some bugs - When resizing the source tile size to the same proportions as they were before, (e.g. resizing from (8,8) to (16,16)) the apply/revert buttons are inactive. I don't see this issue when changing the proportions, however.

@helle253
Copy link
Contributor

helle253 commented Oct 16, 2018

Upon further investigation, part of the issue appears to be the hash function in Point2.cs:

return this.X.GetHashCode() ^ this.Y.GetHashCode();

when you are using a square source tile, which is not an unusual scenario, this hash is always 0. The tilemap editor uses hash codes to determine whether changes have been made, so it flags this as a non-change, since the hash codes now match again, even though the source tile size has changed.

Modifying the hash code calculations for tilemaps should do the trick.

@helle253
Copy link
Contributor

Further investigation is needed in to other tile painting issues. When the SourceTileSize is changed, it appears the tiles paint incorrectly. The original tilemap size was 32x32; 16x16 and 64x64 both exhibit odd behaviors:

ezgif-1-f5bf1b59b946

ezgif-1-fd8d29779e25

@ilexp
Copy link
Member Author

ilexp commented Oct 16, 2018

Further investigation is needed in to other tile painting issues. When the SourceTileSize is changed, it appears the tiles paint incorrectly. The original tilemap size was 32x32; 16x16 and 64x64 both exhibit odd behaviors:

Can you verify this with a newly created tileset and repro steps? As changing the source tile size shifts how the source images are broken up into tiles, what you are observing could be correct behavior with "user caused incorrect data". For example, if tile indices are shifted, previous AutoTile settings could apply to different tiles in ways that no longer make sense visually.

@ilexp
Copy link
Member Author

ilexp commented Oct 16, 2018

It looks like there are some other issues with the tile palette. When docking windows, sometimes the palette window infinitely. I am still unsure of the mechanisms, but it looks like when the scene camera and the tile palette are in the same dock, they don't play well together.

Can you file a new issue for this with the description and video you provided? I think you're right that this is something else entirely, probably better discussed in a new thread.

Great work investigating these issues so far btw 👍

@ilexp
Copy link
Member Author

ilexp commented Oct 19, 2018

I believe that all Tilemap glitches have now been either fixed, or moved into their own issues. Closing this.

For reference, see #693, #690 and #694.

@ilexp ilexp closed this as completed Oct 19, 2018
@ilexp ilexp added Tilemaps Area: Tilemaps core / editor plugins and removed Plugin Area: Misc. core / editor plugins labels Jul 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It's broken and should be fixed Help Wanted Contributions especially appreciated Tilemaps Area: Tilemaps core / editor plugins
Development

No branches or pull requests

3 participants