You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The key frame tile linking is bugged. See branch bug/anim-tiles for details. Specifically, the problem is in the logic of compiler.cppassignTilesPrimary (and secondary) function.
The function first runs through all the animated NormalizedTiles. These tiles are tagged with ColorSets that include all the colors across all the animation frames, not just the key frame. Based on those ColorSets, it chooses the first matching palette for the tile, computes the GBATile, and stores that in the usedKeyFrameTiles map.
Later on, when processing the regular NormalizedTiles, it is possible in some cases that a regular tile that visually matches a key frame tile won't link up. Why? Because if the key frame tile does not contain all the colors used across all frames, then the regular-tile version of the key frame tile will have a different ColorSet. (An aside: this is quite a common case. Consider a flower animation where one of the key frame tiles is just a leaf, but in the last frame some of the red flower dips into the tile. The full AnimTile version will contain the red, while the regular-tile version present on the layer sheet will not.) This means that it is possible Porytiles will choose a different palette for the regular-tile version, since there is often more than one palette that can match a tile (color duplication across palettes). It will then compute the GBATile using a different palette. Since that palette will almost certainly have the colors in different positions, the regular-tile version's GBATile won't match the AnimTile GBATile in the usedKeyFrameTiles map. Thus the animation won't be correctly linked.
I will have to think about how to fix this. One idea: change the usedKeyFrameTiles map to store more information so that later on when assigning the non-anim tiles, we can try to detect if a regular-tile version of a key frame is present but with a slightly different ColorSet.
Another solution possibility: let's try to fix this issue and #49 in one fell swoop. The idea: decouple the key frame entirely from the compilation system. Change NormalizedTile to have a special field called keyFrame that is only set for animated tiles. keyFrame could have a new type, i.e. be a regular RGB image. The colors in keyFrame will not be used at all for palette allocation (we could also modify the importer so that we can remove the 16 color limit. That is, when the importer sees a tile that violates the 16 color limit, first check if its a key frame, since we imported those first). When we do the final linking up in assignTiles{Primary,Secondary}, for each tile we first check if it exactly matches one of our key frames. If so, we link up that anim. Otherwise, process as normal.
The text was updated successfully, but these errors were encountered:
The key frame tile linking is bugged. See branch
bug/anim-tiles
for details. Specifically, the problem is in the logic ofcompiler.cpp
assignTilesPrimary
(and secondary) function.The function first runs through all the animated
NormalizedTile
s. These tiles are tagged withColorSet
s that include all the colors across all the animation frames, not just the key frame. Based on thoseColorSet
s, it chooses the first matching palette for the tile, computes theGBATile
, and stores that in theusedKeyFrameTiles
map.Later on, when processing the regular
NormalizedTile
s, it is possible in some cases that a regular tile that visually matches a key frame tile won't link up. Why? Because if the key frame tile does not contain all the colors used across all frames, then the regular-tile version of the key frame tile will have a differentColorSet
. (An aside: this is quite a common case. Consider a flower animation where one of the key frame tiles is just a leaf, but in the last frame some of the red flower dips into the tile. The full AnimTile version will contain the red, while the regular-tile version present on the layer sheet will not.) This means that it is possible Porytiles will choose a different palette for the regular-tile version, since there is often more than one palette that can match a tile (color duplication across palettes). It will then compute theGBATile
using a different palette. Since that palette will almost certainly have the colors in different positions, the regular-tile version'sGBATile
won't match the AnimTileGBATile
in theusedKeyFrameTiles
map. Thus the animation won't be correctly linked.I will have to think about how to fix this. One idea: change the
usedKeyFrameTiles
map to store more information so that later on when assigning the non-anim tiles, we can try to detect if a regular-tile version of a key frame is present but with a slightly differentColorSet
.Another solution possibility: let's try to fix this issue and #49 in one fell swoop. The idea: decouple the key frame entirely from the compilation system. Change
NormalizedTile
to have a special field calledkeyFrame
that is only set for animated tiles.keyFrame
could have a new type, i.e. be a regular RGB image. The colors inkeyFrame
will not be used at all for palette allocation (we could also modify the importer so that we can remove the 16 color limit. That is, when the importer sees a tile that violates the 16 color limit, first check if its a key frame, since we imported those first). When we do the final linking up inassignTiles{Primary,Secondary}
, for each tile we first check if it exactly matches one of our key frames. If so, we link up that anim. Otherwise, process as normal.The text was updated successfully, but these errors were encountered: