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

v5.0 upgrade guide #39

Open bsimser opened 4 years ago

bsimser commented 4 years ago

Seems there's a lot of changes to v5.0 that I took a look at but it broke most of my code and I can't find alternative ways to figure out the way to move forward, so I have to go back to the last release until either I write my own functions to replace the old missing ones or figure out how to migration v4 RogueSharp to v5. Would like to see some documentation on how to do this.

Specifically here's a few things that break in v5 that I don't see a clear path to fix:

Thanks

FaronBracy commented 4 years ago

Check out this branch with changes to the example project: https://github.com/FaronBracy/RogueSharpRLNetSamples/compare/V5Upgrade

Specifically this commit: https://github.com/FaronBracy/RogueSharpRLNetSamples/commit/deea0d46a38e37413c121e3d840d2f57fe263346

There is now a generic Map<TCell> where TCell is your own Cell class. In the example I make a DungeonCell which has the IsExplored property.

In the example I also add a field of view method to the DungeonMap<DungeonCell> class that makes use of the FiledOfView class.

public ReadOnlyCollection<DungeonCell> ComputeFov( int xOrigin, int yOrigin, int radius, bool lightWalls )
{
  return _fieldOfView.ComputeFov( xOrigin, yOrigin, radius, lightWalls );
}

Because there are so many changes in V5 I plan to do a blog post about upgrading before making it a real release. I also was hoping to get some feedback and appreciate your comments here.

Talkyn commented 3 years ago

I'm in a similar position, but with a new project. The existing material (tutorials) are expected to be out of date, but what really slowed me down was that there are no samples that deal with with 5.0pre and the 'modern' way to do things.

The samples use the older, direct method of generating a map while the readme suggests using IMapCreationStrategy. The upgrade samples certainly helped, but it took a fairly long time for me to figure out how to get an inherited Map and Cell class to both play nice with this. I resorted to reading the map creation code in the library.