2d-extras icon indicating copy to clipboard operation
2d-extras copied to clipboard

TerrainTile's code is hard to understand/modify.

Open phildowney opened this issue 7 years ago • 6 comments

Our game features more terrain tiles than specified in TerrainTile (for example, "one side bottom" and "one side top" are different, not simply mirrors of eachother). The current code isn't exactly super easy to grok for the purposes of extensibility for this feature.

phildowney avatar Oct 31 '18 03:10 phildowney

Below are a few screenshots of what the "scavenger" will look like depending on the TerrainTile settings. terrain1 terrain2 terrain3 terrain4 terrain5 terrain6 terrain7

uvivagabond avatar Nov 29 '18 17:11 uvivagabond

Here every settings in one picture. terrainall

uvivagabond avatar Nov 29 '18 17:11 uvivagabond

Here practical example how to use TerrainTile. I used asset from Kenney. https://kenney.nl/assets/sci-fi-rts In the drawing I added the equivalent settings from TileRule. terrain - drogi

uvivagabond avatar Nov 29 '18 17:11 uvivagabond

That's a very useful drawing explaining Terrain Tile, @uvivagabond! 👍

edwardrowe avatar Nov 29 '18 17:11 edwardrowe

I also add picture with Pipeline Tile. pipeline wlasciwe ustawienie aby wszystkie kafelki sie laczyly

uvivagabond avatar Nov 30 '18 01:11 uvivagabond

Problem still exists. The TerrainTile isn't useable for isometric tilemaps as the tiles can't just simply be rotated. While trying to expand the functionality for isometric tilemaps I struggle with the following magic bit byte original = (byte)mask; if ((original | 254) < 255) { mask = mask & 125; } if ((original | 251) < 255) { mask = mask & 245; } if ((original | 239) < 255) { mask = mask & 215; } if ((original | 191) < 255) { mask = mask & 95; }

Just a few comments would really help the code.

46692 avatar Jun 06 '19 18:06 46692