[MOD] Real Grass 2

A curated forum for compatible and maintained mods. Users are unable to create new topics in this forum but can reply to existing topics. Please message a moderator to have your mod moved into this forum area.
Post Reply
User avatar
TheLacus
Posts: 1327
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: [MOD] Real Grass 2

Post by TheLacus »

Daniel87 wrote: Sat May 01, 2021 2:57 pm Hey TheLacus,

I used you mod in conjunction with my own and it looks pretty damn amazing! Your mod perfectly compensates for the shortcomings of mine. It looks almost as if they are made for each other <3.

One problem remains nevertheless:

I have a different tile texture layout for MapPixels without Locations. This allowes me to swap the Texture2DArray for these MapPixels (which should make up the majority of the game world) and replace it with a Texture Set that doesnt have the "only in location" textures, allowing me to add additional transitions between stone, dirt and grass.

But whenever this is the case, it is quite random if the grass of your mod is actually spawned on textures that are actually not grass:
Hi, I would be happy to make this mod compatible :)

I'll need more informations about additional transitions that include grass. This mod defines grass layout for all tiles as shown in the tilemap atlas. Is it only a matter of mapping different tile indexes (for example i see that that tile 10 in your mod corresponds to tile 15 of classic game), or does your mod also have additional layouts not shown in the picture that should receive grass? Can you make an example of how grass should be positioned on those additional transitions?
Mod System documentation - Learn how to create mods for Daggerfall Unity.
Modder Discussion - General help and discussion for the mod system.
Github Issues - Submit a bug report for the game, including the mod system.

User avatar
Daniel87
Posts: 258
Joined: Thu Nov 28, 2019 6:25 pm

Re: [MOD] Real Grass 2

Post by Daniel87 »

TheLacus wrote: Sat May 01, 2021 11:31 pm
Daniel87 wrote: Sat May 01, 2021 2:57 pm Hey TheLacus,

I used you mod in conjunction with my own and it looks pretty damn amazing! Your mod perfectly compensates for the shortcomings of mine. It looks almost as if they are made for each other <3.

One problem remains nevertheless:

I have a different tile texture layout for MapPixels without Locations. This allowes me to swap the Texture2DArray for these MapPixels (which should make up the majority of the game world) and replace it with a Texture Set that doesnt have the "only in location" textures, allowing me to add additional transitions between stone, dirt and grass.

But whenever this is the case, it is quite random if the grass of your mod is actually spawned on textures that are actually not grass:
Hi, I would be happy to make this mod compatible :)

I'll need more informations about additional transitions that include grass. This mod defines grass layout for all tiles as shown in the tilemap atlas. Is it only a matter of mapping different tile indexes (for example i see that that tile 10 in your mod corresponds to tile 15 of classic game), or does your mod also have additional layouts not shown in the picture that should receive grass? Can you make an example of how grass should be positioned on those additional transitions?
Hy!

I use 80% of the original atlas, but I removed many of its textures, since they are only used in location blocks.
I utilize the two rotation and flip Bits the same way as in the original atlas. The tiles I added are only mirrored versions of original tiles as well as some corner tiles. Mostly its only a matter of different tile indexes, but for 2-4 tiles, you might have to place the grass in a different corner of the tile.

Let me send you my custom lookup table for further clarification:

Code: Select all

static protected TileObject[] tileTable = {
            // Water - Dirt
            new TileObject(MakeLookup(0, false, false),  0,0,0,0),

            new TileObject(MakeLookup(4, true, false),   1,0,0,0),
            new TileObject(MakeLookup(4, false, true),   0,1,0,0),
            new TileObject(MakeLookup(4, true, true),    0,0,1,0),
            new TileObject(MakeLookup(4, false, false),  0,0,0,1),

            new TileObject(MakeLookup(5, true, false),   1,1,0,0),
            new TileObject(MakeLookup(5, false, true),   0,1,1,0),
            new TileObject(MakeLookup(5, true, true),    0,0,1,1),
            new TileObject(MakeLookup(5, false, false),  1,0,0,1),

            new TileObject(MakeLookup(6, false, true),   1,1,1,0),
            new TileObject(MakeLookup(6, true, true),    0,1,1,1),
            new TileObject(MakeLookup(6, false, false),  1,0,1,1),
            new TileObject(MakeLookup(6, true, false),   1,1,0,1),

            new TileObject(MakeLookup(21, false, false), 0,1,0,1),
            new TileObject(MakeLookup(21, true, false),  1,0,1,0),

            new TileObject(MakeLookup(1, false, false),  1,1,1,1),

            // Dirt - Grass
            new TileObject(MakeLookup(7, true, false),   2,1,1,1),
            new TileObject(MakeLookup(7, false, true),   1,2,1,1),
            new TileObject(MakeLookup(7, true, true),    1,1,2,1),
            new TileObject(MakeLookup(7, false, false),  1,1,1,2),

            new TileObject(MakeLookup(8, true, false),   2,2,1,1),
            new TileObject(MakeLookup(8, false, true),   1,2,2,1),
            new TileObject(MakeLookup(8, true, true),    1,1,2,2),
            new TileObject(MakeLookup(8, false, false),  2,1,1,2),

            new TileObject(MakeLookup(9, false, true),   2,2,2,1),
            new TileObject(MakeLookup(9, true, true),    1,2,2,2),
            new TileObject(MakeLookup(9, false, false),  2,1,2,2),
            new TileObject(MakeLookup(9, true, false),   2,2,1,2),

            new TileObject(MakeLookup(22, true, false),  2,1,2,1),
            new TileObject(MakeLookup(22, false, false), 1,2,1,2),

            new TileObject(MakeLookup(2, false, false),  2,2,2,2),

            // Grass - Stone
            new TileObject(MakeLookup(10, true, false),  3,2,2,2),
            new TileObject(MakeLookup(10, false, true),  2,3,2,2),
            new TileObject(MakeLookup(10, true, true),   2,2,3,2),
            new TileObject(MakeLookup(10, false, false), 2,2,2,3),

            new TileObject(MakeLookup(11, true, false),  3,3,2,2),
            new TileObject(MakeLookup(11, false, true),  2,3,3,2),
            new TileObject(MakeLookup(11, true, true),   2,2,3,3),
            new TileObject(MakeLookup(11, false, false), 3,2,2,3),

            new TileObject(MakeLookup(12, false, true),  3,3,3,2),
            new TileObject(MakeLookup(12, true, true),   2,3,3,3),
            new TileObject(MakeLookup(12, false, false), 3,2,3,3),
            new TileObject(MakeLookup(12, true, false),  3,3,2,3),

            new TileObject(MakeLookup(24, true, false),  3,2,3,2),
            new TileObject(MakeLookup(24, false, false), 2,3,2,3),

            new TileObject(MakeLookup(3, false, false),  3,3,3,3),

            // Dirt - Stone
            new TileObject(MakeLookup(13, true, false),  3,1,1,1),
            new TileObject(MakeLookup(13, false, true),  1,3,1,1),
            new TileObject(MakeLookup(13, true, true),   1,1,3,1),
            new TileObject(MakeLookup(13, false, false), 1,1,1,3),

            new TileObject(MakeLookup(14, true, false),  3,3,1,1),
            new TileObject(MakeLookup(14, false, true),  1,3,3,1),
            new TileObject(MakeLookup(14, true, true),   1,1,3,3),
            new TileObject(MakeLookup(14, false, false), 3,1,1,3),

            new TileObject(MakeLookup(15, false, true),  3,3,3,1),
            new TileObject(MakeLookup(15, true, true),   1,3,3,3),
            new TileObject(MakeLookup(15, false, false), 3,1,3,3),
            new TileObject(MakeLookup(15, true, false),  3,3,1,3),

            new TileObject(MakeLookup(23, true, false),  3,1,3,1),
            new TileObject(MakeLookup(23, false, false), 1,3,1,3),

            //Dirt - Grass - Stone
            new TileObject(MakeLookup(16, true, false),  1,1,2,3),
            new TileObject(MakeLookup(16, false, true),  3,1,1,2),
            new TileObject(MakeLookup(16, true, true),   2,3,1,1),
            new TileObject(MakeLookup(16, false, false), 1,2,3,1),

            new TileObject(MakeLookup(27, true, false),  1,1,3,2),
            new TileObject(MakeLookup(27, false, true),  2,1,1,3),
            new TileObject(MakeLookup(27, true, true),   3,2,1,1),
            new TileObject(MakeLookup(27, false, false), 1,3,2,1),

            new TileObject(MakeLookup(17, true, false),  2,2,1,3),
            new TileObject(MakeLookup(17, false, true),  3,2,2,1),
            new TileObject(MakeLookup(17, true, true),   1,3,2,2),
            new TileObject(MakeLookup(17, false, false), 2,1,3,2),

            new TileObject(MakeLookup(28, true, false),  2,2,3,1),
            new TileObject(MakeLookup(28, false, true),  1,2,2,3),
            new TileObject(MakeLookup(28, true, true),   3,1,2,2),
            new TileObject(MakeLookup(28, false, false), 2,3,1,2),

            new TileObject(MakeLookup(18, true, false),  3,3,1,2),
            new TileObject(MakeLookup(18, false, true),  2,3,3,1),
            new TileObject(MakeLookup(18, true, true),   1,2,3,3),
            new TileObject(MakeLookup(18, false, false), 3,1,2,3),

            new TileObject(MakeLookup(29, true, false),  3,3,2,1),
            new TileObject(MakeLookup(29, false, true),  1,3,3,2),
            new TileObject(MakeLookup(29, true, true),   2,1,3,3),
            new TileObject(MakeLookup(29, false, false), 3,2,1,3),

            //Dirt - Stone & Grass
            new TileObject(MakeLookup(30, true, false),  3,1,2,1),
            new TileObject(MakeLookup(30, false, true),  1,3,1,2),
            new TileObject(MakeLookup(30, true, true),   2,1,3,1),
            new TileObject(MakeLookup(30, false, false), 1,2,1,3),

            //Dirt - Water & Grass
            new TileObject(MakeLookup(31, true, false),  2,1,0,1),
            new TileObject(MakeLookup(31, false, true),  1,2,1,0),
            new TileObject(MakeLookup(31, true, true),   0,1,2,1),
            new TileObject(MakeLookup(31, false, false), 1,0,1,2),

            //Dirt - Water & Stone
            new TileObject(MakeLookup(32, true, false),  3,1,0,1),
            new TileObject(MakeLookup(32, false, true),  1,3,1,0),
            new TileObject(MakeLookup(32, true, true),   0,1,3,1),
            new TileObject(MakeLookup(32, false, false), 1,0,1,3),

            //Grass - Dirt & Stone
            new TileObject(MakeLookup(33, true, false),  3,2,1,2),
            new TileObject(MakeLookup(33, false, true),  2,3,2,1),
            new TileObject(MakeLookup(33, true, true),   1,2,3,2),
            new TileObject(MakeLookup(33, false, false), 2,1,2,3),

            //Stone - Dirt & Grass
            new TileObject(MakeLookup(34, true, false),  2,3,1,3),
            new TileObject(MakeLookup(34, false, true),  3,2,3,1),
            new TileObject(MakeLookup(34, true, true),   1,3,2,3),
            new TileObject(MakeLookup(34, false, false), 3,1,3,2),

            //Road - Dirt & Grass
            new TileObject(MakeLookup(19, false, false), 19,19,19,19),

            new TileObject(MakeLookup(20, true, false),  1,20,19,20),
            new TileObject(MakeLookup(20, false, true),  20,1,20,19),
            new TileObject(MakeLookup(20, true, true),   19,20,1,20),
            new TileObject(MakeLookup(20, false, false), 20,19,20,1),

            new TileObject(MakeLookup(26, true, false),  2,26,19,26),
            new TileObject(MakeLookup(26, false, true),  26,2,26,19),
            new TileObject(MakeLookup(26, true, true),   19,26,2,26),
            new TileObject(MakeLookup(26, false, false), 26,19,26,2)
        };
MakeLookup function:

Code: Select all

static byte MakeLookup(int index, bool rotate, bool flip)
        {
            if (index > 255)
                throw new IndexOutOfRangeException("Index out of range. Valid range 0-255");
            if (rotate) index += 64;
            if (flip) index += 128;

            return (byte)index;
        }
A TileObject is just a container class holding

1. the tile (byte)
2. bottom left corner (int)
3. bottom right corner (int)
4. top right corner (int)
5. top left corner (int).

Code: Select all

public class TileObject {
        public byte Tile;
        public int Bl, Br, Tr, Tl;

        public TileObject(byte tile, int bl, int br, int tr, int tl) {
            Tile = tile;
            Bl = bl;
            Br = br;
            Tr = tr;
            Tl = tl;
        }
    }
Hope this helps. if you have any questions, feel free to drop me a message anytime

Post Reply