Giter VIP home page Giter VIP logo

Comments (7)

roy-t avatar roy-t commented on July 28, 2024 2

Hey, I was going to respond. But I see you went ahead already. But to be honest I was very much in doubt if this should be part of this library. Let me explain :).

I see the concrete Node and Edge classes as examples, or for quick prototyping. While I expect games to implement INode and IEdge via their own classes. And games having their own ideas on how to serialize them.

That leaves serialization of value in two scenarios:

  • In the editor
  • In prototypes

In case of the editor it might be nice. But the editor is mainly there tho show you how this library works. You can't make arbitrary graphs with it. So I'm not sure if a save/load feature is needed as you can always quickly recreate what you had in a few clicks.

In case of prototyping it might add real value. As you give users a quick way to load/save the graph. In that case also having the feature in the editor is nice because it gives people an example.

I've looked at your PR and I like it a lot more than I thought I would. The code is clean and having the separate types for serialization is very nice. However given the above ideas I have a couple of suggestions (If you agree).

  • Use one of the built-in serialization methods .net offers so we don't add an external dependency just for serialization (I know Newtonsoft is awesome, but one of the promises of this library is no external dependencies :)).
  • To signal better that serialization is a separate feature don't use extension methods, but use normal static methods
  • Add a single unit tests (create/save/load) as a smoke test so that new features don't accidentally break serialization

Other than that I like the code a lot!

from astar.

roy-t avatar roy-t commented on July 28, 2024 1

The editor is quite simple at the moment and doesn't support displaying arbitrary graphs. I think all the classes used are easily serializable by the built in serializers. Have you tried that? Otherwise I might be able to take a look at this request. :)

from astar.

roy-t avatar roy-t commented on July 28, 2024 1

Hey, changes look great. I've merged the changes and updated the version. Thanks for contributing! :D

from astar.

jcageman avatar jcageman commented on July 28, 2024

I tried serializing the grid to json, but the nodes matrix isn't serialized already. The format would't need to be efficiรซnt anyhow. As long as the editor would support grids up to 1000x1000 it should be good enough for testing. Might also be worth looking into graph viz for example just as an idea for general graphs.

from astar.

jcageman avatar jcageman commented on July 28, 2024

Would you have any thoughts how you would want it implemented? i could give it a go and submit a pull request?

from astar.

jcageman avatar jcageman commented on July 28, 2024

I'll rewrite my PR given your feedback and I'll write some unit tests to support it ๐Ÿ‘ Which serialization method would you prefer? I thought json would be nice since it's readable at least (especially in case of issues when format changed).

from astar.

jcageman avatar jcageman commented on July 28, 2024

Just submitted my latest changes, please have another look

from astar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.