Comments (7)
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.
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.
Hey, changes look great. I've merged the changes and updated the version. Thanks for contributing! :D
from astar.
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.
Would you have any thoughts how you would want it implemented? i could give it a go and submit a pull request?
from astar.
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.
Just submitted my latest changes, please have another look
from astar.
Related Issues (20)
- Considering the size of the agent
- Finding closest path to unreachable end cell HOT 4
- Deterministic? HOT 2
- Info: v2 WIP version available on Master HOT 2
- Hidden Connect method HOT 3
- Documentation / IntelliSense support HOT 5
- Isometric Support HOT 1
- Coming to v3 HOT 3
- Path. HOT 3
- No issue just a question. HOT 3
- TODO: release new minor version with save/load changes HOT 1
- just question HOT 2
- Question: GPS coordinates HOT 3
- Question HOT 1
- Explanation on how velocity is used HOT 6
- Question : Bidirectional graph search HOT 1
- Question: obstacles HOT 3
- Discussion on algorithms HOT 5
- Add Grid.Connect(GridPosition position)? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astar.