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

v5.0 upgrade guide #39

Open
bsimser opened this issue May 25, 2020 · 2 comments
Open

v5.0 upgrade guide #39

bsimser opened this issue May 25, 2020 · 2 comments

Comments

@bsimser
Copy link

bsimser commented May 25, 2020

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:

  • ComputeFov is no longer in the Map class. I know there's a FieldOfView class but it doesn't seem to be used anywhere. I think you're supposed to use the FieldOfView class on the fly and pass the Map in and use it's ComputeFov from it?
  • Cells no longer have a value for if they're explored or not (IsExplored) so do we have to keep track of this ourselves in our own Cell implementations?

Thanks

@FaronBracy
Copy link
Owner

FaronBracy commented May 26, 2020

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

Specifically this commit:
FaronBracy/RogueSharpRLNetSamples@deea0d4

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
Copy link

Talkyn commented Jul 25, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants