Skip to content

Implement Shape Awareness

Implementing Shape Awareness

Goal Summary

Create a means of detecting when a proper shape is made, and what kind of shape it is.

Existing Relevant Data Structures

Grid Points

Currently Aware of:

  • Their current state
  • Their grid coordinates
  • Their world position
  • A list of all attached LineSegments

Needed Changes:

  • Add new state InShape (Logic check & visual feedback for users)

Line Segments

Currently Aware of:

  • Array of GridPoints as 'EndPoints'
  • _IsFollowingMarker

Needed Changes:

  • Add bool state _isInShape (Logic check & visual feedback for users)
  • An awareness of length. Metrics in GridPoints and World Units.

Lattice Grid

Currently Aware of:

  • A three dimensional array that makes up the grid.
  • Able to target any GP via int[3] coordinates.

Development Questions

Where will this logic be held?

On each GridPoint?

Pros:

  • Already exists a line of data communication via GridPoint -> LineSegment.EndPoints -> other GridPoint.

Cons:

  • Having each GP processing an awarness of shapes is costly and cluttered.
  • Needs a means of communicating with the LatticeGrid for networking.

Add component to LatticeGrid?

Pros:

  • Creates a centralized means of observing shapes that can be easily pointed too via networking
  • Less logic clutter/redundancies.

Cons:

  • Need of efficient method of communicating with the GridPoints/LineSegments

How should this behavior be structured?

As of writing this, my knee jerk solution is to perhaps create a new method on the GridPoint script to iterate through connected GridPoints via LineSegments and return a List. Then have this data sent to a ShapeAwareness component of the LatticeGrid to parse out the data to compute if there is a shape.