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

Add FOV Implementations/Options which Consider 1-Thick Diagonal Walls Opaque #229

Open
fcheadle opened this issue Jun 19, 2021 · 1 comment
Milestone

Comments

@fcheadle
Copy link
Collaborator

fcheadle commented Jun 19, 2021

FOV calculations can see through diagonal walls that have a thickness of 1.

To see what I mean, use TheSadRogue.Integration, and add the following lines to Program.cs after line 70:

if(location.X + location.Y == 7)
    map.SetTerrain(new MemoryAwareRogueLikeCell(location, Color.White, Color.Black, '#', 0, false, false));

This creates a simple diagonal line near the player's starting point that SHOULD be solid in some scenarios, or at least, have the option for the user to make them solid and non-transparent.

Simplest fix: make Calculate methods in `FOV virtual to allow for custom implementations.

Screenshot

@Chris3606 Chris3606 changed the title FOV can see through diagonal walls in all radius types. Add FOV Implemenations/Options which Consider 1-Thik Diagonal Walls Opaque May 28, 2022
@Chris3606 Chris3606 changed the title Add FOV Implemenations/Options which Consider 1-Thik Diagonal Walls Opaque Add FOV Implementations/Options which Consider 1-Thik Diagonal Walls Opaque May 28, 2022
@Chris3606 Chris3606 changed the title Add FOV Implementations/Options which Consider 1-Thik Diagonal Walls Opaque Add FOV Implementations/Options which Consider 1-Thick Diagonal Walls Opaque May 28, 2022
@Chris3606
Copy link
Owner

To clarify; this is not a "bug" in FOV's shadowcasting implementation so much as it's simply a feature which isn't implemented in GoRogue's implementation of that algorithm. It is, however, a valid use case that the library should have some built-in support for.

It is currently possible for a user to fix this on their own for a given use case; the GoRogue FOV system is now built around the IFOV interface, which provides an abstraction sufficient for a user to solve this by creating/implementing their own FOV algorithm which handles diagonal walls in this way.

Further, it is possible for the library to provide some FOV implementation or option that does this; it's just not implemented currently.

There are methods implementing checks into shadowcasting to solve this; so that's one option; we just need to make sure that if we do this, it doesn't affect performance of the overall algorithm. So there are basically 2 options; we can do 1 or both of these:

  1. Modify the current recursive shadowcasting implementations to have an option which considers 1-thick diagonal walls opaque.
  2. Create additional FOV algorithm implementations, such that some of which consider 1-thick diagonal walls opaque.

@Chris3606 Chris3606 added this to the 3.x milestone May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants