Closed counts-the-clouds closed 1 month ago
From the comment
// Segments are a little complicated, and I'm still working on their
// implementation. A tile might have a room and a hall for instance. These two
// segments are part of different features that span multiple tiles.
//
// I'm going to need a global feature registry because a completed feature
// is comprised of multiple tiles. They become a completed feature when
// all of the joined edges have been filled. This is clearly a many-to-many
// relationship so we'll probably want a join table to associate tile ids to
// feature ids.
//
// When a tile is first built though, all it has are its default segments,
// which should all be set to base or incomplete. If there are exits we know
// the tile is incomplete. If there are no exits the feature is a single tile
// feature and starts at the 'base' state. At least, that's my current
// thinking on how this will work.
//
// The TileSegment only needs to know how to draw the tile that it's part of.
// This is where the 'forms' come in. The actual state of these tiles will
// need to be kept track of somewhere else I think.
Almost done. Just need to add in the animation portion and this will be complete.
As in Carcassonne when a group of room or hall tiles have no more incomplete edges it forms a completed feature. We'll need to have some way of monitoring features. When a tile is placed if the edges aren't connected to anything we'll start a new feature. This will need to maintain the many-to-many relationship between tiles and features because a feature is composed of multiple tiles and multiple features can join at a single tile.
I think this might look like a graph, but we'll need to avoid circular references that come with 4 tiles placed in a square. We'll need to take into account what happens when two features are joined by placing tiles between them. Overall a very complicated task I think.