Open QuintillusCFC opened 2 years ago
Continuing the discussion from the PR:
A vertex and two edges per tile? I'm somewhat struggling to visualize that; I had been thinking it would be simpler to define a river as going between two vertices (e.g. forming an edge), or just one vertex if it's a one-vertex-only river. Although we'd also have to define the format for defining a vertex. Are the vertex coordinates the same as the tile to the north, south, east, or west of that vertex?
Imagine storing the river info for the N vertex and NW & NE edges for each tile. That way you get almost everything with no duplication since every vertex is north of exactly one tile and every edge is NW or NE of exactly one tile. The catch is we'd have to be careful around the edges. Without Y wrapping we'd need an extra row at the bottom of the map since otherwise the bottom edges & verts aren't north of anything. I don't think the left & right edges would be a problem but I'm not sure, I'd have to draw a little picture.
I think this is the easiest approach since we could assemble the data to save with a simple loop over the tiles. Storing rivers as lists of vertices requires us to convert the per-tile river info to such lists. That's doable, it's only a matter of walking a graph, but it would be somewhat harder to implement, in my estimation.
Vertex coordinates are actually the same as tile coordinates only there are no tiles there. The tile centers are laid out on a regular rectangular grid where half of the grid locations contain tile centers and the other half contain vertices.
Following discussion on https://github.com/C7-Game/Prototype/pull/239, we're in agreement that we should refactor how we store river info, likely storing it separately from tiles and only saving where rivers are (versus where they aren't, which is a lot more info). The exact format is still somewhat TBD, though there is some discussion of it in that PR.