FaronBracy / RogueSharp

A .NET Standard class library providing map generation, path-finding, and field-of-view utilities frequently used in roguelikes or 2D tile based games. Inspired by libtcod
https://roguesharp.wordpress.com/
MIT License
574 stars 58 forks source link

Address performance issue with getting adjacent cells #36

Closed FaronBracy closed 4 years ago

FaronBracy commented 4 years ago

New method GetAdjacentCells with overload for including diagonal cells

The pathfinder class was using GetBorderCellsInSquare and GetBorderCellsInDiamond methods with a distance of 1 for finding neighbors. The internal implementation of those was not really performant when iterating over ever cell in the map and making these calls.

Breaking Change - Removed IsInFov from Map and Cell classes

This was a holdover from V1 of RogueSharp and was never really meant to continue once we had a proper field-of-view class.

Breaking Change - Removed IsExplored from Map and Cell classes

Now that we can properly inherit from these classes, it should be up to the developer to determine which additional properties should be a part of cells. Transparency and Walkability are necessary for FOV and Pathfinding. Explored status was only for the demo game and shouldn't actually be part of the RogueSharp library.