OndrejNepozitek / Edgar-Unity

Unity Procedural Level Generator
https://ondrejnepozitek.github.io/Edgar-Unity/docs/introduction
MIT License
817 stars 70 forks source link

Fog of war reveal part of normal room when revealing a single corridor room #126

Closed hippopennyThinh closed 6 months ago

hippopennyThinh commented 8 months ago

Hello! Is there a way to make it so that when the player steps into a corridor room, the fog of war reveals that corridor room and part of the room the corridor is leading to? Currently the corridor has a trigger that will call the FogOfWarGrid2D.Instance.RevealRoom() function, the corridor gets revealed just fine but i also want some tiles of other room to be revealed as well, like when a normal room gets revealed some part of the neighbouring corridors also get revealed

OndrejNepozitek commented 8 months ago

Hey, I think I tried that some time ago but it looked kinda weird if I used the same logic that I use to reveal the tiles of the corridors.

hippopennyThinh commented 8 months ago

Hello again! Sorry for the late reply Is there a function or any way of implementation so i can test it out?

OndrejNepozitek commented 8 months ago

Hey, I don't have anything implemented right now but I can try to revisit this soon. However, I'm quite busy now, will try to reply next week.

hippopennyThinh commented 8 months ago

Thank you, please take your time

hippopennyThinh commented 7 months ago

image Hello, sorry for keep bothering you Is there a way to make it so that the outline of the room (the blue part) has the same effect as the entrance to the corridor (the red part)? I'm having a bit of problem where some particles get cut off like this and i believe it is due to that image

OndrejNepozitek commented 7 months ago

image Hello, sorry for keep bothering you Is there a way to make it so that the outline of the room (the blue part) has the same effect as the entrance to the corridor (the red part)? I'm having a bit of problem where some particles get cut off like this and i believe it is due to that image

Hey, if you want to experiment with it, I can make the outline of each room to be extended by 1 extra tile. But what that means is that if there is another room right next to your current room, it will also get revealed, which would look weird. So you must configure the algorithm so that there's at least one empty tile between each pair of rooms. You can do that in the Generator component -> "Minimum room distance". Keep in mind that it might affect the performance of the generator a bit.

If you want to try this out, use this snippet of code starting from line 289 in the FogOfWarGrid2D file, replacing the original content:

        // Go through the rooms and set the target fog value
        foreach (var room in roomsToReveal)
        {
            var points = GetPolygonPoints(room.OutlinePolygon);
            var extendedOutline = GetExtendedOutline(points);

            foreach (var point in points.Concat(extendedOutline))
            {
                tiles[point] = new TileInfo(revealedFogValue, false);
            }
        }
OndrejNepozitek commented 7 months ago

Hello! Is there a way to make it so that when the player steps into a corridor room, the fog of war reveals that corridor room and part of the room the corridor is leading to? Currently the corridor has a trigger that will call the FogOfWarGrid2D.Instance.RevealRoom() function, the corridor gets revealed just fine but i also want some tiles of other room to be revealed as well, like when a normal room gets revealed some part of the neighbouring corridors also get revealed

I tried to make it work but it would require a bigger effort so I don't think I can make this happen in the near future.